Server IP : 85.214.239.14 / Your IP : 3.145.91.78 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/2/root/proc/3/task/3/root/usr/lib/node_modules/pm2/node_modules/pac-resolver/dist/ |
Upload File : |
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.sandbox = exports.createPacResolver = void 0; const degenerator_1 = require("degenerator"); /** * Built-in PAC functions. */ const dateRange_1 = __importDefault(require("./dateRange")); const dnsDomainIs_1 = __importDefault(require("./dnsDomainIs")); const dnsDomainLevels_1 = __importDefault(require("./dnsDomainLevels")); const dnsResolve_1 = __importDefault(require("./dnsResolve")); const isInNet_1 = __importDefault(require("./isInNet")); const isPlainHostName_1 = __importDefault(require("./isPlainHostName")); const isResolvable_1 = __importDefault(require("./isResolvable")); const localHostOrDomainIs_1 = __importDefault(require("./localHostOrDomainIs")); const myIpAddress_1 = __importDefault(require("./myIpAddress")); const shExpMatch_1 = __importDefault(require("./shExpMatch")); const timeRange_1 = __importDefault(require("./timeRange")); const weekdayRange_1 = __importDefault(require("./weekdayRange")); /** * Returns an asynchronous `FindProxyForURL()` function * from the given JS string (from a PAC file). */ function createPacResolver(qjs, _str, _opts = {}) { const str = Buffer.isBuffer(_str) ? _str.toString('utf8') : _str; // The sandbox to use for the `vm` context. const context = { ...exports.sandbox, ..._opts.sandbox, }; // Construct the array of async function names to add `await` calls to. const names = Object.keys(context).filter((k) => isAsyncFunction(context[k])); const opts = { filename: 'proxy.pac', names, ..._opts, sandbox: context, }; // Compile the JS `FindProxyForURL()` function into an async function. const resolver = (0, degenerator_1.compile)(qjs, str, 'FindProxyForURL', opts); function FindProxyForURL(url, _host) { const urlObj = typeof url === 'string' ? new URL(url) : url; const host = _host || urlObj.hostname; if (!host) { throw new TypeError('Could not determine `host`'); } return resolver(urlObj.href, host); } Object.defineProperty(FindProxyForURL, 'toString', { value: () => resolver.toString(), enumerable: false, }); return FindProxyForURL; } exports.createPacResolver = createPacResolver; exports.sandbox = Object.freeze({ alert: (message = '') => console.log('%s', message), dateRange: dateRange_1.default, dnsDomainIs: dnsDomainIs_1.default, dnsDomainLevels: dnsDomainLevels_1.default, dnsResolve: dnsResolve_1.default, isInNet: isInNet_1.default, isPlainHostName: isPlainHostName_1.default, isResolvable: isResolvable_1.default, localHostOrDomainIs: localHostOrDomainIs_1.default, myIpAddress: myIpAddress_1.default, shExpMatch: shExpMatch_1.default, timeRange: timeRange_1.default, weekdayRange: weekdayRange_1.default, }); // eslint-disable-next-line @typescript-eslint/no-explicit-any function isAsyncFunction(v) { if (typeof v !== 'function') return false; // Native `AsyncFunction` if (v.constructor.name === 'AsyncFunction') return true; // TypeScript compiled if (String(v).indexOf('__awaiter(') !== -1) return true; // Legacy behavior - set `async` property on the function return Boolean(v.async); } //# sourceMappingURL=index.js.map