mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-06-07 09:48:21 +00:00
update https features
This commit is contained in:
parent
df33805e17
commit
de3ba93a61
@ -1,3 +1,7 @@
|
|||||||
|
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:
|
12 Jan 2015: anyproxy 3.0.4:
|
||||||
|
|
||||||
* show anyproxy version by --version
|
* show anyproxy version by --version
|
||||||
@ -6,7 +10,6 @@
|
|||||||
|
|
||||||
* Bugfix: https throttle
|
* Bugfix: https throttle
|
||||||
|
|
||||||
|
|
||||||
9 Jan 2015: anyproxy 3.0.2:
|
9 Jan 2015: anyproxy 3.0.2:
|
||||||
|
|
||||||
* UI improvement: add link and qr code to root CA file.
|
* UI improvement: add link and qr code to root CA file.
|
@ -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.
|
* you should trust this rootCA on all of your clients.
|
||||||
|
|
||||||
#### to intercept(decrypt) https requests
|
#### to intercept(decrypt) https requests
|
||||||
* start your anyproxy as normal. When rootCA is generated, it will intercept all the https requests for you automatically.
|
* start your anyproxy by ``anyproxy --intercept``. When rootCA exists, it will intercept(decrypt) all the https requests for you.
|
||||||
* if you get a warning like 'unsafe connection', please check if the root CA is correctly trusted .
|
* 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
|
#### to start an https proxy
|
||||||
* ``anyproxy --type https --host my.domain.com``
|
* ``anyproxy --type https --host my.domain.com``
|
||||||
|
9
bin.js
9
bin.js
@ -6,7 +6,6 @@ var program = require('commander'),
|
|||||||
fs = require("fs"),
|
fs = require("fs"),
|
||||||
packageInfo = require("./package.json");
|
packageInfo = require("./package.json");
|
||||||
|
|
||||||
|
|
||||||
program
|
program
|
||||||
.version(packageInfo.version)
|
.version(packageInfo.version)
|
||||||
.option('-u, --host [value]', 'hostname for https proxy, localhost for default')
|
.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('-r, --rule [value]', 'path for rule file,')
|
||||||
.option('-g, --root [value]', 'generate root CA')
|
.option('-g, --root [value]', 'generate root CA')
|
||||||
.option('-l, --throttle [value]', 'throttle speed in kb/s (kbyte / sec)')
|
.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')
|
.option('-c, --clear', 'clear all the tmp certificates')
|
||||||
.parse(process.argv);
|
.parse(process.argv);
|
||||||
|
|
||||||
@ -52,10 +52,7 @@ if(program.clear){
|
|||||||
dbFile : program.file,
|
dbFile : program.file,
|
||||||
throttle : program.throttle,
|
throttle : program.throttle,
|
||||||
rule : ruleModule,
|
rule : ruleModule,
|
||||||
disableWebInterface:false
|
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 = {
|
module.exports = {
|
||||||
summary:function(){
|
summary:function(){
|
||||||
var tip = "the default rule for anyproxy, support : CORS. ";
|
var tip = "the default rule for anyproxy, support : CORS. ";
|
||||||
if(isRootCAFileExists){
|
if(!isRootCAFileExists){
|
||||||
tip += "\nRoot CA exists, will intercept all https requests.";
|
tip += "\nRoot CA does not exist, will not intercept any https requests.";
|
||||||
}
|
}
|
||||||
return tip;
|
return tip;
|
||||||
},
|
},
|
||||||
@ -53,14 +54,14 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
shouldInterceptHttpsReq:function(req){
|
shouldInterceptHttpsReq:function(req){
|
||||||
// return false;
|
return interceptFlag;
|
||||||
return isRootCAFileExists;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//[beta]
|
//[beta]
|
||||||
//fetch entire traffic data
|
//fetch entire traffic data
|
||||||
fetchTrafficData: function(id,info){},
|
fetchTrafficData: function(id,info){},
|
||||||
|
|
||||||
|
//[internal]
|
||||||
customMenu:[
|
customMenu:[
|
||||||
{
|
{
|
||||||
name :"test",
|
name :"test",
|
||||||
@ -69,7 +70,11 @@ module.exports = {
|
|||||||
name :"second-test",
|
name :"second-test",
|
||||||
handler :function(){}
|
handler :function(){}
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
|
||||||
|
setInterceptFlag:function(flag){
|
||||||
|
interceptFlag = flag && isRootCAFileExists;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "anyproxy",
|
"name": "anyproxy",
|
||||||
"version": "3.0.4",
|
"version": "3.1.0",
|
||||||
"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": {
|
||||||
|
5
proxy.js
5
proxy.js
@ -60,6 +60,7 @@ try{
|
|||||||
//option.dbFile : null(default)
|
//option.dbFile : null(default)
|
||||||
//option.throttle : null(default)
|
//option.throttle : null(default)
|
||||||
//option.disableWebInterface
|
//option.disableWebInterface
|
||||||
|
//option.interceptHttps ,internal param for https
|
||||||
function proxyServer(option){
|
function proxyServer(option){
|
||||||
option = option || {};
|
option = option || {};
|
||||||
|
|
||||||
@ -79,6 +80,10 @@ function proxyServer(option){
|
|||||||
GLOBAL.recorder = new Recorder();
|
GLOBAL.recorder = new Recorder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!!option.interceptHttps){
|
||||||
|
default_rule.setInterceptFlag(true);
|
||||||
|
}
|
||||||
|
|
||||||
if(option.throttle){
|
if(option.throttle){
|
||||||
console.log("throttle :" + option.throttle + "kb/s");
|
console.log("throttle :" + option.throttle + "kb/s");
|
||||||
GLOBAL._throttle = new ThrottleGroup({rate: 1024 * parseInt(option.throttle) }); // rate - byte/sec
|
GLOBAL._throttle = new ThrottleGroup({rate: 1024 * parseInt(option.throttle) }); // rate - byte/sec
|
||||||
|
Loading…
x
Reference in New Issue
Block a user