REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 5.38 KB
Close
/opt/alt/alt-nodejs16/root/lib/node_modules/npm/node_modules/socks/build/common/helpers.js
Text
Base64
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.validateSocksClientChainOptions = exports.validateSocksClientOptions = void 0; const util_1 = require("./util"); const constants_1 = require("./constants"); const stream = require("stream"); /** * Validates the provided SocksClientOptions * @param options { SocksClientOptions } * @param acceptedCommands { string[] } A list of accepted SocksProxy commands. */ function validateSocksClientOptions(options, acceptedCommands = ['connect', 'bind', 'associate']) { // Check SOCKs command option. if (!constants_1.SocksCommand[options.command]) { throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksCommand, options); } // Check SocksCommand for acceptable command. if (acceptedCommands.indexOf(options.command) === -1) { throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksCommandForOperation, options); } // Check destination if (!isValidSocksRemoteHost(options.destination)) { throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsDestination, options); } // Check SOCKS proxy to use if (!isValidSocksProxy(options.proxy)) { throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsProxy, options); } // Validate custom auth (if set) validateCustomProxyAuth(options.proxy, options); // Check timeout if (options.timeout && !isValidTimeoutValue(options.timeout)) { throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsTimeout, options); } // Check existing_socket (if provided) if (options.existing_socket && !(options.existing_socket instanceof stream.Duplex)) { throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsExistingSocket, options); } } exports.validateSocksClientOptions = validateSocksClientOptions; /** * Validates the SocksClientChainOptions * @param options { SocksClientChainOptions } */ function validateSocksClientChainOptions(options) { // Only connect is supported when chaining. if (options.command !== 'connect') { throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksCommandChain, options); } // Check destination if (!isValidSocksRemoteHost(options.destination)) { throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsDestination, options); } // Validate proxies (length) if (!(options.proxies && Array.isArray(options.proxies) && options.proxies.length >= 2)) { throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsProxiesLength, options); } // Validate proxies options.proxies.forEach((proxy) => { if (!isValidSocksProxy(proxy)) { throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsProxy, options); } // Validate custom auth (if set) validateCustomProxyAuth(proxy, options); }); // Check timeout if (options.timeout && !isValidTimeoutValue(options.timeout)) { throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsTimeout, options); } } exports.validateSocksClientChainOptions = validateSocksClientChainOptions; function validateCustomProxyAuth(proxy, options) { if (proxy.custom_auth_method !== undefined) { // Invalid auth method range if (proxy.custom_auth_method < constants_1.SOCKS5_CUSTOM_AUTH_START || proxy.custom_auth_method > constants_1.SOCKS5_CUSTOM_AUTH_END) { throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthRange, options); } // Missing custom_auth_request_handler if (proxy.custom_auth_request_handler === undefined || typeof proxy.custom_auth_request_handler !== 'function') { throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthOptions, options); } // Missing custom_auth_response_size if (proxy.custom_auth_response_size === undefined) { throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthOptions, options); } // Missing/invalid custom_auth_response_handler if (proxy.custom_auth_response_handler === undefined || typeof proxy.custom_auth_response_handler !== 'function') { throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthOptions, options); } } } /** * Validates a SocksRemoteHost * @param remoteHost { SocksRemoteHost } */ function isValidSocksRemoteHost(remoteHost) { return (remoteHost && typeof remoteHost.host === 'string' && typeof remoteHost.port === 'number' && remoteHost.port >= 0 && remoteHost.port <= 65535); } /** * Validates a SocksProxy * @param proxy { SocksProxy } */ function isValidSocksProxy(proxy) { return (proxy && (typeof proxy.host === 'string' || typeof proxy.ipaddress === 'string') && typeof proxy.port === 'number' && proxy.port >= 0 && proxy.port <= 65535 && (proxy.type === 4 || proxy.type === 5)); } /** * Validates a timeout value. * @param value { Number } */ function isValidTimeoutValue(value) { return typeof value === 'number' && value > 0; } //# sourceMappingURL=helpers.js.map
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 8
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
constants.js
7.27 KB
lrw-r--r--
2026-03-09 06:51:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
constants.js.map
2.35 KB
lrw-r--r--
2026-03-09 06:51:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
helpers.js
5.38 KB
lrw-r--r--
2026-03-09 06:51:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
helpers.js.map
3.50 KB
lrw-r--r--
2026-03-09 06:51:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
receivebuffer.js
1.51 KB
lrw-r--r--
2026-03-09 06:51:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
receivebuffer.js.map
1.57 KB
lrw-r--r--
2026-03-09 06:51:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
util.js
698 B
lrw-r--r--
2026-03-09 06:51:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
util.js.map
650 B
lrw-r--r--
2026-03-09 06:51:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).