MCPcopy Index your code
hub / github.com/microsoft/playwright / socketFailed

Method socketFailed

packages/utils/socksProxy.ts:240–267  ·  view source on GitHub ↗
(errorCode: string)

Source from the content-addressed store, hash-verified

238 }
239
240 socketFailed(errorCode: string) {
241 const buffer = Buffer.from([
242 0x05,
243 0,
244 0x00, // RSV
245 ...ipToSocksAddress('0.0.0.0'), // ATYP, Address
246 0, 0 // Port
247 ]);
248 switch (errorCode) {
249 case 'ENOENT':
250 case 'ENOTFOUND':
251 case 'ETIMEDOUT':
252 case 'EHOSTUNREACH':
253 buffer[1] = SocksReply.HostUnreachable;
254 break;
255 case 'ENETUNREACH':
256 buffer[1] = SocksReply.NetworkUnreachable;
257 break;
258 case 'ECONNREFUSED':
259 buffer[1] = SocksReply.ConnectionRefused;
260 break;
261 case 'ERULESET':
262 buffer[1] = SocksReply.NotAllowedByRuleSet;
263 break;
264 }
265 this._writeBytes(buffer);
266 this._socket.end();
267 }
268
269 sendData(data: Buffer) {
270 this._socket.write(data);

Callers

nothing calls this directly

Calls 4

_writeBytesMethod · 0.95
ipToSocksAddressFunction · 0.85
endMethod · 0.65
fromMethod · 0.45

Tested by

no test coverage detected