2014-08-11 10:28:16 +08:00
|
|
|
var program = require('commander'),
|
2014-08-11 16:43:14 +08:00
|
|
|
mainProxy = require("./proxy.js");
|
2014-08-11 10:28:16 +08:00
|
|
|
|
|
|
|
program
|
|
|
|
.option('-u, --host [value]', 'hostname for https proxy, localhost for default')
|
|
|
|
.option('-t, --type [value]', 'http|https,http for default')
|
|
|
|
.option('-p, --port [value]', 'proxy port, 8001 for default')
|
|
|
|
.option('-c, --clear', 'clear all the tmp certificates')
|
|
|
|
.parse(process.argv);
|
|
|
|
|
|
|
|
if(program.clear){
|
2014-08-11 16:43:14 +08:00
|
|
|
require("./lib/certMgr").clearCerts(function(){
|
|
|
|
console.log("all certs cleared");
|
2014-08-11 10:28:16 +08:00
|
|
|
process.exit(0);
|
|
|
|
});
|
|
|
|
|
|
|
|
}else{
|
|
|
|
mainProxy.startServer(program.type,program.port, program.host);
|
|
|
|
}
|