mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-06-05 16:58:22 +00:00
update https features
This commit is contained in:
parent
df33805e17
commit
de3ba93a61
@ -1,11 +1,14 @@
|
||||
22 Jan 2015: anyproxy 3.1.0:
|
||||
|
||||
* will NOT intercept https request by default. Use ``anyproxy --intercept`` to turn on this feature.
|
||||
|
||||
12 Jan 2015: anyproxy 3.0.4:
|
||||
|
||||
* show anyproxy version by --version
|
||||
|
||||
12 Jan 2015: anyproxy 3.0.3:
|
||||
|
||||
* Bugfix: https throttle
|
||||
|
||||
* Bugfix: https throttle
|
||||
|
||||
9 Jan 2015: anyproxy 3.0.2:
|
||||
|
||||
|
@ -81,8 +81,8 @@ After configuring rootCA, anyproxy could help to decrypt https requests, whose a
|
||||
* you should trust this rootCA on all of your clients.
|
||||
|
||||
#### to intercept(decrypt) https requests
|
||||
* start your anyproxy as normal. When rootCA is generated, it will intercept all the https requests for you automatically.
|
||||
* if you get a warning like 'unsafe connection', please check if the root CA is correctly trusted .
|
||||
* start your anyproxy by ``anyproxy --intercept``. When rootCA exists, it will intercept(decrypt) all the https requests for you.
|
||||
* if you meet with a warning like 'unsafe connection', please check if the root CA is correctly trusted by your operation system.
|
||||
|
||||
#### to start an https proxy
|
||||
* ``anyproxy --type https --host my.domain.com``
|
||||
|
23
bin.js
23
bin.js
@ -6,7 +6,6 @@ var program = require('commander'),
|
||||
fs = require("fs"),
|
||||
packageInfo = require("./package.json");
|
||||
|
||||
|
||||
program
|
||||
.version(packageInfo.version)
|
||||
.option('-u, --host [value]', 'hostname for https proxy, localhost for default')
|
||||
@ -16,6 +15,7 @@ program
|
||||
.option('-r, --rule [value]', 'path for rule file,')
|
||||
.option('-g, --root [value]', 'generate root CA')
|
||||
.option('-l, --throttle [value]', 'throttle speed in kb/s (kbyte / sec)')
|
||||
.option('-i, --intercept', 'intercept(decrypt) https requests when root CA exists')
|
||||
.option('-c, --clear', 'clear all the tmp certificates')
|
||||
.parse(process.argv);
|
||||
|
||||
@ -46,16 +46,13 @@ if(program.clear){
|
||||
}
|
||||
|
||||
new proxy.proxyServer({
|
||||
type : program.type,
|
||||
port : program.port,
|
||||
hostname : program.host,
|
||||
dbFile : program.file,
|
||||
throttle : program.throttle,
|
||||
rule : ruleModule,
|
||||
disableWebInterface:false
|
||||
type : program.type,
|
||||
port : program.port,
|
||||
hostname : program.host,
|
||||
dbFile : program.file,
|
||||
throttle : program.throttle,
|
||||
rule : ruleModule,
|
||||
disableWebInterface : false,
|
||||
interceptHttps : program.intercept
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,10 +1,11 @@
|
||||
var isRootCAFileExists = require("./certMgr.js").isRootCAFileExists();
|
||||
var isRootCAFileExists = require("./certMgr.js").isRootCAFileExists(),
|
||||
interceptFlag = false;
|
||||
|
||||
module.exports = {
|
||||
summary:function(){
|
||||
var tip = "the default rule for anyproxy, support : CORS. ";
|
||||
if(isRootCAFileExists){
|
||||
tip += "\nRoot CA exists, will intercept all https requests.";
|
||||
if(!isRootCAFileExists){
|
||||
tip += "\nRoot CA does not exist, will not intercept any https requests.";
|
||||
}
|
||||
return tip;
|
||||
},
|
||||
@ -53,14 +54,14 @@ module.exports = {
|
||||
},
|
||||
|
||||
shouldInterceptHttpsReq:function(req){
|
||||
// return false;
|
||||
return isRootCAFileExists;
|
||||
return interceptFlag;
|
||||
},
|
||||
|
||||
//[beta]
|
||||
//fetch entire traffic data
|
||||
fetchTrafficData: function(id,info){},
|
||||
|
||||
//[internal]
|
||||
customMenu:[
|
||||
{
|
||||
name :"test",
|
||||
@ -69,7 +70,11 @@ module.exports = {
|
||||
name :"second-test",
|
||||
handler :function(){}
|
||||
}
|
||||
]
|
||||
],
|
||||
|
||||
setInterceptFlag:function(flag){
|
||||
interceptFlag = flag && isRootCAFileExists;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "anyproxy",
|
||||
"version": "3.0.4",
|
||||
"version": "3.1.0",
|
||||
"description": "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.",
|
||||
"main": "proxy.js",
|
||||
"bin": {
|
||||
|
5
proxy.js
5
proxy.js
@ -60,6 +60,7 @@ try{
|
||||
//option.dbFile : null(default)
|
||||
//option.throttle : null(default)
|
||||
//option.disableWebInterface
|
||||
//option.interceptHttps ,internal param for https
|
||||
function proxyServer(option){
|
||||
option = option || {};
|
||||
|
||||
@ -79,6 +80,10 @@ function proxyServer(option){
|
||||
GLOBAL.recorder = new Recorder();
|
||||
}
|
||||
|
||||
if(!!option.interceptHttps){
|
||||
default_rule.setInterceptFlag(true);
|
||||
}
|
||||
|
||||
if(option.throttle){
|
||||
console.log("throttle :" + option.throttle + "kb/s");
|
||||
GLOBAL._throttle = new ThrottleGroup({rate: 1024 * parseInt(option.throttle) }); // rate - byte/sec
|
||||
|
Loading…
x
Reference in New Issue
Block a user