(stream: Stream, options: ConnectionOptions)
| 167 | } |
| 168 | |
| 169 | function streamIdentifier(stream: Stream, options: ConnectionOptions): string { |
| 170 | if (options.proxyHost) { |
| 171 | // If proxy options are specified, the properties of `stream` itself |
| 172 | // will not accurately reflect what endpoint this is connected to. |
| 173 | return options.hostAddress.toString(); |
| 174 | } |
| 175 | |
| 176 | const { remoteAddress, remotePort } = stream; |
| 177 | if (typeof remoteAddress === 'string' && typeof remotePort === 'number') { |
| 178 | return HostAddress.fromHostPort(remoteAddress, remotePort).toString(); |
| 179 | } |
| 180 | |
| 181 | return ByteUtils.toHex(uuidV4()); |
| 182 | } |
| 183 | |
| 184 | /** @internal */ |
| 185 | export class Connection extends TypedEventEmitter<ConnectionEvents> { |
no test coverage detected