Commit 3429776c authored by Max Lv's avatar Max Lv

fix the vpn mode

parent 4bf784fd
...@@ -72,6 +72,7 @@ class ShadowsocksVpnService extends VpnService with BaseService { ...@@ -72,6 +72,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
var receiver: BroadcastReceiver = null var receiver: BroadcastReceiver = null
var apps: Array[ProxiedApp] = null var apps: Array[ProxiedApp] = null
var config: Config = null var config: Config = null
var dns = Utils.getDNS
val handler: Handler = new Handler() val handler: Handler = new Handler()
...@@ -91,7 +92,7 @@ class ShadowsocksVpnService extends VpnService with BaseService { ...@@ -91,7 +92,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
Path.BASE + "ss-tunnel.pid") Path.BASE + "ss-tunnel.pid")
.format(config.proxy, config.remotePort, 8153, config.sitekey, config.encMethod) .format(config.proxy, config.remotePort, 8153, config.sitekey, config.encMethod)
} else { } else {
val conf = ConfigUtils.PDNSD.format("0.0.0.0", getString(R.string.exclude), Utils.getDNS) val conf = ConfigUtils.PDNSD.format("0.0.0.0", getString(R.string.exclude), dns)
ConfigUtils.printToFile(new File(Path.BASE + "pdnsd.conf"))(p => { ConfigUtils.printToFile(new File(Path.BASE + "pdnsd.conf"))(p => {
p.println(conf) p.println(conf)
}) })
...@@ -115,11 +116,13 @@ class ShadowsocksVpnService extends VpnService with BaseService { ...@@ -115,11 +116,13 @@ class ShadowsocksVpnService extends VpnService with BaseService {
def isByass(util: SubnetUtils): Boolean = { def isByass(util: SubnetUtils): Boolean = {
val info = util.getInfo val info = util.getInfo
info.isInRange(config.proxy) || info.isInRange("114.114.114.114") || info.isInRange(Utils.getDNS) info.isInRange(config.proxy) || info.isInRange("114.114.114.114") || info.isInRange(dns)
} }
def startVpn() { def startVpn() {
dns = Utils.getDNS
val builder = new Builder() val builder = new Builder()
builder builder
.setSession(config.profileName) .setSession(config.profileName)
......
...@@ -79,7 +79,7 @@ object ConfigUtils { ...@@ -79,7 +79,7 @@ object ConfigUtils {
| |
|server { |server {
| label = "google-servers"; | label = "google-servers";
| ip = 8.8.8.8, 8.8.4.4; | ip = 8.8.8.8, 8.8.4.4, 208.67.222.222, 208.67.220.220;
| exclude = %s; | exclude = %s;
| timeout = 5; | timeout = 5;
|} |}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment