1"use strict"; 2Object.defineProperty(exports, "__esModule", { value: true }); 3const DEFAULT_TIMEOUT = 30000; 4exports.DEFAULT_TIMEOUT = DEFAULT_TIMEOUT; 5// prettier-ignore 6const ERRORS = { 7 InvalidSocksCommand: 'An invalid SOCKS command was provided. Valid options are connect, bind, and associate.', 8 InvalidSocksCommandForOperation: 'An invalid SOCKS command was provided. Only a subset of commands are supported for this operation.', 9 InvalidSocksCommandChain: 'An invalid SOCKS command was provided. Chaining currently only supports the connect command.', 10 InvalidSocksClientOptionsDestination: 'An invalid destination host was provided.', 11 InvalidSocksClientOptionsExistingSocket: 'An invalid existing socket was provided. This should be an instance of stream.Duplex.', 12 InvalidSocksClientOptionsProxy: 'Invalid SOCKS proxy details were provided.', 13 InvalidSocksClientOptionsTimeout: 'An invalid timeout value was provided. Please enter a value above 0 (in ms).', 14 InvalidSocksClientOptionsProxiesLength: 'At least two socks proxies must be provided for chaining.', 15 NegotiationError: 'Negotiation error', 16 SocketClosed: 'Socket closed', 17 ProxyConnectionTimedOut: 'Proxy connection timed out', 18 InternalError: 'SocksClient internal error (this should not happen)', 19 InvalidSocks4HandshakeResponse: 'Received invalid Socks4 handshake response', 20 Socks4ProxyRejectedConnection: 'Socks4 Proxy rejected connection', 21 InvalidSocks4IncomingConnectionResponse: 'Socks4 invalid incoming connection response', 22 Socks4ProxyRejectedIncomingBoundConnection: 'Socks4 Proxy rejected incoming bound connection', 23 InvalidSocks5InitialHandshakeResponse: 'Received invalid Socks5 initial handshake response', 24 InvalidSocks5IntiailHandshakeSocksVersion: 'Received invalid Socks5 initial handshake (invalid socks version)', 25 InvalidSocks5InitialHandshakeNoAcceptedAuthType: 'Received invalid Socks5 initial handshake (no accepted authentication type)', 26 InvalidSocks5InitialHandshakeUnknownAuthType: 'Received invalid Socks5 initial handshake (unknown authentication type)', 27 Socks5AuthenticationFailed: 'Socks5 Authentication failed', 28 InvalidSocks5FinalHandshake: 'Received invalid Socks5 final handshake response', 29 InvalidSocks5FinalHandshakeRejected: 'Socks5 proxy rejected connection', 30 InvalidSocks5IncomingConnectionResponse: 'Received invalid Socks5 incoming connection response', 31 Socks5ProxyRejectedIncomingBoundConnection: 'Socks5 Proxy rejected incoming bound connection', 32}; 33exports.ERRORS = ERRORS; 34const SOCKS_INCOMING_PACKET_SIZES = { 35 Socks5InitialHandshakeResponse: 2, 36 Socks5UserPassAuthenticationResponse: 2, 37 // Command response + incoming connection (bind) 38 Socks5ResponseHeader: 5, 39 Socks5ResponseIPv4: 10, 40 Socks5ResponseIPv6: 22, 41 Socks5ResponseHostname: (hostNameLength) => hostNameLength + 7, 42 // Command response + incoming connection (bind) 43 Socks4Response: 8 // 2 header + 2 port + 4 ip 44}; 45exports.SOCKS_INCOMING_PACKET_SIZES = SOCKS_INCOMING_PACKET_SIZES; 46var SocksCommand; 47(function (SocksCommand) { 48 SocksCommand[SocksCommand["connect"] = 1] = "connect"; 49 SocksCommand[SocksCommand["bind"] = 2] = "bind"; 50 SocksCommand[SocksCommand["associate"] = 3] = "associate"; 51})(SocksCommand || (SocksCommand = {})); 52exports.SocksCommand = SocksCommand; 53var Socks4Response; 54(function (Socks4Response) { 55 Socks4Response[Socks4Response["Granted"] = 90] = "Granted"; 56 Socks4Response[Socks4Response["Failed"] = 91] = "Failed"; 57 Socks4Response[Socks4Response["Rejected"] = 92] = "Rejected"; 58 Socks4Response[Socks4Response["RejectedIdent"] = 93] = "RejectedIdent"; 59})(Socks4Response || (Socks4Response = {})); 60exports.Socks4Response = Socks4Response; 61var Socks5Auth; 62(function (Socks5Auth) { 63 Socks5Auth[Socks5Auth["NoAuth"] = 0] = "NoAuth"; 64 Socks5Auth[Socks5Auth["GSSApi"] = 1] = "GSSApi"; 65 Socks5Auth[Socks5Auth["UserPass"] = 2] = "UserPass"; 66})(Socks5Auth || (Socks5Auth = {})); 67exports.Socks5Auth = Socks5Auth; 68var Socks5Response; 69(function (Socks5Response) { 70 Socks5Response[Socks5Response["Granted"] = 0] = "Granted"; 71 Socks5Response[Socks5Response["Failure"] = 1] = "Failure"; 72 Socks5Response[Socks5Response["NotAllowed"] = 2] = "NotAllowed"; 73 Socks5Response[Socks5Response["NetworkUnreachable"] = 3] = "NetworkUnreachable"; 74 Socks5Response[Socks5Response["HostUnreachable"] = 4] = "HostUnreachable"; 75 Socks5Response[Socks5Response["ConnectionRefused"] = 5] = "ConnectionRefused"; 76 Socks5Response[Socks5Response["TTLExpired"] = 6] = "TTLExpired"; 77 Socks5Response[Socks5Response["CommandNotSupported"] = 7] = "CommandNotSupported"; 78 Socks5Response[Socks5Response["AddressNotSupported"] = 8] = "AddressNotSupported"; 79})(Socks5Response || (Socks5Response = {})); 80exports.Socks5Response = Socks5Response; 81var Socks5HostType; 82(function (Socks5HostType) { 83 Socks5HostType[Socks5HostType["IPv4"] = 1] = "IPv4"; 84 Socks5HostType[Socks5HostType["Hostname"] = 3] = "Hostname"; 85 Socks5HostType[Socks5HostType["IPv6"] = 4] = "IPv6"; 86})(Socks5HostType || (Socks5HostType = {})); 87exports.Socks5HostType = Socks5HostType; 88var SocksClientState; 89(function (SocksClientState) { 90 SocksClientState[SocksClientState["Created"] = 0] = "Created"; 91 SocksClientState[SocksClientState["Connecting"] = 1] = "Connecting"; 92 SocksClientState[SocksClientState["Connected"] = 2] = "Connected"; 93 SocksClientState[SocksClientState["SentInitialHandshake"] = 3] = "SentInitialHandshake"; 94 SocksClientState[SocksClientState["ReceivedInitialHandshakeResponse"] = 4] = "ReceivedInitialHandshakeResponse"; 95 SocksClientState[SocksClientState["SentAuthentication"] = 5] = "SentAuthentication"; 96 SocksClientState[SocksClientState["ReceivedAuthenticationResponse"] = 6] = "ReceivedAuthenticationResponse"; 97 SocksClientState[SocksClientState["SentFinalHandshake"] = 7] = "SentFinalHandshake"; 98 SocksClientState[SocksClientState["ReceivedFinalResponse"] = 8] = "ReceivedFinalResponse"; 99 SocksClientState[SocksClientState["BoundWaitingForConnection"] = 9] = "BoundWaitingForConnection"; 100 SocksClientState[SocksClientState["Established"] = 10] = "Established"; 101 SocksClientState[SocksClientState["Disconnected"] = 11] = "Disconnected"; 102 SocksClientState[SocksClientState["Error"] = 99] = "Error"; 103})(SocksClientState || (SocksClientState = {})); 104exports.SocksClientState = SocksClientState; 105//# sourceMappingURL=constants.js.map