MCPcopy
hub / github.com/mongodb/node-mongodb-native / streamIdentifier

Function streamIdentifier

src/cmap/connection.ts:169–182  ·  view source on GitHub ↗
(stream: Stream, options: ConnectionOptions)

Source from the content-addressed store, hash-verified

167}
168
169function 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 */
185export class Connection extends TypedEventEmitter<ConnectionEvents> {

Callers 1

constructorMethod · 0.85

Calls 3

uuidV4Function · 0.90
fromHostPortMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected