You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
549 B
TypeScript
36 lines
549 B
TypeScript
export interface IConnection {
|
|
clientConn: {
|
|
id: string
|
|
tls: boolean
|
|
address: string
|
|
}
|
|
serverConn?: {
|
|
id: string
|
|
address: string
|
|
peername: string
|
|
}
|
|
intercept: boolean
|
|
opening?: boolean
|
|
flowCount?: number
|
|
}
|
|
|
|
export class ConnectionManager {
|
|
private _map: Map<string, IConnection>
|
|
|
|
constructor() {
|
|
this._map = new Map()
|
|
}
|
|
|
|
get(id: string) {
|
|
return this._map.get(id)
|
|
}
|
|
|
|
add(id: string, conn: IConnection) {
|
|
this._map.set(id, conn)
|
|
}
|
|
|
|
delete(id: string) {
|
|
this._map.delete(id)
|
|
}
|
|
}
|