A big commit with a bunch of node modules so I could run puppeteer for Walmart. Added some todos and Headway's templates.
This commit is contained in:
28
Scripts/node_modules/socks/build/client/socksclient.js
generated
vendored
28
Scripts/node_modules/socks/build/client/socksclient.js
generated
vendored
@ -12,13 +12,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SocksClientError = exports.SocksClient = void 0;
|
||||
const events_1 = require("events");
|
||||
const net = require("net");
|
||||
const ip = require("ip");
|
||||
const smart_buffer_1 = require("smart-buffer");
|
||||
const constants_1 = require("../common/constants");
|
||||
const helpers_1 = require("../common/helpers");
|
||||
const receivebuffer_1 = require("../common/receivebuffer");
|
||||
const util_1 = require("../common/util");
|
||||
Object.defineProperty(exports, "SocksClientError", { enumerable: true, get: function () { return util_1.SocksClientError; } });
|
||||
const ip_address_1 = require("ip-address");
|
||||
class SocksClient extends events_1.EventEmitter {
|
||||
constructor(options) {
|
||||
super();
|
||||
@ -161,11 +161,11 @@ class SocksClient extends events_1.EventEmitter {
|
||||
// IPv4/IPv6/Hostname
|
||||
if (net.isIPv4(options.remoteHost.host)) {
|
||||
buff.writeUInt8(constants_1.Socks5HostType.IPv4);
|
||||
buff.writeUInt32BE(ip.toLong(options.remoteHost.host));
|
||||
buff.writeUInt32BE((0, helpers_1.ipv4ToInt32)(options.remoteHost.host));
|
||||
}
|
||||
else if (net.isIPv6(options.remoteHost.host)) {
|
||||
buff.writeUInt8(constants_1.Socks5HostType.IPv6);
|
||||
buff.writeBuffer(ip.toBuffer(options.remoteHost.host));
|
||||
buff.writeBuffer((0, helpers_1.ipToBuffer)(options.remoteHost.host));
|
||||
}
|
||||
else {
|
||||
buff.writeUInt8(constants_1.Socks5HostType.Hostname);
|
||||
@ -189,10 +189,10 @@ class SocksClient extends events_1.EventEmitter {
|
||||
const hostType = buff.readUInt8();
|
||||
let remoteHost;
|
||||
if (hostType === constants_1.Socks5HostType.IPv4) {
|
||||
remoteHost = ip.fromLong(buff.readUInt32BE());
|
||||
remoteHost = (0, helpers_1.int32ToIpv4)(buff.readUInt32BE());
|
||||
}
|
||||
else if (hostType === constants_1.Socks5HostType.IPv6) {
|
||||
remoteHost = ip.toString(buff.readBuffer(16));
|
||||
remoteHost = ip_address_1.Address6.fromByteArray(Array.from(buff.readBuffer(16))).canonicalForm();
|
||||
}
|
||||
else {
|
||||
remoteHost = buff.readString(buff.readUInt8());
|
||||
@ -401,7 +401,7 @@ class SocksClient extends events_1.EventEmitter {
|
||||
buff.writeUInt16BE(this.options.destination.port);
|
||||
// Socks 4 (IPv4)
|
||||
if (net.isIPv4(this.options.destination.host)) {
|
||||
buff.writeBuffer(ip.toBuffer(this.options.destination.host));
|
||||
buff.writeBuffer((0, helpers_1.ipToBuffer)(this.options.destination.host));
|
||||
buff.writeStringNT(userId);
|
||||
// Socks 4a (hostname)
|
||||
}
|
||||
@ -433,7 +433,7 @@ class SocksClient extends events_1.EventEmitter {
|
||||
buff.readOffset = 2;
|
||||
const remoteHost = {
|
||||
port: buff.readUInt16BE(),
|
||||
host: ip.fromLong(buff.readUInt32BE()),
|
||||
host: (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()),
|
||||
};
|
||||
// If host is 0.0.0.0, set to proxy host.
|
||||
if (remoteHost.host === '0.0.0.0') {
|
||||
@ -464,7 +464,7 @@ class SocksClient extends events_1.EventEmitter {
|
||||
buff.readOffset = 2;
|
||||
const remoteHost = {
|
||||
port: buff.readUInt16BE(),
|
||||
host: ip.fromLong(buff.readUInt32BE()),
|
||||
host: (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()),
|
||||
};
|
||||
this.setState(constants_1.SocksClientState.Established);
|
||||
this.removeInternalSocketHandlers();
|
||||
@ -610,11 +610,11 @@ class SocksClient extends events_1.EventEmitter {
|
||||
// ipv4, ipv6, domain?
|
||||
if (net.isIPv4(this.options.destination.host)) {
|
||||
buff.writeUInt8(constants_1.Socks5HostType.IPv4);
|
||||
buff.writeBuffer(ip.toBuffer(this.options.destination.host));
|
||||
buff.writeBuffer((0, helpers_1.ipToBuffer)(this.options.destination.host));
|
||||
}
|
||||
else if (net.isIPv6(this.options.destination.host)) {
|
||||
buff.writeUInt8(constants_1.Socks5HostType.IPv6);
|
||||
buff.writeBuffer(ip.toBuffer(this.options.destination.host));
|
||||
buff.writeBuffer((0, helpers_1.ipToBuffer)(this.options.destination.host));
|
||||
}
|
||||
else {
|
||||
buff.writeUInt8(constants_1.Socks5HostType.Hostname);
|
||||
@ -652,7 +652,7 @@ class SocksClient extends events_1.EventEmitter {
|
||||
}
|
||||
buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4));
|
||||
remoteHost = {
|
||||
host: ip.fromLong(buff.readUInt32BE()),
|
||||
host: (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()),
|
||||
port: buff.readUInt16BE(),
|
||||
};
|
||||
// If given host is 0.0.0.0, assume remote proxy ip instead.
|
||||
@ -685,7 +685,7 @@ class SocksClient extends events_1.EventEmitter {
|
||||
}
|
||||
buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4));
|
||||
remoteHost = {
|
||||
host: ip.toString(buff.readBuffer(16)),
|
||||
host: ip_address_1.Address6.fromByteArray(Array.from(buff.readBuffer(16))).canonicalForm(),
|
||||
port: buff.readUInt16BE(),
|
||||
};
|
||||
}
|
||||
@ -743,7 +743,7 @@ class SocksClient extends events_1.EventEmitter {
|
||||
}
|
||||
buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4));
|
||||
remoteHost = {
|
||||
host: ip.fromLong(buff.readUInt32BE()),
|
||||
host: (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()),
|
||||
port: buff.readUInt16BE(),
|
||||
};
|
||||
// If given host is 0.0.0.0, assume remote proxy ip instead.
|
||||
@ -776,7 +776,7 @@ class SocksClient extends events_1.EventEmitter {
|
||||
}
|
||||
buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4));
|
||||
remoteHost = {
|
||||
host: ip.toString(buff.readBuffer(16)),
|
||||
host: ip_address_1.Address6.fromByteArray(Array.from(buff.readBuffer(16))).canonicalForm(),
|
||||
port: buff.readUInt16BE(),
|
||||
};
|
||||
}
|
||||
|
||||
2
Scripts/node_modules/socks/build/client/socksclient.js.map
generated
vendored
2
Scripts/node_modules/socks/build/client/socksclient.js.map
generated
vendored
File diff suppressed because one or more lines are too long
26
Scripts/node_modules/socks/build/common/constants.js
generated
vendored
26
Scripts/node_modules/socks/build/common/constants.js
generated
vendored
@ -38,10 +38,10 @@ const SOCKS_INCOMING_PACKET_SIZES = {
|
||||
Socks5InitialHandshakeResponse: 2,
|
||||
Socks5UserPassAuthenticationResponse: 2,
|
||||
// Command response + incoming connection (bind)
|
||||
Socks5ResponseHeader: 5,
|
||||
Socks5ResponseIPv4: 10,
|
||||
Socks5ResponseIPv6: 22,
|
||||
Socks5ResponseHostname: (hostNameLength) => hostNameLength + 7,
|
||||
Socks5ResponseHeader: 5, // We need at least 5 to read the hostname length, then we wait for the address+port information.
|
||||
Socks5ResponseIPv4: 10, // 4 header + 4 ip + 2 port
|
||||
Socks5ResponseIPv6: 22, // 4 header + 16 ip + 2 port
|
||||
Socks5ResponseHostname: (hostNameLength) => hostNameLength + 7, // 4 header + 1 host length + host + 2 port
|
||||
// Command response + incoming connection (bind)
|
||||
Socks4Response: 8, // 2 header + 2 port + 4 ip
|
||||
};
|
||||
@ -51,23 +51,20 @@ var SocksCommand;
|
||||
SocksCommand[SocksCommand["connect"] = 1] = "connect";
|
||||
SocksCommand[SocksCommand["bind"] = 2] = "bind";
|
||||
SocksCommand[SocksCommand["associate"] = 3] = "associate";
|
||||
})(SocksCommand || (SocksCommand = {}));
|
||||
exports.SocksCommand = SocksCommand;
|
||||
})(SocksCommand || (exports.SocksCommand = SocksCommand = {}));
|
||||
var Socks4Response;
|
||||
(function (Socks4Response) {
|
||||
Socks4Response[Socks4Response["Granted"] = 90] = "Granted";
|
||||
Socks4Response[Socks4Response["Failed"] = 91] = "Failed";
|
||||
Socks4Response[Socks4Response["Rejected"] = 92] = "Rejected";
|
||||
Socks4Response[Socks4Response["RejectedIdent"] = 93] = "RejectedIdent";
|
||||
})(Socks4Response || (Socks4Response = {}));
|
||||
exports.Socks4Response = Socks4Response;
|
||||
})(Socks4Response || (exports.Socks4Response = Socks4Response = {}));
|
||||
var Socks5Auth;
|
||||
(function (Socks5Auth) {
|
||||
Socks5Auth[Socks5Auth["NoAuth"] = 0] = "NoAuth";
|
||||
Socks5Auth[Socks5Auth["GSSApi"] = 1] = "GSSApi";
|
||||
Socks5Auth[Socks5Auth["UserPass"] = 2] = "UserPass";
|
||||
})(Socks5Auth || (Socks5Auth = {}));
|
||||
exports.Socks5Auth = Socks5Auth;
|
||||
})(Socks5Auth || (exports.Socks5Auth = Socks5Auth = {}));
|
||||
const SOCKS5_CUSTOM_AUTH_START = 0x80;
|
||||
exports.SOCKS5_CUSTOM_AUTH_START = SOCKS5_CUSTOM_AUTH_START;
|
||||
const SOCKS5_CUSTOM_AUTH_END = 0xfe;
|
||||
@ -85,15 +82,13 @@ var Socks5Response;
|
||||
Socks5Response[Socks5Response["TTLExpired"] = 6] = "TTLExpired";
|
||||
Socks5Response[Socks5Response["CommandNotSupported"] = 7] = "CommandNotSupported";
|
||||
Socks5Response[Socks5Response["AddressNotSupported"] = 8] = "AddressNotSupported";
|
||||
})(Socks5Response || (Socks5Response = {}));
|
||||
exports.Socks5Response = Socks5Response;
|
||||
})(Socks5Response || (exports.Socks5Response = Socks5Response = {}));
|
||||
var Socks5HostType;
|
||||
(function (Socks5HostType) {
|
||||
Socks5HostType[Socks5HostType["IPv4"] = 1] = "IPv4";
|
||||
Socks5HostType[Socks5HostType["Hostname"] = 3] = "Hostname";
|
||||
Socks5HostType[Socks5HostType["IPv6"] = 4] = "IPv6";
|
||||
})(Socks5HostType || (Socks5HostType = {}));
|
||||
exports.Socks5HostType = Socks5HostType;
|
||||
})(Socks5HostType || (exports.Socks5HostType = Socks5HostType = {}));
|
||||
var SocksClientState;
|
||||
(function (SocksClientState) {
|
||||
SocksClientState[SocksClientState["Created"] = 0] = "Created";
|
||||
@ -109,6 +104,5 @@ var SocksClientState;
|
||||
SocksClientState[SocksClientState["Established"] = 10] = "Established";
|
||||
SocksClientState[SocksClientState["Disconnected"] = 11] = "Disconnected";
|
||||
SocksClientState[SocksClientState["Error"] = 99] = "Error";
|
||||
})(SocksClientState || (SocksClientState = {}));
|
||||
exports.SocksClientState = SocksClientState;
|
||||
})(SocksClientState || (exports.SocksClientState = SocksClientState = {}));
|
||||
//# sourceMappingURL=constants.js.map
|
||||
2
Scripts/node_modules/socks/build/common/constants.js.map
generated
vendored
2
Scripts/node_modules/socks/build/common/constants.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":";;;AAIA,MAAM,eAAe,GAAG,KAAK,CAAC;AA4M5B,0CAAe;AAxMjB,kBAAkB;AAClB,MAAM,MAAM,GAAG;IACb,mBAAmB,EAAE,wFAAwF;IAC7G,+BAA+B,EAAE,oGAAoG;IACrI,wBAAwB,EAAE,8FAA8F;IACxH,oCAAoC,EAAE,2CAA2C;IACjF,uCAAuC,EAAE,uFAAuF;IAChI,8BAA8B,EAAE,4CAA4C;IAC5E,gCAAgC,EAAE,8EAA8E;IAChH,sCAAsC,EAAE,2DAA2D;IACnG,wCAAwC,EAAE,oDAAoD;IAC9F,0CAA0C,EAAE,kKAAkK;IAC9M,gBAAgB,EAAE,mBAAmB;IACrC,YAAY,EAAE,eAAe;IAC7B,uBAAuB,EAAE,4BAA4B;IACrD,aAAa,EAAE,qDAAqD;IACpE,8BAA8B,EAAE,4CAA4C;IAC5E,6BAA6B,EAAE,kCAAkC;IACjE,uCAAuC,EAAE,6CAA6C;IACtF,0CAA0C,EAAE,iDAAiD;IAC7F,qCAAqC,EAAE,oDAAoD;IAC3F,yCAAyC,EAAE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D,WAAK,UAAU;IACb,+CAAa,CAAA;IACb,+CAAa,CAAA;IACb,mDAAe,CAAA;AACjB,CAAC,EAJI,UAAU,0BAAV,UAAU,QAId;AAED,MAAM,wBAAwB,GAAG,IAAI,CAAC;AAuJpC,4DAAwB;AAtJ1B,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAuJlC,wDAAsB;AArJxB,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAsJrC,8DAAyB;AApJ3B,IAAK,cAUJ;AAVD,WAAK,cAAc;IACjB,yDAAc,CAAA;IACd,yDAAc,CAAA;IACd,+DAAiB,CAAA;IACjB,+EAAyB,CAAA;IACzB,yEAAsB,CAAA;IACtB,6EAAwB,CAAA;IACxB,+DAAiB,CAAA;IACjB,iFAA0B,CAAA;IAC1B,iFAA0B,CAAA;AAC5B,CAAC,EAVI,cAAc,8BAAd,cAAc,QAUlB;AAED,IAAK,cAIJ;AAJD,WAAK,cAAc;IACjB,mDAAW,CAAA;IACX,2DAAe,CAAA;IACf,mDAAW,CAAA;AACb,CAAC,EAJI,cAAc,8BAAd,cAAc,QAIlB;AAED,IAAK,gBAcJ;AAdD,WAAK,gBAAgB;IACnB,6DAAW,CAAA;IACX,mEAAc,CAAA;IACd,iEAAa,CAAA;IACb,uFAAwB,CAAA;IACxB,+GAAoC,CAAA;IACpC,mFAAsB,CAAA;IACtB,2GAAkC,CAAA;IAClC,mFAAsB,CAAA;IACtB,yFAAyB,CAAA;IACzB,iGAA6B,CAAA;IAC7B,sEAAgB,CAAA;IAChB,wEAAiB,CAAA;IACjB,0DAAU,CAAA;AACZ,CAAC,EAdI,gBAAgB,gCAAhB,gBAAgB,QAcpB"}
|
||||
36
Scripts/node_modules/socks/build/common/helpers.js
generated
vendored
36
Scripts/node_modules/socks/build/common/helpers.js
generated
vendored
@ -1,9 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.validateSocksClientChainOptions = exports.validateSocksClientOptions = void 0;
|
||||
exports.ipToBuffer = exports.int32ToIpv4 = exports.ipv4ToInt32 = exports.validateSocksClientChainOptions = exports.validateSocksClientOptions = void 0;
|
||||
const util_1 = require("./util");
|
||||
const constants_1 = require("./constants");
|
||||
const stream = require("stream");
|
||||
const ip_address_1 = require("ip-address");
|
||||
const net = require("net");
|
||||
/**
|
||||
* Validates the provided SocksClientOptions
|
||||
* @param options { SocksClientOptions }
|
||||
@ -125,4 +127,36 @@ function isValidSocksProxy(proxy) {
|
||||
function isValidTimeoutValue(value) {
|
||||
return typeof value === 'number' && value > 0;
|
||||
}
|
||||
function ipv4ToInt32(ip) {
|
||||
const address = new ip_address_1.Address4(ip);
|
||||
// Convert the IPv4 address parts to an integer
|
||||
return address.toArray().reduce((acc, part) => (acc << 8) + part, 0);
|
||||
}
|
||||
exports.ipv4ToInt32 = ipv4ToInt32;
|
||||
function int32ToIpv4(int32) {
|
||||
// Extract each byte (octet) from the 32-bit integer
|
||||
const octet1 = (int32 >>> 24) & 0xff;
|
||||
const octet2 = (int32 >>> 16) & 0xff;
|
||||
const octet3 = (int32 >>> 8) & 0xff;
|
||||
const octet4 = int32 & 0xff;
|
||||
// Combine the octets into a string in IPv4 format
|
||||
return [octet1, octet2, octet3, octet4].join('.');
|
||||
}
|
||||
exports.int32ToIpv4 = int32ToIpv4;
|
||||
function ipToBuffer(ip) {
|
||||
if (net.isIPv4(ip)) {
|
||||
// Handle IPv4 addresses
|
||||
const address = new ip_address_1.Address4(ip);
|
||||
return Buffer.from(address.toArray());
|
||||
}
|
||||
else if (net.isIPv6(ip)) {
|
||||
// Handle IPv6 addresses
|
||||
const address = new ip_address_1.Address6(ip);
|
||||
return Buffer.from(address.toByteArray());
|
||||
}
|
||||
else {
|
||||
throw new Error('Invalid IP address format');
|
||||
}
|
||||
}
|
||||
exports.ipToBuffer = ipToBuffer;
|
||||
//# sourceMappingURL=helpers.js.map
|
||||
2
Scripts/node_modules/socks/build/common/helpers.js.map
generated
vendored
2
Scripts/node_modules/socks/build/common/helpers.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/common/helpers.ts"],"names":[],"mappings":";;;AAKA,iCAAwC;AACxC,2CAMqB;AACrB,iCAAiC;AAEjC;;;;GAIG;AACH,SAAS,0BAA0B,CACjC,OAA2B,EAC3B,gBAAgB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC;IAEnD,8BAA8B;IAC9B,IAAI,CAAC,wBAAY,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAClC,MAAM,IAAI,uBAAgB,CAAC,kBAAM,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;KACjE;IAED,6CAA6C;IAC7C,IAAI,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE;QACpD,MAAM,IAAI,uBAAgB,CAAC,kBAAM,CAAC,+BAA+B,EAAE,OAAO,CAAC,CAAC;KAC7E;IAED,oBAAoB;IACpB,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QAChD,MAAM,IAAI,uBAAgB,CACxB,kBAAM,CAAC,oCAAoC,EAC3C,OAAO,CACR,CAAC;KACH;IAED,2BAA2B;IAC3B,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACrC,MAAM,IAAI,uBAAgB,CAAC,kBAAM,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;KAC5E;IAED,gCAAgC;IAChC,uBAAuB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAEhD,gBAAgB;IAChB,IAAI,OAAO,CAAC,OAAO,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC5D,MAAM,IAAI,uBAAgB,CACxB,kBAAM,CAAC,gCAAgC,EACvC,OAAO,CACR,CAAC;KACH;IAED,sCAAsC;IACtC,IACE,OAAO,CAAC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ts/node_modules/socks/build/common/receivebuffer.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"receivebuffer.js","sourceRoot":"","sources":["../../src/common/receivebuffer.ts"],"names":[],"mappings":";;;AAAA,MAAM,aAAa;IAKjB,YAAY,IAAI,GAAG,IAAI;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC3B,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAC1B,MAAM,IAAI,KAAK,CACb,6DAA6D,CAC9D,CAAC;SACH;QAED,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YACnD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;YACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,WAAW,CAC9B,IAAI,CAAC,GAAG,CACN,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,EACtC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CACjC,CACF,CAAC;YACF,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACvB;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,CAAC,MAAc;QACjB,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE;YACxB,MAAM,IAAI,KA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AAC;IACf,CAAC;CACF;AAEO,sCAAa"}
|
||||
2
Scripts/node_modules/socks/build/common/util.js.map
generated
vendored
2
Scripts/node_modules/socks/build/common/util.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/common/util.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,MAAM,gBAAiB,SAAQ,KAAK;IAClC,YACE,OAAe,EACR,OAAqD;QAE5D,KAAK,CAAC,OAAO,CAAC,CAAC;QAFR,YAAO,GAAP,OAAO,CAA8C;IAG9D,CAAC;CACF;AAuBuB,4CAAgB;AArBxC;;;GAGG;AACH,SAAS,YAAY,CAAC,KAAgB;IACpC,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QACzC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;KAC7C;AACH,CAAC;AAYyC,oCAAY"}
|
||||
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/common/util.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,MAAM,gBAAiB,SAAQ,KAAK;IAClC,YACE,OAAe,EACR,OAAqD;QAE5D,KAAK,CAAC,OAAO,CAAC,CAAC;QAFR,YAAO,GAAP,OAAO,CAA8C;IAG9D,CAAC;CACF;AAaO,4CAAgB;AAXxB;;;GAGG;AACH,SAAS,YAAY,CAAC,KAAgB;IACpC,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC;AAEyB,oCAAY"}
|
||||
90
Scripts/node_modules/socks/node_modules/ip/README.md
generated
vendored
90
Scripts/node_modules/socks/node_modules/ip/README.md
generated
vendored
@ -1,90 +0,0 @@
|
||||
# IP
|
||||
[](https://www.npmjs.com/package/ip)
|
||||
|
||||
IP address utilities for node.js
|
||||
|
||||
## Installation
|
||||
|
||||
### npm
|
||||
```shell
|
||||
npm install ip
|
||||
```
|
||||
|
||||
### git
|
||||
|
||||
```shell
|
||||
git clone https://github.com/indutny/node-ip.git
|
||||
```
|
||||
|
||||
## Usage
|
||||
Get your ip address, compare ip addresses, validate ip addresses, etc.
|
||||
|
||||
```js
|
||||
var ip = require('ip');
|
||||
|
||||
ip.address() // my ip address
|
||||
ip.isEqual('::1', '::0:1'); // true
|
||||
ip.toBuffer('127.0.0.1') // Buffer([127, 0, 0, 1])
|
||||
ip.toString(new Buffer([127, 0, 0, 1])) // 127.0.0.1
|
||||
ip.fromPrefixLen(24) // 255.255.255.0
|
||||
ip.mask('192.168.1.134', '255.255.255.0') // 192.168.1.0
|
||||
ip.cidr('192.168.1.134/26') // 192.168.1.128
|
||||
ip.not('255.255.255.0') // 0.0.0.255
|
||||
ip.or('192.168.1.134', '0.0.0.255') // 192.168.1.255
|
||||
ip.isPrivate('127.0.0.1') // true
|
||||
ip.isV4Format('127.0.0.1'); // true
|
||||
ip.isV6Format('::ffff:127.0.0.1'); // true
|
||||
|
||||
// operate on buffers in-place
|
||||
var buf = new Buffer(128);
|
||||
var offset = 64;
|
||||
ip.toBuffer('127.0.0.1', buf, offset); // [127, 0, 0, 1] at offset 64
|
||||
ip.toString(buf, offset, 4); // '127.0.0.1'
|
||||
|
||||
// subnet information
|
||||
ip.subnet('192.168.1.134', '255.255.255.192')
|
||||
// { networkAddress: '192.168.1.128',
|
||||
// firstAddress: '192.168.1.129',
|
||||
// lastAddress: '192.168.1.190',
|
||||
// broadcastAddress: '192.168.1.191',
|
||||
// subnetMask: '255.255.255.192',
|
||||
// subnetMaskLength: 26,
|
||||
// numHosts: 62,
|
||||
// length: 64,
|
||||
// contains: function(addr){...} }
|
||||
ip.cidrSubnet('192.168.1.134/26')
|
||||
// Same as previous.
|
||||
|
||||
// range checking
|
||||
ip.cidrSubnet('192.168.1.134/26').contains('192.168.1.190') // true
|
||||
|
||||
|
||||
// ipv4 long conversion
|
||||
ip.toLong('127.0.0.1'); // 2130706433
|
||||
ip.fromLong(2130706433); // '127.0.0.1'
|
||||
```
|
||||
|
||||
### License
|
||||
|
||||
This software is licensed under the MIT License.
|
||||
|
||||
Copyright Fedor Indutny, 2012.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
422
Scripts/node_modules/socks/node_modules/ip/lib/ip.js
generated
vendored
422
Scripts/node_modules/socks/node_modules/ip/lib/ip.js
generated
vendored
@ -1,422 +0,0 @@
|
||||
const ip = exports;
|
||||
const { Buffer } = require('buffer');
|
||||
const os = require('os');
|
||||
|
||||
ip.toBuffer = function (ip, buff, offset) {
|
||||
offset = ~~offset;
|
||||
|
||||
let result;
|
||||
|
||||
if (this.isV4Format(ip)) {
|
||||
result = buff || Buffer.alloc(offset + 4);
|
||||
ip.split(/\./g).map((byte) => {
|
||||
result[offset++] = parseInt(byte, 10) & 0xff;
|
||||
});
|
||||
} else if (this.isV6Format(ip)) {
|
||||
const sections = ip.split(':', 8);
|
||||
|
||||
let i;
|
||||
for (i = 0; i < sections.length; i++) {
|
||||
const isv4 = this.isV4Format(sections[i]);
|
||||
let v4Buffer;
|
||||
|
||||
if (isv4) {
|
||||
v4Buffer = this.toBuffer(sections[i]);
|
||||
sections[i] = v4Buffer.slice(0, 2).toString('hex');
|
||||
}
|
||||
|
||||
if (v4Buffer && ++i < 8) {
|
||||
sections.splice(i, 0, v4Buffer.slice(2, 4).toString('hex'));
|
||||
}
|
||||
}
|
||||
|
||||
if (sections[0] === '') {
|
||||
while (sections.length < 8) sections.unshift('0');
|
||||
} else if (sections[sections.length - 1] === '') {
|
||||
while (sections.length < 8) sections.push('0');
|
||||
} else if (sections.length < 8) {
|
||||
for (i = 0; i < sections.length && sections[i] !== ''; i++);
|
||||
const argv = [i, 1];
|
||||
for (i = 9 - sections.length; i > 0; i--) {
|
||||
argv.push('0');
|
||||
}
|
||||
sections.splice(...argv);
|
||||
}
|
||||
|
||||
result = buff || Buffer.alloc(offset + 16);
|
||||
for (i = 0; i < sections.length; i++) {
|
||||
const word = parseInt(sections[i], 16);
|
||||
result[offset++] = (word >> 8) & 0xff;
|
||||
result[offset++] = word & 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
throw Error(`Invalid ip address: ${ip}`);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
ip.toString = function (buff, offset, length) {
|
||||
offset = ~~offset;
|
||||
length = length || (buff.length - offset);
|
||||
|
||||
let result = [];
|
||||
if (length === 4) {
|
||||
// IPv4
|
||||
for (let i = 0; i < length; i++) {
|
||||
result.push(buff[offset + i]);
|
||||
}
|
||||
result = result.join('.');
|
||||
} else if (length === 16) {
|
||||
// IPv6
|
||||
for (let i = 0; i < length; i += 2) {
|
||||
result.push(buff.readUInt16BE(offset + i).toString(16));
|
||||
}
|
||||
result = result.join(':');
|
||||
result = result.replace(/(^|:)0(:0)*:0(:|$)/, '$1::$3');
|
||||
result = result.replace(/:{3,4}/, '::');
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const ipv4Regex = /^(\d{1,3}\.){3,3}\d{1,3}$/;
|
||||
const ipv6Regex = /^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i;
|
||||
|
||||
ip.isV4Format = function (ip) {
|
||||
return ipv4Regex.test(ip);
|
||||
};
|
||||
|
||||
ip.isV6Format = function (ip) {
|
||||
return ipv6Regex.test(ip);
|
||||
};
|
||||
|
||||
function _normalizeFamily(family) {
|
||||
if (family === 4) {
|
||||
return 'ipv4';
|
||||
}
|
||||
if (family === 6) {
|
||||
return 'ipv6';
|
||||
}
|
||||
return family ? family.toLowerCase() : 'ipv4';
|
||||
}
|
||||
|
||||
ip.fromPrefixLen = function (prefixlen, family) {
|
||||
if (prefixlen > 32) {
|
||||
family = 'ipv6';
|
||||
} else {
|
||||
family = _normalizeFamily(family);
|
||||
}
|
||||
|
||||
let len = 4;
|
||||
if (family === 'ipv6') {
|
||||
len = 16;
|
||||
}
|
||||
const buff = Buffer.alloc(len);
|
||||
|
||||
for (let i = 0, n = buff.length; i < n; ++i) {
|
||||
let bits = 8;
|
||||
if (prefixlen < 8) {
|
||||
bits = prefixlen;
|
||||
}
|
||||
prefixlen -= bits;
|
||||
|
||||
buff[i] = ~(0xff >> bits) & 0xff;
|
||||
}
|
||||
|
||||
return ip.toString(buff);
|
||||
};
|
||||
|
||||
ip.mask = function (addr, mask) {
|
||||
addr = ip.toBuffer(addr);
|
||||
mask = ip.toBuffer(mask);
|
||||
|
||||
const result = Buffer.alloc(Math.max(addr.length, mask.length));
|
||||
|
||||
// Same protocol - do bitwise and
|
||||
let i;
|
||||
if (addr.length === mask.length) {
|
||||
for (i = 0; i < addr.length; i++) {
|
||||
result[i] = addr[i] & mask[i];
|
||||
}
|
||||
} else if (mask.length === 4) {
|
||||
// IPv6 address and IPv4 mask
|
||||
// (Mask low bits)
|
||||
for (i = 0; i < mask.length; i++) {
|
||||
result[i] = addr[addr.length - 4 + i] & mask[i];
|
||||
}
|
||||
} else {
|
||||
// IPv6 mask and IPv4 addr
|
||||
for (i = 0; i < result.length - 6; i++) {
|
||||
result[i] = 0;
|
||||
}
|
||||
|
||||
// ::ffff:ipv4
|
||||
result[10] = 0xff;
|
||||
result[11] = 0xff;
|
||||
for (i = 0; i < addr.length; i++) {
|
||||
result[i + 12] = addr[i] & mask[i + 12];
|
||||
}
|
||||
i += 12;
|
||||
}
|
||||
for (; i < result.length; i++) {
|
||||
result[i] = 0;
|
||||
}
|
||||
|
||||
return ip.toString(result);
|
||||
};
|
||||
|
||||
ip.cidr = function (cidrString) {
|
||||
const cidrParts = cidrString.split('/');
|
||||
|
||||
const addr = cidrParts[0];
|
||||
if (cidrParts.length !== 2) {
|
||||
throw new Error(`invalid CIDR subnet: ${addr}`);
|
||||
}
|
||||
|
||||
const mask = ip.fromPrefixLen(parseInt(cidrParts[1], 10));
|
||||
|
||||
return ip.mask(addr, mask);
|
||||
};
|
||||
|
||||
ip.subnet = function (addr, mask) {
|
||||
const networkAddress = ip.toLong(ip.mask(addr, mask));
|
||||
|
||||
// Calculate the mask's length.
|
||||
const maskBuffer = ip.toBuffer(mask);
|
||||
let maskLength = 0;
|
||||
|
||||
for (let i = 0; i < maskBuffer.length; i++) {
|
||||
if (maskBuffer[i] === 0xff) {
|
||||
maskLength += 8;
|
||||
} else {
|
||||
let octet = maskBuffer[i] & 0xff;
|
||||
while (octet) {
|
||||
octet = (octet << 1) & 0xff;
|
||||
maskLength++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const numberOfAddresses = 2 ** (32 - maskLength);
|
||||
|
||||
return {
|
||||
networkAddress: ip.fromLong(networkAddress),
|
||||
firstAddress: numberOfAddresses <= 2
|
||||
? ip.fromLong(networkAddress)
|
||||
: ip.fromLong(networkAddress + 1),
|
||||
lastAddress: numberOfAddresses <= 2
|
||||
? ip.fromLong(networkAddress + numberOfAddresses - 1)
|
||||
: ip.fromLong(networkAddress + numberOfAddresses - 2),
|
||||
broadcastAddress: ip.fromLong(networkAddress + numberOfAddresses - 1),
|
||||
subnetMask: mask,
|
||||
subnetMaskLength: maskLength,
|
||||
numHosts: numberOfAddresses <= 2
|
||||
? numberOfAddresses : numberOfAddresses - 2,
|
||||
length: numberOfAddresses,
|
||||
contains(other) {
|
||||
return networkAddress === ip.toLong(ip.mask(other, mask));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
ip.cidrSubnet = function (cidrString) {
|
||||
const cidrParts = cidrString.split('/');
|
||||
|
||||
const addr = cidrParts[0];
|
||||
if (cidrParts.length !== 2) {
|
||||
throw new Error(`invalid CIDR subnet: ${addr}`);
|
||||
}
|
||||
|
||||
const mask = ip.fromPrefixLen(parseInt(cidrParts[1], 10));
|
||||
|
||||
return ip.subnet(addr, mask);
|
||||
};
|
||||
|
||||
ip.not = function (addr) {
|
||||
const buff = ip.toBuffer(addr);
|
||||
for (let i = 0; i < buff.length; i++) {
|
||||
buff[i] = 0xff ^ buff[i];
|
||||
}
|
||||
return ip.toString(buff);
|
||||
};
|
||||
|
||||
ip.or = function (a, b) {
|
||||
a = ip.toBuffer(a);
|
||||
b = ip.toBuffer(b);
|
||||
|
||||
// same protocol
|
||||
if (a.length === b.length) {
|
||||
for (let i = 0; i < a.length; ++i) {
|
||||
a[i] |= b[i];
|
||||
}
|
||||
return ip.toString(a);
|
||||
|
||||
// mixed protocols
|
||||
}
|
||||
let buff = a;
|
||||
let other = b;
|
||||
if (b.length > a.length) {
|
||||
buff = b;
|
||||
other = a;
|
||||
}
|
||||
|
||||
const offset = buff.length - other.length;
|
||||
for (let i = offset; i < buff.length; ++i) {
|
||||
buff[i] |= other[i - offset];
|
||||
}
|
||||
|
||||
return ip.toString(buff);
|
||||
};
|
||||
|
||||
ip.isEqual = function (a, b) {
|
||||
a = ip.toBuffer(a);
|
||||
b = ip.toBuffer(b);
|
||||
|
||||
// Same protocol
|
||||
if (a.length === b.length) {
|
||||
for (let i = 0; i < a.length; i++) {
|
||||
if (a[i] !== b[i]) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Swap
|
||||
if (b.length === 4) {
|
||||
const t = b;
|
||||
b = a;
|
||||
a = t;
|
||||
}
|
||||
|
||||
// a - IPv4, b - IPv6
|
||||
for (let i = 0; i < 10; i++) {
|
||||
if (b[i] !== 0) return false;
|
||||
}
|
||||
|
||||
const word = b.readUInt16BE(10);
|
||||
if (word !== 0 && word !== 0xffff) return false;
|
||||
|
||||
for (let i = 0; i < 4; i++) {
|
||||
if (a[i] !== b[i + 12]) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
ip.isPrivate = function (addr) {
|
||||
return /^(::f{4}:)?10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i
|
||||
.test(addr)
|
||||
|| /^(::f{4}:)?192\.168\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr)
|
||||
|| /^(::f{4}:)?172\.(1[6-9]|2\d|30|31)\.([0-9]{1,3})\.([0-9]{1,3})$/i
|
||||
.test(addr)
|
||||
|| /^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr)
|
||||
|| /^(::f{4}:)?169\.254\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr)
|
||||
|| /^f[cd][0-9a-f]{2}:/i.test(addr)
|
||||
|| /^fe80:/i.test(addr)
|
||||
|| /^::1$/.test(addr)
|
||||
|| /^::$/.test(addr);
|
||||
};
|
||||
|
||||
ip.isPublic = function (addr) {
|
||||
return !ip.isPrivate(addr);
|
||||
};
|
||||
|
||||
ip.isLoopback = function (addr) {
|
||||
return /^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/
|
||||
.test(addr)
|
||||
|| /^fe80::1$/.test(addr)
|
||||
|| /^::1$/.test(addr)
|
||||
|| /^::$/.test(addr);
|
||||
};
|
||||
|
||||
ip.loopback = function (family) {
|
||||
//
|
||||
// Default to `ipv4`
|
||||
//
|
||||
family = _normalizeFamily(family);
|
||||
|
||||
if (family !== 'ipv4' && family !== 'ipv6') {
|
||||
throw new Error('family must be ipv4 or ipv6');
|
||||
}
|
||||
|
||||
return family === 'ipv4' ? '127.0.0.1' : 'fe80::1';
|
||||
};
|
||||
|
||||
//
|
||||
// ### function address (name, family)
|
||||
// #### @name {string|'public'|'private'} **Optional** Name or security
|
||||
// of the network interface.
|
||||
// #### @family {ipv4|ipv6} **Optional** IP family of the address (defaults
|
||||
// to ipv4).
|
||||
//
|
||||
// Returns the address for the network interface on the current system with
|
||||
// the specified `name`:
|
||||
// * String: First `family` address of the interface.
|
||||
// If not found see `undefined`.
|
||||
// * 'public': the first public ip address of family.
|
||||
// * 'private': the first private ip address of family.
|
||||
// * undefined: First address with `ipv4` or loopback address `127.0.0.1`.
|
||||
//
|
||||
ip.address = function (name, family) {
|
||||
const interfaces = os.networkInterfaces();
|
||||
|
||||
//
|
||||
// Default to `ipv4`
|
||||
//
|
||||
family = _normalizeFamily(family);
|
||||
|
||||
//
|
||||
// If a specific network interface has been named,
|
||||
// return the address.
|
||||
//
|
||||
if (name && name !== 'private' && name !== 'public') {
|
||||
const res = interfaces[name].filter((details) => {
|
||||
const itemFamily = _normalizeFamily(details.family);
|
||||
return itemFamily === family;
|
||||
});
|
||||
if (res.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
return res[0].address;
|
||||
}
|
||||
|
||||
const all = Object.keys(interfaces).map((nic) => {
|
||||
//
|
||||
// Note: name will only be `public` or `private`
|
||||
// when this is called.
|
||||
//
|
||||
const addresses = interfaces[nic].filter((details) => {
|
||||
details.family = _normalizeFamily(details.family);
|
||||
if (details.family !== family || ip.isLoopback(details.address)) {
|
||||
return false;
|
||||
} if (!name) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return name === 'public' ? ip.isPrivate(details.address)
|
||||
: ip.isPublic(details.address);
|
||||
});
|
||||
|
||||
return addresses.length ? addresses[0].address : undefined;
|
||||
}).filter(Boolean);
|
||||
|
||||
return !all.length ? ip.loopback(family) : all[0];
|
||||
};
|
||||
|
||||
ip.toLong = function (ip) {
|
||||
let ipl = 0;
|
||||
ip.split('.').forEach((octet) => {
|
||||
ipl <<= 8;
|
||||
ipl += parseInt(octet);
|
||||
});
|
||||
return (ipl >>> 0);
|
||||
};
|
||||
|
||||
ip.fromLong = function (ipl) {
|
||||
return (`${ipl >>> 24}.${
|
||||
ipl >> 16 & 255}.${
|
||||
ipl >> 8 & 255}.${
|
||||
ipl & 255}`);
|
||||
};
|
||||
25
Scripts/node_modules/socks/node_modules/ip/package.json
generated
vendored
25
Scripts/node_modules/socks/node_modules/ip/package.json
generated
vendored
@ -1,25 +0,0 @@
|
||||
{
|
||||
"name": "ip",
|
||||
"version": "2.0.0",
|
||||
"author": "Fedor Indutny <fedor@indutny.com>",
|
||||
"homepage": "https://github.com/indutny/node-ip",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/indutny/node-ip.git"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"README.md"
|
||||
],
|
||||
"main": "lib/ip",
|
||||
"devDependencies": {
|
||||
"eslint": "^8.15.0",
|
||||
"mocha": "^10.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint lib/*.js test/*.js",
|
||||
"test": "npm run lint && mocha --reporter spec test/*-test.js",
|
||||
"fix": "npm run lint -- --fix"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
22
Scripts/node_modules/socks/package.json
generated
vendored
22
Scripts/node_modules/socks/package.json
generated
vendored
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "socks",
|
||||
"private": false,
|
||||
"version": "2.7.1",
|
||||
"version": "2.8.1",
|
||||
"description": "Fully featured SOCKS proxy client supporting SOCKSv4, SOCKSv4a, and SOCKSv5. Includes Bind and Associate functionality.",
|
||||
"main": "build/index.js",
|
||||
"typings": "typings/index.d.ts",
|
||||
@ -23,7 +23,7 @@
|
||||
"socks5"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10.13.0",
|
||||
"node": ">= 10.0.0",
|
||||
"npm": ">= 3.0.0"
|
||||
},
|
||||
"author": "Josh Glazebrook",
|
||||
@ -33,19 +33,18 @@
|
||||
"license": "MIT",
|
||||
"readmeFilename": "README.md",
|
||||
"devDependencies": {
|
||||
"@types/ip": "1.1.0",
|
||||
"@types/mocha": "^9.1.1",
|
||||
"@types/node": "^18.0.6",
|
||||
"@typescript-eslint/eslint-plugin": "^5.30.6",
|
||||
"@typescript-eslint/parser": "^5.30.6",
|
||||
"@types/mocha": "^10.0.6",
|
||||
"@types/node": "^20.11.17",
|
||||
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
||||
"@typescript-eslint/parser": "^6.21.0",
|
||||
"eslint": "^8.20.0",
|
||||
"mocha": "^10.0.0",
|
||||
"prettier": "^2.7.1",
|
||||
"prettier": "^3.2.5",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.7.4"
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"ip": "^2.0.0",
|
||||
"ip-address": "^9.0.5",
|
||||
"smart-buffer": "^4.2.0"
|
||||
},
|
||||
"scripts": {
|
||||
@ -53,6 +52,7 @@
|
||||
"test": "NODE_ENV=test mocha --recursive --require ts-node/register test/**/*.ts",
|
||||
"prettier": "prettier --write ./src/**/*.ts --config .prettierrc.yaml",
|
||||
"lint": "eslint 'src/**/*.ts'",
|
||||
"build": "rm -rf build typings && prettier --write ./src/**/*.ts --config .prettierrc.yaml && tsc -p ."
|
||||
"build": "rm -rf build typings && prettier --write ./src/**/*.ts --config .prettierrc.yaml && tsc -p .",
|
||||
"build-raw": "rm -rf build typings && tsc -p ."
|
||||
}
|
||||
}
|
||||
|
||||
11
Scripts/node_modules/socks/typings/common/constants.d.ts
generated
vendored
11
Scripts/node_modules/socks/typings/common/constants.d.ts
generated
vendored
@ -3,9 +3,8 @@
|
||||
/// <reference types="node" />
|
||||
import { Duplex } from 'stream';
|
||||
import { Socket, SocketConnectOpts } from 'net';
|
||||
import { RequireOnlyOne } from './util';
|
||||
declare const DEFAULT_TIMEOUT = 30000;
|
||||
declare type SocksProxyType = 4 | 5;
|
||||
type SocksProxyType = 4 | 5;
|
||||
declare const ERRORS: {
|
||||
InvalidSocksCommand: string;
|
||||
InvalidSocksCommandForOperation: string;
|
||||
@ -44,7 +43,7 @@ declare const SOCKS_INCOMING_PACKET_SIZES: {
|
||||
Socks5ResponseHostname: (hostNameLength: number) => number;
|
||||
Socks4Response: number;
|
||||
};
|
||||
declare type SocksCommandOption = 'connect' | 'bind' | 'associate';
|
||||
type SocksCommandOption = 'connect' | 'bind' | 'associate';
|
||||
declare enum SocksCommand {
|
||||
connect = 1,
|
||||
bind = 2,
|
||||
@ -98,7 +97,7 @@ declare enum SocksClientState {
|
||||
/**
|
||||
* Represents a SocksProxy
|
||||
*/
|
||||
declare type SocksProxy = RequireOnlyOne<{
|
||||
interface SocksProxy {
|
||||
ipaddress?: string;
|
||||
host?: string;
|
||||
port: number;
|
||||
@ -109,7 +108,7 @@ declare type SocksProxy = RequireOnlyOne<{
|
||||
custom_auth_request_handler?: () => Promise<Buffer>;
|
||||
custom_auth_response_size?: number;
|
||||
custom_auth_response_handler?: (data: Buffer) => Promise<boolean>;
|
||||
}, 'host' | 'ipaddress'>;
|
||||
}
|
||||
/**
|
||||
* Represents a remote host
|
||||
*/
|
||||
@ -143,7 +142,7 @@ interface SocksClientEstablishedEvent {
|
||||
socket: Socket;
|
||||
remoteHost?: SocksRemoteHost;
|
||||
}
|
||||
declare type SocksClientBoundEvent = SocksClientEstablishedEvent;
|
||||
type SocksClientBoundEvent = SocksClientEstablishedEvent;
|
||||
interface SocksUDPFrameDetails {
|
||||
frameNumber?: number;
|
||||
remoteHost: SocksRemoteHost;
|
||||
|
||||
4
Scripts/node_modules/socks/typings/common/helpers.d.ts
generated
vendored
4
Scripts/node_modules/socks/typings/common/helpers.d.ts
generated
vendored
@ -1,3 +1,4 @@
|
||||
/// <reference types="node" />
|
||||
import { SocksClientOptions, SocksClientChainOptions } from '../client/socksclient';
|
||||
/**
|
||||
* Validates the provided SocksClientOptions
|
||||
@ -11,3 +12,6 @@ declare function validateSocksClientOptions(options: SocksClientOptions, accepte
|
||||
*/
|
||||
declare function validateSocksClientChainOptions(options: SocksClientChainOptions): void;
|
||||
export { validateSocksClientOptions, validateSocksClientChainOptions };
|
||||
export declare function ipv4ToInt32(ip: string): number;
|
||||
export declare function int32ToIpv4(int32: number): string;
|
||||
export declare function ipToBuffer(ip: string): Buffer;
|
||||
|
||||
5
Scripts/node_modules/socks/typings/common/util.d.ts
generated
vendored
5
Scripts/node_modules/socks/typings/common/util.d.ts
generated
vendored
@ -11,7 +11,4 @@ declare class SocksClientError extends Error {
|
||||
* @param array The array to shuffle.
|
||||
*/
|
||||
declare function shuffleArray(array: unknown[]): void;
|
||||
declare type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
||||
[K in Keys]?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
|
||||
}[Keys];
|
||||
export { RequireOnlyOne, SocksClientError, shuffleArray };
|
||||
export { SocksClientError, shuffleArray };
|
||||
|
||||
Reference in New Issue
Block a user