MCPcopy Create free account
hub / github.com/nock/nock / constructor

Method constructor

lib/socket.js:7–36  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

5
6module.exports = class Socket extends EventEmitter {
7 constructor(options) {
8 super()
9
10 // Pretend this is a TLSSocket
11 if (options.proto === 'https') {
12 // https://github.com/nock/nock/issues/158
13 this.authorized = true
14 // https://github.com/nock/nock/issues/2147
15 this.encrypted = true
16 }
17
18 this.bufferSize = 0
19 this.writableLength = 0
20 this.writable = true
21 this.readable = true
22 this.pending = false
23 this.destroyed = false
24 this.connecting = true
25
26 // Undocumented flag used by ClientRequest to ensure errors aren't double-fired
27 this._hadError = false
28
29 // Maximum allowed delay. 0 means unlimited.
30 this.timeout = 0
31
32 const ipv6 = options.family === 6
33 this.remoteFamily = ipv6 ? 'IPv6' : 'IPv4'
34 this.localAddress = this.remoteAddress = ipv6 ? '::1' : '127.0.0.1'
35 this.localPort = this.remotePort = parseInt(options.port)
36 }
37
38 setNoDelay() {}
39 setKeepAlive() {}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected