optimized tips for global proxy

This commit is contained in:
OttoMao
2016-04-05 22:09:07 +08:00
parent c3e67ebcb1
commit b76610576a
4 changed files with 24 additions and 21 deletions

View File

@@ -18,7 +18,6 @@ function execSync(cmd) {
};
}
/**
* proxy for CentOs
* ------------------------------------------------------------------------
@@ -72,7 +71,7 @@ macProxyManager.getNetworkType = function() {
macProxyManager.enableGlobalProxy = function(ip, port, proxyType) {
if (!ip || !port) {
console.log('proxy server\'s ip and port are required');
console.log('failed to set global proxy server.\n ip and port are required.');
return;
};
@@ -137,12 +136,11 @@ var winProxyManager = {};
winProxyManager.enableGlobalProxy = function(ip, port) {
if (!ip && !port) {
console.log('proxy server\'s ip and port are required');
console.log('failed to set global proxy server.\n ip and port are required.');
return;
};
return execSync(
// set proxy
'reg add "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyServer /t REG_SZ /d ${ip}:${port} /f & '
.replace("${ip}", ip)