Commit 25bd9149 authored by Max Lv's avatar Max Lv

update gfw list

parent 9f2052e1
...@@ -521,7 +521,6 @@ ...@@ -521,7 +521,6 @@
<item>124.219</item> <item>124.219</item>
<item>124.244</item> <item>124.244</item>
<item>125.6</item> <item>125.6</item>
<item>127.0</item>
<item>128.100</item> <item>128.100</item>
<item>128.241</item> <item>128.241</item>
<item>131.84</item> <item>131.84</item>
......
...@@ -236,6 +236,7 @@ class ShadowVpnService extends VpnService { ...@@ -236,6 +236,7 @@ class ShadowVpnService extends VpnService {
.setMtu(VPN_MTU) .setMtu(VPN_MTU)
.addAddress("172.16.0.1", 24) .addAddress("172.16.0.1", 24)
.addDnsServer("8.8.8.8") .addDnsServer("8.8.8.8")
.addDnsServer("8.8.4.4")
if (InetAddressUtils.isIPv6Address(appHost)) { if (InetAddressUtils.isIPv6Address(appHost)) {
builder.addRoute("0.0.0.0", 0) builder.addRoute("0.0.0.0", 0)
...@@ -244,8 +245,11 @@ class ShadowVpnService extends VpnService { ...@@ -244,8 +245,11 @@ class ShadowVpnService extends VpnService {
val address = appHost.split('.') val address = appHost.split('.')
val prefix = address(0) + "." + address(1) val prefix = address(0) + "." + address(1)
gfwList.foreach(addr => gfwList.foreach(addr =>
if (addr != prefix) builder.addRoute(prefix + ".0.0", 16) if (addr != prefix) {
builder.addRoute(addr + ".0.0", 16)
}
) )
builder.addRoute("8.8.0.0", 16)
} else { } else {
val prefix = appHost.split('.')(0).toInt val prefix = appHost.split('.')(0).toInt
for (i <- 1 to 254) { for (i <- 1 to 254) {
......
...@@ -313,28 +313,6 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton. ...@@ -313,28 +313,6 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton.
} }
}.start() }.start()
} }
if (isServiceStarted) {
switchButton.setChecked(true)
if (ShadowVpnService.isServiceStarted) {
val style = new Style.Builder()
.setBackgroundColorValue(Style.holoBlueLight)
.setDuration(Style.DURATION_INFINITE)
.build()
switchButton.setEnabled(false)
Crouton.makeText(Shadowsocks.this, R.string.vpn_status, style).show()
}
} else {
switchButton.setChecked(false)
if (settings.getBoolean("isRunning", false)) {
new Thread {
override def run() {
crash_recovery()
handler.sendEmptyMessage(MSG_CRASH_RECOVER)
}
}.start()
}
}
} }
override def onCreateOptionsMenu(menu: Menu): Boolean = { override def onCreateOptionsMenu(menu: Menu): Boolean = {
...@@ -376,6 +354,11 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton. ...@@ -376,6 +354,11 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton.
super.onOptionsItemSelected(item) super.onOptionsItemSelected(item)
} }
protected override def onNewIntent(intent: Intent) {
super.onNewIntent(intent)
setIntent(intent)
}
protected override def onPause() { protected override def onPause() {
super.onPause() super.onPause()
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(this) PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(this)
...@@ -383,7 +366,32 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton. ...@@ -383,7 +366,32 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton.
protected override def onResume() { protected override def onResume() {
super.onResume() super.onResume()
val settings: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(this) if (getIntent.getAction != Shadowsocks.REQUEST_CONNECT) {
val settings: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
if (isServiceStarted) {
switchButton.setChecked(true)
if (ShadowVpnService.isServiceStarted) {
val style = new Style.Builder()
.setBackgroundColorValue(Style.holoBlueLight)
.setDuration(Style.DURATION_INFINITE)
.build()
switchButton.setEnabled(false)
Crouton.makeText(Shadowsocks.this, R.string.vpn_status, style).show()
}
} else {
switchButton.setEnabled(true)
switchButton.setChecked(false)
Crouton.cancelAllCroutons()
if (settings.getBoolean("isRunning", false)) {
new Thread {
override def run() {
crash_recovery()
handler.sendEmptyMessage(MSG_CRASH_RECOVER)
}
}.start()
}
}
}
setPreferenceEnabled() setPreferenceEnabled()
switchButton.setOnCheckedChangeListener(this) switchButton.setOnCheckedChangeListener(this)
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this) PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this)
...@@ -419,7 +427,10 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton. ...@@ -419,7 +427,10 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton.
if (!switchButton.isChecked) switchButton.setChecked(true) if (!switchButton.isChecked) switchButton.setChecked(true)
} }
else { else {
if (switchButton.isChecked) switchButton.setChecked(false) if (switchButton.isChecked) {
switchButton.setEnabled(true)
switchButton.setChecked(false)
}
} }
} }
if (key == "isConnecting") { if (key == "isConnecting") {
......
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