| 174 | } |
| 175 | |
| 176 | public getStats(): ProxyStats { |
| 177 | const connections = Array.from(this.connections.values()); |
| 178 | |
| 179 | return { |
| 180 | activeConnections: connections.length, |
| 181 | totalConnections: connections.length, |
| 182 | globalInterceptors: this.globalInterceptors.map(i => i.state), |
| 183 | connections: connections.map((conn) => ({ |
| 184 | id: conn.id, |
| 185 | clientAddress: conn.clientAddress, |
| 186 | clientPort: conn.clientPort, |
| 187 | connectedAt: conn.connectedAt, |
| 188 | interceptors: conn.interceptors.map(i => i.state) |
| 189 | })), |
| 190 | }; |
| 191 | } |
| 192 | |
| 193 | public closeConnection(connectionId: string): boolean { |
| 194 | const connection = this.connections.get(connectionId); |