proxy-chain
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.tee = exports.parseProxyAuthorizationHeader = exports.redactParsedUrl = exports.redactUrl = exports.parseUrl = exports.isHopByHopHeader = exports.parseHostHeader = undefined; | ||
exports.parseProxyAuthorizationHeader = exports.redactParsedUrl = exports.redactUrl = exports.parseUrl = exports.isHopByHopHeader = exports.parseHostHeader = undefined; | ||
@@ -13,7 +13,6 @@ var _url = require('url'); | ||
var _through = require('through'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _through2 = _interopRequireDefault(_through); | ||
// import through from 'through'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -142,9 +141,7 @@ var HOST_HEADER_REGEX = /^((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]))(:([0-9]+))?$/; | ||
* @return {through} duplex stream (pipe) | ||
*/ | ||
var tee = exports.tee = function tee(name) { | ||
var initialOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
export const tee = (name, initialOnly = true) => { | ||
console.log('tee'); | ||
var maxChunks = 2; | ||
var duplex = (0, _through2.default)(function (chunk) { | ||
let maxChunks = 2; | ||
const duplex = through((chunk) => { | ||
if (maxChunks || !initialOnly) { | ||
@@ -154,6 +151,6 @@ // let msg = chunk.toString(); | ||
maxChunks--; | ||
console.log('pipe: ' + JSON.stringify({ | ||
console.log(`pipe: ${JSON.stringify({ | ||
context: name, | ||
chunkHead: chunk.toString().slice(0, 100) | ||
})); | ||
chunkHead: chunk.toString().slice(0, 100), | ||
})}`); | ||
} | ||
@@ -164,2 +161,3 @@ duplex.queue(chunk); | ||
return duplex; | ||
}; | ||
}; | ||
*/ |
{ | ||
"name": "proxy-chain", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Node.js implementation of a proxy server (think Squid) with support for SSL, authentication and upstream proxy chaining.", | ||
@@ -43,5 +43,2 @@ "main": "build/index.js", | ||
"bluebird": "^3.5.1", | ||
"https-proxy-agent": "^2.1.0", | ||
"portastic": "^1.0.1", | ||
"through": "^2.3.8", | ||
"underscore": "^1.8.3" | ||
@@ -58,2 +55,3 @@ }, | ||
"chai": "^4.0.2", | ||
"https-proxy-agent": "^2.1.0", | ||
"eslint": "^3.19.0", | ||
@@ -69,2 +67,3 @@ "eslint-config-airbnb": "^15.0.1", | ||
"mocha": "^3.2.0", | ||
"portastic": "^1.0.1", | ||
"proxy": "^0.2.4", | ||
@@ -74,2 +73,3 @@ "request": "^2.83.0", | ||
"sinon-stub-promise": "^4.0.0", | ||
"through": "^2.3.8", | ||
"ws": "^3.3.1" | ||
@@ -76,0 +76,0 @@ }, |
@@ -7,7 +7,12 @@ # proxy-chain | ||
Node.js implementation of a proxy server (think Squid) with support for SSL, authentication and upstream proxy chaining. | ||
The authentication and proxy chaining configuration is defined in code and can be dynamic. | ||
Note that the proxy server only supports Basic authentication | ||
(see (Proxy-Authorization)[https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authorization] for details). | ||
For example, this library is useful if you need to use proxies with authentication | ||
in the headless Chrome web browser, but don't feel like setting up Squid or some other proxy server. | ||
The authentication and proxy chaining configuration is provided in code and can be dynamic. | ||
in the headless Chrome web browser, because it doesn't accept proxy URLs such as `http://username:password@proxy.example.com:8080`. | ||
With this library, you can setup a local proxy server without any password | ||
that will forward requests to the upstream proxy with password. | ||
## Run a simple HTTP/HTTPS proxy server | ||
@@ -41,2 +46,11 @@ | ||
// If the function is not defined or is null, the server runs in a simple mode. | ||
// Note that the function takes a single argument with the following properties: | ||
// * request - An instance of http.IncomingMessage class with information about the client request | ||
// (which is either HTTP CONNECT for SSL protocol, or other HTTP request) | ||
// * username - Username parsed from the Proxy-Authorization header | ||
// * password - Password parsed from the Proxy-Authorization header | ||
// * hostname - Hostname of the target server | ||
// * port - Port of the target server | ||
// * isHttp - If true, this is a HTTP request, otherwise it's a HTTP CONNECT tunnel for SSL | ||
// or other protocols | ||
prepareRequestFunction: ({ request, username, password, hostname, port, isHttp }) => { | ||
@@ -43,0 +57,0 @@ return { |
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
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
72435
2
70
26
1068
- Removedhttps-proxy-agent@^2.1.0
- Removedportastic@^1.0.1
- Removedthrough@^2.3.8
- Removedagent-base@4.3.0(transitive)
- Removedbluebird@2.11.0(transitive)
- Removedcommander@2.20.3(transitive)
- Removeddebug@2.6.93.2.7(transitive)
- Removedes6-promise@4.2.8(transitive)
- Removedes6-promisify@5.0.0(transitive)
- Removedhttps-proxy-agent@2.2.4(transitive)
- Removedms@2.0.02.1.3(transitive)
- Removedportastic@1.0.1(transitive)
- Removedthrough@2.3.8(transitive)