bypass system dns

This commit is contained in:
Max Lv
2014-04-10 19:36:37 +08:00
parent 3aaad221ab
commit 1a09f8d1c3
5 changed files with 18 additions and 8 deletions
@@ -120,7 +120,7 @@ class ShadowsocksNatService extends Service with BaseService {
} else {
val conf = {
if (config.isGFWList)
ConfigUtils.PDNSD_BYPASS.format("127.0.0.1", getString(R.string.exclude))
ConfigUtils.PDNSD_BYPASS.format("127.0.0.1", System.getDNS1, getString(R.string.exclude))
else
ConfigUtils.PDNSD.format("127.0.0.1")
}
@@ -313,8 +313,8 @@ class ShadowsocksNatService extends Service with BaseService {
init_sb.append(cmd_bypass.replace("0.0.0.0", "127.0.0.1"))
if (config.isGFWList) {
// Bypass DNS in China
init_sb.append(cmd_bypass.replace("-p tcp -d 0.0.0.0", "-d " + System.getDNS1))
init_sb.append(cmd_bypass.replace("-p tcp -d 0.0.0.0", "-d 114.114.114.114"))
init_sb.append(cmd_bypass.replace("-p tcp -d 0.0.0.0", "-d 114.114.115.115"))
}
if (hasRedirectSupport) {
init_sb
@@ -77,7 +77,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
def isByass(net: SubnetUtils): Boolean = {
val info = net.getInfo
info.isInRange(config.proxy) || info.isInRange("114.114.114.114") || info.isInRange("114.114.115.115")
info.isInRange(config.proxy) || info.isInRange("114.114.114.114") || info.isInRange(System.getDNS1)
}
def startShadowsocksDaemon() {
@@ -92,7 +92,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
def startDnsDaemon() {
val conf = {
if (config.isGFWList)
ConfigUtils.PDNSD_BYPASS.format("0.0.0.0", getString(R.string.exclude))
ConfigUtils.PDNSD_BYPASS.format("0.0.0.0", System.getDNS1, getString(R.string.exclude))
else
ConfigUtils.PDNSD.format("0.0.0.0")
}
@@ -110,12 +110,12 @@ object ConfigUtils {
|
|server {
| label = "china-servers";
| ip = 114.114.114.114, 114.114.115.115;
| ip = %s, 114.114.114.114;
| uptest = none;
| preset = on;
| include = %s;
| policy = excluded;
| timeout = 3;
| timeout = 2;
|}
|
|server {
@@ -197,4 +197,4 @@ object ConfigUtils {
new Config(isGlobalProxy, isGFWList, isBypassApps, isTrafficStat, isUdpDns, profileName, proxy,
sitekey, encMethod, proxiedAppString, remotePort, localPort)
}
}
}