mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-24 08:41:31 +00:00
move some module to optionalDep
This commit is contained in:
parent
218a2fd7fd
commit
8582a3cd77
@ -10,9 +10,7 @@ var http = require("http"),
|
|||||||
Buffer = require('buffer').Buffer,
|
Buffer = require('buffer').Buffer,
|
||||||
util = require("./util"),
|
util = require("./util"),
|
||||||
Stream = require("stream"),
|
Stream = require("stream"),
|
||||||
httpsServerMgr = require("./httpsServerMgr"),
|
httpsServerMgr = require("./httpsServerMgr");
|
||||||
HttpProxyAgent = require("http-proxy-agent"),
|
|
||||||
HttpsProxyAgent= require("https-proxy-agent");
|
|
||||||
|
|
||||||
var httpsServerMgrInstance = new httpsServerMgr(),
|
var httpsServerMgrInstance = new httpsServerMgr(),
|
||||||
defaultRule = require("./rule_default.js"),
|
defaultRule = require("./rule_default.js"),
|
||||||
@ -111,13 +109,7 @@ function userRequestHandler(req,userRes){
|
|||||||
method : req.method,
|
method : req.method,
|
||||||
headers : req.headers
|
headers : req.headers
|
||||||
};
|
};
|
||||||
userRule.externalHttpProxies = userRule.externalHttpProxies || [];
|
|
||||||
if(userRule.externalHttpProxies.length){
|
|
||||||
var agent = null, externalProxy = userRule.externalHttpProxies[Math.floor(Math.random()*userRule.externalHttpProxies.length)];
|
|
||||||
agent = new HttpProxyAgent(externalProxy);
|
|
||||||
if(agent)options.agent = agent;
|
|
||||||
console.log(color.blue('this request is using ' + externalProxy + ' as external proxy'));
|
|
||||||
}
|
|
||||||
options = userRule.replaceRequestOption(req,options) || options;
|
options = userRule.replaceRequestOption(req,options) || options;
|
||||||
|
|
||||||
//update quest data
|
//update quest data
|
||||||
|
26
package.json
26
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "anyproxy",
|
"name": "anyproxy",
|
||||||
"version": "2.8.1",
|
"version": "2.8.2",
|
||||||
"description": "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.",
|
"description": "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.",
|
||||||
"main": "proxy.js",
|
"main": "proxy.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
@ -13,26 +13,28 @@
|
|||||||
"commander": "~2.3.0",
|
"commander": "~2.3.0",
|
||||||
"entities": "^1.1.1",
|
"entities": "^1.1.1",
|
||||||
"express": "^4.8.5",
|
"express": "^4.8.5",
|
||||||
"iconv-lite": "^0.4.4",
|
|
||||||
"ip": "^0.3.2",
|
|
||||||
"jquery": "^2.1.1",
|
|
||||||
"jsdom": "^1.0.3",
|
|
||||||
"juicer": "^0.6.6-stable",
|
"juicer": "^0.6.6-stable",
|
||||||
"nedb": "^0.11.0",
|
"nedb": "^0.11.0",
|
||||||
"qrcode-npm": "0.0.3",
|
"qrcode-npm": "0.0.3",
|
||||||
"socks5-http-client": "^0.1.6",
|
|
||||||
"socks5-https-client": "^0.2.2",
|
|
||||||
"stream-throttle": "^0.1.3",
|
"stream-throttle": "^0.1.3",
|
||||||
"ws": "^0.4.32",
|
"ws": "^0.4.32"
|
||||||
"cookie":"^0.1.2",
|
|
||||||
"mysql":"^2.5.2",
|
|
||||||
"http-proxy-agent":"^0.2.6",
|
|
||||||
"https-proxy-agent":"^0.3.5"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"devDependencies": {},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "nodeunit test.js"
|
"test": "nodeunit test.js"
|
||||||
},
|
},
|
||||||
|
"optionalDependencies":{
|
||||||
|
"cookie":"^0.1.2",
|
||||||
|
"mysql":"^2.5.2",
|
||||||
|
"iconv-lite": "^0.4.4",
|
||||||
|
"ip": "^0.3.2",
|
||||||
|
"jquery": "^2.1.1",
|
||||||
|
"jsdom": "^1.0.3",
|
||||||
|
"socks5-http-client": "^0.1.6",
|
||||||
|
"socks5-https-client": "^0.2.2",
|
||||||
|
"http-proxy-agent":"^0.2.6",
|
||||||
|
"https-proxy-agent":"^0.3.5"
|
||||||
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type":"git",
|
"type":"git",
|
||||||
"url" :"https://github.com/alibaba/anyproxy"
|
"url" :"https://github.com/alibaba/anyproxy"
|
||||||
|
4
proxy.js
4
proxy.js
@ -10,6 +10,10 @@ try{
|
|||||||
GLOBAL.util['mysql'] = require('mysql');
|
GLOBAL.util['mysql'] = require('mysql');
|
||||||
GLOBAL.util['Socks5ClientHttpAgent'] = require('socks5-http-client/lib/Agent');
|
GLOBAL.util['Socks5ClientHttpAgent'] = require('socks5-http-client/lib/Agent');
|
||||||
GLOBAL.util['Socks5ClientHttpsAgent'] = require('socks5-https-client/lib/Agent');
|
GLOBAL.util['Socks5ClientHttpsAgent'] = require('socks5-https-client/lib/Agent');
|
||||||
|
GLOBAL.util['HttpProxyAgent'] = require("http-proxy-agent");
|
||||||
|
GLOBAL.util['HttpsProxyAgent'] = require("https-proxy-agent");
|
||||||
|
|
||||||
|
|
||||||
}catch(e){}
|
}catch(e){}
|
||||||
|
|
||||||
var http = require('http'),
|
var http = require('http'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user