conflict resolved for README

This commit is contained in:
OttoMao 2015-03-16 14:29:13 +08:00
commit 6b231cbf26
5 changed files with 43 additions and 18 deletions

View File

@ -67,7 +67,6 @@ Rule module
Https features Https features
---------------- ----------------
After configuring rootCA, AnyProxy could help to decrypt https requests, whose approach is also called Man-In-The-Middle(MITM). After configuring rootCA, AnyProxy could help to decrypt https requests, whose approach is also called Man-In-The-Middle(MITM).
A guide about configuring https features is here : [https://github.com/alibaba/anyproxy/wiki/How-to-config-https-proxy](https://github.com/alibaba/anyproxy/wiki/How-to-config-https-proxy) A guide about configuring https features is here : [https://github.com/alibaba/anyproxy/wiki/How-to-config-https-proxy](https://github.com/alibaba/anyproxy/wiki/How-to-config-https-proxy)
@ -75,6 +74,15 @@ A guide about configuring https features is here : [https://github.com/alibaba/a
Others Others
----------------- -----------------
#### to install node modules
* to install node modules for supporting rules development, use ``` anyproxy install ```
* for example ``` anyproxy install underscore ```
* and in rule file
```
var base = path.join(process.env.NODE_PATH,'anyproxy','node_modules');
var underscore = require(path.join(base,'underscore'));
```
#### to save request data #### to save request data
* to save request data to local file, use ``` anyproxy --file /path/to/file ``` * to save request data to local file, use ``` anyproxy --file /path/to/file ```

14
bin.js
View File

@ -1,10 +1,10 @@
#!/usr/bin/env node #!/usr/bin/env node
var program = require('commander'), var program = require('commander'),
proxy = require("./proxy.js"),
color = require('colorful'), color = require('colorful'),
fs = require("fs"), fs = require("fs"),
path = require("path"), path = require("path"),
npm = require("npm"),
packageInfo = require("./package.json"); packageInfo = require("./package.json");
program program
@ -18,6 +18,7 @@ program
.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('-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')
.option('install', 'install node modules')
.parse(process.argv); .parse(process.argv);
if(program.clear){ if(program.clear){
@ -30,7 +31,18 @@ if(program.clear){
require("./lib/certMgr").generateRootCA(function(){ require("./lib/certMgr").generateRootCA(function(){
process.exit(0); process.exit(0);
}); });
}else if(program.install){
npm.load({
"prefix": process.env.NODE_PATH + '/anyproxy/'
}, function (er) {
npm.commands.install(program.args || [], function (er, data) {
if(er)throw er;
})
npm.registry.log.on("log", function (message) {
})
});
}else{ }else{
var proxy = require("./proxy.js");
var ruleModule; var ruleModule;
if(program.rule){ if(program.rule){

View File

@ -1,6 +1,6 @@
{ {
"name": "anyproxy", "name": "anyproxy",
"version": "3.2.2", "version": "3.2.3",
"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": {
@ -19,7 +19,8 @@
"nedb": "^0.11.0", "nedb": "^0.11.0",
"qrcode-npm": "0.0.3", "qrcode-npm": "0.0.3",
"stream-throttle": "^0.1.3", "stream-throttle": "^0.1.3",
"ws": "^0.4.32" "ws": "^0.4.32",
"npm": "^2.7.0"
}, },
"devDependencies": { "devDependencies": {
"proxy-eval": ">=1.1.1" "proxy-eval": ">=1.1.1"

View File

@ -48,7 +48,12 @@ try{
if(fs.existsSync(path.join(process.cwd(),'rule.js'))){ if(fs.existsSync(path.join(process.cwd(),'rule.js'))){
default_rule = require(path.join(process.cwd(),'rule')); default_rule = require(path.join(process.cwd(),'rule'));
} }
}catch(e){} }catch(e){
if(e){
console.log("error" + e);
throw e;
}
}
//option //option
//option.type : 'http'(default) or 'https' //option.type : 'http'(default) or 'https'

View File

@ -3,7 +3,6 @@
module.exports = { module.exports = {
replaceServerResDataAsync: function(req,res,serverResData,callback){ replaceServerResDataAsync: function(req,res,serverResData,callback){
//append "hello world" to all web pages //append "hello world" to all web pages
if(/html/i.test(res.headers['content-type'])){ if(/html/i.test(res.headers['content-type'])){
var newDataStr = serverResData.toString(); var newDataStr = serverResData.toString();