Commit 87bc4673 authored by Max Lv's avatar Max Lv

no more dns proxy option

parent d516af3c
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBoxPreference
android:defaultValue="true"
android:key="isDNSProxy"
android:summary="@string/dns_proxy_summary"
android:title="@string/dns_proxy">
</CheckBoxPreference>
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
android:key="isGFWList" android:key="isGFWList"
......
...@@ -272,9 +272,6 @@ class ShadowsocksService extends Service { ...@@ -272,9 +272,6 @@ class ShadowsocksService extends Service {
/** Called when the activity is first created. */ /** Called when the activity is first created. */
def handleConnection: Boolean = { def handleConnection: Boolean = {
if (config.isHTTPProxy) {
startPolipoDaemon()
}
startShadowsocksDaemon() startShadowsocksDaemon()
startDnsDaemon() startDnsDaemon()
startRedsocksDaemon() startRedsocksDaemon()
...@@ -438,11 +435,9 @@ class ShadowsocksService extends Service { ...@@ -438,11 +435,9 @@ class ShadowsocksService extends Service {
init_sb.append(cmd_bypass.replace("-d 0.0.0.0", "-d " + config.proxy)) init_sb.append(cmd_bypass.replace("-d 0.0.0.0", "-d " + config.proxy))
} }
init_sb.append(cmd_bypass.replace("0.0.0.0", "127.0.0.1")) init_sb.append(cmd_bypass.replace("0.0.0.0", "127.0.0.1"))
if (!config.isDNSProxy) {
init_sb.append(cmd_bypass.replace("-d 0.0.0.0", "--dport " + 53)) init_sb.append(cmd_bypass.replace("-d 0.0.0.0", "--dport " + 53))
init_sb init_sb
.append(cmd_bypass.replace("-d 0.0.0.0", "-m owner --uid-owner " + getApplicationInfo.uid)) .append(cmd_bypass.replace("-d 0.0.0.0", "-m owner --uid-owner " + getApplicationInfo.uid))
}
if (hasRedirectSupport) { if (hasRedirectSupport) {
init_sb init_sb
.append(Utils.getIptables) .append(Utils.getIptables)
......
...@@ -58,8 +58,6 @@ object Key { ...@@ -58,8 +58,6 @@ object Key {
val isGlobalProxy = "isGlobalProxy" val isGlobalProxy = "isGlobalProxy"
val isGFWList = "isGFWList" val isGFWList = "isGFWList"
val isBypassApps = "isBypassApps" val isBypassApps = "isBypassApps"
val isDNSProxy = "isDNSProxy"
val isHTTPProxy = "isHTTPProxy"
val proxy = "proxy" val proxy = "proxy"
val sitekey = "sitekey" val sitekey = "sitekey"
...@@ -72,8 +70,6 @@ case class Config ( ...@@ -72,8 +70,6 @@ case class Config (
isGlobalProxy: Boolean, isGlobalProxy: Boolean,
isGFWList: Boolean, isGFWList: Boolean,
isBypassApps: Boolean, isBypassApps: Boolean,
isDNSProxy: Boolean,
isHTTPProxy: Boolean,
var proxy: String, var proxy: String,
sitekey: String, sitekey: String,
encMethod: String, encMethod: String,
...@@ -104,8 +100,6 @@ object Extra { ...@@ -104,8 +100,6 @@ object Extra {
edit.putBoolean(Key.isGlobalProxy, config.isGlobalProxy) edit.putBoolean(Key.isGlobalProxy, config.isGlobalProxy)
edit.putBoolean(Key.isGFWList, config.isGFWList) edit.putBoolean(Key.isGFWList, config.isGFWList)
edit.putBoolean(Key.isBypassApps, config.isBypassApps) edit.putBoolean(Key.isBypassApps, config.isBypassApps)
edit.putBoolean(Key.isDNSProxy, config.isDNSProxy)
edit.putBoolean(Key.isHTTPProxy, config.isHTTPProxy)
edit.putString(Key.proxy, config.proxy) edit.putString(Key.proxy, config.proxy)
edit.putString(Key.sitekey, config.sitekey) edit.putString(Key.sitekey, config.sitekey)
...@@ -120,24 +114,20 @@ object Extra { ...@@ -120,24 +114,20 @@ object Extra {
val isGlobalProxy = intent.getBooleanExtra(Key.isGlobalProxy, false) val isGlobalProxy = intent.getBooleanExtra(Key.isGlobalProxy, false)
val isGFWList = intent.getBooleanExtra(Key.isGFWList, false) val isGFWList = intent.getBooleanExtra(Key.isGFWList, false)
val isBypassApps = intent.getBooleanExtra(Key.isBypassApps, false) val isBypassApps = intent.getBooleanExtra(Key.isBypassApps, false)
val isDNSProxy = intent.getBooleanExtra(Key.isDNSProxy, false)
val isHTTPProxy = intent.getBooleanExtra(Key.isHTTPProxy, false)
val proxy = intent.getStringExtra(Key.proxy) val proxy = intent.getStringExtra(Key.proxy)
val sitekey = intent.getStringExtra(Key.sitekey) val sitekey = intent.getStringExtra(Key.sitekey)
val encMethod = intent.getStringExtra(Key.encMethod) val encMethod = intent.getStringExtra(Key.encMethod)
val remotePort = intent.getIntExtra(Key.remotePort, 1984) val remotePort = intent.getIntExtra(Key.remotePort, 1984)
val localPort = intent.getIntExtra(Key.localPort, 1984) val localPort = intent.getIntExtra(Key.localPort, 1984)
new Config(isGlobalProxy, isGFWList, isBypassApps, isDNSProxy, new Config(isGlobalProxy, isGFWList, isBypassApps,
isHTTPProxy, proxy, sitekey, encMethod, remotePort, localPort) proxy, sitekey, encMethod, remotePort, localPort)
} }
def put(settings: SharedPreferences, intent: Intent) { def put(settings: SharedPreferences, intent: Intent) {
val isGlobalProxy = settings.getBoolean(Key.isGlobalProxy, false) val isGlobalProxy = settings.getBoolean(Key.isGlobalProxy, false)
val isGFWList = settings.getBoolean(Key.isGFWList, false) val isGFWList = settings.getBoolean(Key.isGFWList, false)
val isBypassApps = settings.getBoolean(Key.isBypassApps, false) val isBypassApps = settings.getBoolean(Key.isBypassApps, false)
val isDNSProxy = settings.getBoolean(Key.isDNSProxy, false)
val isHTTPProxy = settings.getBoolean(Key.isHTTPProxy, false)
val proxy = settings.getString(Key.proxy, "127.0.0.1") match { val proxy = settings.getString(Key.proxy, "127.0.0.1") match {
case "198.199.101.152" => "s.maxcdn.info" case "198.199.101.152" => "s.maxcdn.info"
case s: String => s case s: String => s
...@@ -153,8 +143,7 @@ object Extra { ...@@ -153,8 +143,7 @@ object Extra {
} }
} }
val localProt: Int = try { val localProt: Int = try {
val p = Integer.valueOf(settings.getString(Key.localPort, "1984")) Integer.valueOf(settings.getString(Key.localPort, "1984"))
if (isHTTPProxy) p - 1 else p
} catch { } catch {
case ex: NumberFormatException => { case ex: NumberFormatException => {
1984 1984
...@@ -164,8 +153,6 @@ object Extra { ...@@ -164,8 +153,6 @@ object Extra {
intent.putExtra(Key.isGlobalProxy, isGlobalProxy) intent.putExtra(Key.isGlobalProxy, isGlobalProxy)
intent.putExtra(Key.isGFWList, isGFWList) intent.putExtra(Key.isGFWList, isGFWList)
intent.putExtra(Key.isBypassApps, isBypassApps) intent.putExtra(Key.isBypassApps, isBypassApps)
intent.putExtra(Key.isDNSProxy, isDNSProxy)
intent.putExtra(Key.isHTTPProxy, isHTTPProxy)
intent.putExtra(Key.proxy, proxy) intent.putExtra(Key.proxy, proxy)
intent.putExtra(Key.sitekey, sitekey) intent.putExtra(Key.sitekey, sitekey)
......
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