proxy-chain
Advanced tools
Comparing version 2.5.1 to 2.5.2-beta.0
@@ -27,4 +27,5 @@ "use strict"; | ||
const parsedProxyUrl = new url_1.URL(proxyUrl); | ||
if (parsedProxyUrl.protocol !== 'http:') { | ||
throw new Error('Invalid "proxyUrl" option: only HTTP proxies are currently supported.'); | ||
if (!['http:', ...server_1.SOCKS_PROTOCOLS].includes(parsedProxyUrl.protocol)) { | ||
// eslint-disable-next-line max-len | ||
throw new Error(`Invalid "proxyUrl" provided: URL must have one of the following protocols: "http", ${server_1.SOCKS_PROTOCOLS.map((p) => `"${p.replace(':', '')}"`).join(', ')} (was "${parsedProxyUrl}")`); | ||
} | ||
@@ -31,0 +32,0 @@ // If upstream proxy requires no password, return it directly |
@@ -14,2 +14,3 @@ /// <reference types="node" /> | ||
import { Socket } from './socket'; | ||
export declare const SOCKS_PROTOCOLS: string[]; | ||
export type ConnectionStats = { | ||
@@ -16,0 +17,0 @@ srcTxBytes: number; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Server = void 0; | ||
exports.Server = exports.SOCKS_PROTOCOLS = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -24,3 +24,3 @@ const http_1 = tslib_1.__importDefault(require("http")); | ||
const chain_socks_1 = require("./chain_socks"); | ||
const SOCKS_PROTOCOLS = ['socks:', 'socks4:', 'socks4a:', 'socks5:', 'socks5h:']; | ||
exports.SOCKS_PROTOCOLS = ['socks:', 'socks4:', 'socks4a:', 'socks5:', 'socks5h:']; | ||
// TODO: | ||
@@ -233,3 +233,3 @@ // - Implement this requirement from rfc7230 | ||
} | ||
if (handlerOpts.upstreamProxyUrlParsed && SOCKS_PROTOCOLS.includes(handlerOpts.upstreamProxyUrlParsed.protocol)) { | ||
if (handlerOpts.upstreamProxyUrlParsed && exports.SOCKS_PROTOCOLS.includes(handlerOpts.upstreamProxyUrlParsed.protocol)) { | ||
this.log(proxyChainId, 'Using forwardSocks()'); | ||
@@ -261,3 +261,3 @@ return await (0, forward_socks_1.forwardSocks)(request, response, handlerOpts); | ||
if (handlerOpts.upstreamProxyUrlParsed) { | ||
if (SOCKS_PROTOCOLS.includes(handlerOpts.upstreamProxyUrlParsed.protocol)) { | ||
if (exports.SOCKS_PROTOCOLS.includes(handlerOpts.upstreamProxyUrlParsed.protocol)) { | ||
this.log(socket.proxyChainId, `Using chainSocks() => ${request.url}`); | ||
@@ -393,5 +393,5 @@ return await (0, chain_socks_1.chainSocks)(data); | ||
} | ||
if (!['http:', ...SOCKS_PROTOCOLS].includes(handlerOpts.upstreamProxyUrlParsed.protocol)) { | ||
if (!['http:', ...exports.SOCKS_PROTOCOLS].includes(handlerOpts.upstreamProxyUrlParsed.protocol)) { | ||
// eslint-disable-next-line max-len | ||
throw new Error(`Invalid "upstreamProxyUrl" provided: URL must have one of the following protocols: "http", ${SOCKS_PROTOCOLS.map((p) => `"${p.replace(':', '')}"`).join(', ')} (was "${funcResult.upstreamProxyUrl}")`); | ||
throw new Error(`Invalid "upstreamProxyUrl" provided: URL must have one of the following protocols: "http", ${exports.SOCKS_PROTOCOLS.map((p) => `"${p.replace(':', '')}"`).join(', ')} (was "${funcResult.upstreamProxyUrl}")`); | ||
} | ||
@@ -398,0 +398,0 @@ } |
{ | ||
"name": "proxy-chain", | ||
"version": "2.5.1", | ||
"version": "2.5.2-beta.0", | ||
"description": "Node.js implementation of a proxy server (think Squid) with support for SSL, authentication, upstream proxy chaining, and protocol tunneling.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -315,7 +315,2 @@ # Programmable HTTP proxy server for Node.js | ||
```diff | ||
-if (request.url.toLowerCase() === 'example.com:80') { | ||
+if (request.url.toLowerCase() === 'example.com:443') { | ||
``` | ||
## Closing the server | ||
@@ -322,0 +317,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
206447
2109
1
477