MCPcopy Create free account
hub / github.com/nodejs/node / connect

Method connect

deps/undici/src/lib/core/socks5-client.js:275–289  ·  view source on GitHub ↗

* Send CONNECT command * @param {string} address - Target address (IP or domain) * @param {number} port - Target port

(address, port)

Source from the content-addressed store, hash-verified

273 * @param {number} port - Target port
274 */
275 connect (address, port) {
276 if (this.state === STATES.CONNECTING || this.state === STATES.CONNECTED) {
277 throw new InvalidArgumentError('Connection already in progress')
278 }
279
280 if (this.state !== STATES.AUTHENTICATED) {
281 throw new InvalidArgumentError('Client must be authenticated before CONNECT')
282 }
283
284 debug('connecting to', address, port)
285 this.state = STATES.CONNECTING
286
287 const request = this.buildConnectRequest(COMMANDS.CONNECT, address, port)
288 this.socket.write(request)
289 }
290
291 /**
292 * Build a SOCKS5 request

Callers 2

Calls 3

buildConnectRequestMethod · 0.95
debugFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected