Commit 2cb1eb27 authored by Max Lv's avatar Max Lv

add upd dns mode

parent a029f276
...@@ -5,7 +5,7 @@ ndk-build ...@@ -5,7 +5,7 @@ ndk-build
mkdir -p assets/armeabi mkdir -p assets/armeabi
mkdir -p assets/armeabi-v7a mkdir -p assets/armeabi-v7a
mkdir -p assets/x86 mkdir -p assets/x86
for app in iptables pdnsd redsocks shadowsocks tun2socks for app in iptables pdnsd redsocks ss-local ss-tunnel tun2socks
do do
mv libs/armeabi/$app assets/armeabi/ mv libs/armeabi/$app assets/armeabi/
mv libs/armeabi-v7a/$app assets/armeabi-v7a/ mv libs/armeabi-v7a/$app assets/armeabi-v7a/
......
...@@ -5,8 +5,8 @@ import sbtandroid._ ...@@ -5,8 +5,8 @@ import sbtandroid._
import sbtandroid.AndroidPlugin._ import sbtandroid.AndroidPlugin._
object App { object App {
val version = "2.1.1" val version = "2.1.2"
val versionCode = 62 val versionCode = 63
} }
object General { object General {
......
...@@ -274,7 +274,7 @@ img { ...@@ -274,7 +274,7 @@ img {
</head> </head>
<body> <body>
<p>A <a href="http://shadowsocks.org">Shadowsocks</a> client for Android, written in Scala.</p> <p>A <a href="http://shadowsocks.org">Shadowsocks</a> client for Android, written in Scala.</p>
<p>Copyright (C) 2013 Max Lv <a href="&#x6d;&#97;&#x69;&#108;&#116;&#111;&#x3a;&#x6d;&#97;x&#46;&#99;.&#108;&#118;&#x40;&#103;&#109;&#97;&#x69;&#108;&#46;&#x63;&#x6f;&#109;">&#x6d;&#97;&#x78;.&#x63;&#x2e;&#108;v&#64;&#x67;&#109;&#x61;&#x69;&#108;&#x2e;&#99;&#111;&#109;</a></p> <p>Copyright (C) 2014 Max Lv <a href="&#x6d;&#97;&#x69;&#108;&#116;&#111;&#x3a;&#x6d;&#97;x&#46;&#99;.&#108;&#118;&#x40;&#103;&#109;&#97;&#x69;&#108;&#46;&#x63;&#x6f;&#109;">&#x6d;&#97;&#x78;.&#x63;&#x2e;&#108;v&#64;&#x67;&#109;&#x61;&#x69;&#108;&#x2e;&#99;&#111;&#109;</a></p>
<p>This program is free software: you can redistribute it and/or modify <p>This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
......
...@@ -89,14 +89,14 @@ LOCAL_CFLAGS := -Wall -O2 -I$(LOCAL_PATH)/pdnsd ...@@ -89,14 +89,14 @@ LOCAL_CFLAGS := -Wall -O2 -I$(LOCAL_PATH)/pdnsd
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)
######################################################## ########################################################
## shadowsocks ## shadowsocks local
######################################################## ########################################################
include $(CLEAR_VARS) include $(CLEAR_VARS)
SHADOWSOCKS_SOURCES := local.c cache.c udprelay.c encrypt.c utils.c json.c jconf.c SHADOWSOCKS_SOURCES := local.c cache.c udprelay.c encrypt.c utils.c json.c jconf.c
LOCAL_MODULE := shadowsocks LOCAL_MODULE := ss-local
LOCAL_SRC_FILES := $(addprefix shadowsocks/src/, $(SHADOWSOCKS_SOURCES)) LOCAL_SRC_FILES := $(addprefix shadowsocks/src/, $(SHADOWSOCKS_SOURCES))
LOCAL_CFLAGS := -Wall -O2 -fno-strict-aliasing -DUDPRELAY_LOCAL \ LOCAL_CFLAGS := -Wall -O2 -fno-strict-aliasing -DUDPRELAY_LOCAL \
-DUSE_CRYPTO_OPENSSL -DANDROID -DHAVE_CONFIG_H \ -DUSE_CRYPTO_OPENSSL -DANDROID -DHAVE_CONFIG_H \
...@@ -109,6 +109,27 @@ LOCAL_LDLIBS := -llog ...@@ -109,6 +109,27 @@ LOCAL_LDLIBS := -llog
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)
########################################################
## shadowsocks tunnel
########################################################
include $(CLEAR_VARS)
SHADOWSOCKS_SOURCES := tunnel.c cache.c udprelay.c encrypt.c utils.c json.c jconf.c
LOCAL_MODULE := ss-tunnel
LOCAL_SRC_FILES := $(addprefix shadowsocks/src/, $(SHADOWSOCKS_SOURCES))
LOCAL_CFLAGS := -Wall -O2 -fno-strict-aliasing -DUDPRELAY_LOCAL -DUDPRELAY_TUNNEL \
-DUSE_CRYPTO_OPENSSL -DANDROID -DHAVE_CONFIG_H \
-I$(LOCAL_PATH)/libev/ \
-I$(LOCAL_PATH)/openssl/include
LOCAL_STATIC_LIBRARIES := libev libcrypto
LOCAL_LDLIBS := -llog
include $(BUILD_EXECUTABLE)
######################################################## ########################################################
## termExec ## termExec
######################################################## ########################################################
......
Subproject commit 69f8bd61c096337abb34a9e64534865d08022957 Subproject commit b2df5a4c26d293469237fd89153e16f1fa47000c
...@@ -417,10 +417,12 @@ class Shadowsocks ...@@ -417,10 +417,12 @@ class Shadowsocks
val sb = new StringBuilder val sb = new StringBuilder
sb.append("kill -9 `cat /data/data/com.github.shadowsocks/pdnsd.pid`").append("\n") sb.append("kill -9 `cat /data/data/com.github.shadowsocks/pdnsd.pid`").append("\n")
sb.append("kill -9 `cat /data/data/com.github.shadowsocks/shadowsocks.pid`").append("\n") sb.append("kill -9 `cat /data/data/com.github.shadowsocks/ss-local.pid`").append("\n")
sb.append("kill -9 `cat /data/data/com.github.shadowsocks/ss-tunnel.pid`").append("\n")
sb.append("kill -9 `cat /data/data/com.github.shadowsocks/tun2socks.pid`").append("\n") sb.append("kill -9 `cat /data/data/com.github.shadowsocks/tun2socks.pid`").append("\n")
sb.append("killall -9 pdnsd").append("\n") sb.append("killall -9 pdnsd").append("\n")
sb.append("killall -9 shadowsocks").append("\n") sb.append("killall -9 ss-local").append("\n")
sb.append("killall -9 ss-tunnel").append("\n")
sb.append("killall -9 tun2socks").append("\n") sb.append("killall -9 tun2socks").append("\n")
sb.append("rm /data/data/com.github.shadowsocks/pdnsd.conf").append("\n") sb.append("rm /data/data/com.github.shadowsocks/pdnsd.conf").append("\n")
sb.append("rm /data/data/com.github.shadowsocks/pdnsd.cache").append("\n") sb.append("rm /data/data/com.github.shadowsocks/pdnsd.cache").append("\n")
...@@ -908,7 +910,8 @@ class Shadowsocks ...@@ -908,7 +910,8 @@ class Shadowsocks
Utils.runCommand("chmod 755 /data/data/com.github.shadowsocks/iptables\n" Utils.runCommand("chmod 755 /data/data/com.github.shadowsocks/iptables\n"
+ "chmod 755 /data/data/com.github.shadowsocks/redsocks\n" + "chmod 755 /data/data/com.github.shadowsocks/redsocks\n"
+ "chmod 755 /data/data/com.github.shadowsocks/pdnsd\n" + "chmod 755 /data/data/com.github.shadowsocks/pdnsd\n"
+ "chmod 755 /data/data/com.github.shadowsocks/shadowsocks\n" + "chmod 755 /data/data/com.github.shadowsocks/ss-local\n"
+ "chmod 755 /data/data/com.github.shadowsocks/ss-tunnel\n"
+ "chmod 755 /data/data/com.github.shadowsocks/tun2socks\n") + "chmod 755 /data/data/com.github.shadowsocks/tun2socks\n")
} }
......
...@@ -102,20 +102,24 @@ class ShadowsocksNatService extends Service with BaseService { ...@@ -102,20 +102,24 @@ class ShadowsocksNatService extends Service with BaseService {
val handler: Handler = new Handler() val handler: Handler = new Handler()
def startShadowsocksDaemon() { def startShadowsocksDaemon() {
val cmd: String = (Path.BASE + val cmd = (Path.BASE +
"shadowsocks -b 127.0.0.1 -s \"%s\" -p \"%d\" -l \"%d\" -k \"%s\" -m \"%s\" -f " + "ss-local -b 127.0.0.1 -s \"%s\" -p \"%d\" -l \"%d\" -k \"%s\" -m \"%s\" -f " +
Path.BASE + "shadowsocks.pid") Path.BASE + "ss-local.pid")
.format(config.proxy, config.remotePort, config.localPort, config.sitekey, config.encMethod) .format(config.proxy, config.remotePort, config.localPort, config.sitekey, config.encMethod)
if (BuildConfig.DEBUG) Log.d(TAG, cmd) if (BuildConfig.DEBUG) Log.d(TAG, cmd)
Utils.runCommand(cmd) Utils.runCommand(cmd)
} }
def startDnsDaemon() { def startDnsDaemon() {
val cmd: String = Path.BASE + "pdnsd -c " + Path.BASE + "pdnsd.conf" val cmd = (Path.BASE +
val conf: String = ConfigUtils.PDNSD.format("127.0.0.1") "ss-tunnel -b 127.0.0.1 -s \"%s\" -p \"%d\" -l \"%d\" -k \"%s\" -m \"%s\" -L 8.8.8.8:53 -u -f " +
ConfigUtils.printToFile(new File(Path.BASE + "pdnsd.conf"))(p => { Path.BASE + "ss-local.pid")
p.println(conf) .format(config.proxy, config.remotePort, 8153, config.sitekey, config.encMethod)
}) // val cmd = Path.BASE + "pdnsd -c " + Path.BASE + "pdnsd.conf"
// val conf = ConfigUtils.PDNSD.format("127.0.0.1")
// ConfigUtils.printToFile(new File(Path.BASE + "pdnsd.conf"))(p => {
// p.println(conf)
// })
Utils.runCommand(cmd) Utils.runCommand(cmd)
} }
...@@ -271,8 +275,10 @@ class ShadowsocksNatService extends Service with BaseService { ...@@ -271,8 +275,10 @@ class ShadowsocksNatService extends Service with BaseService {
sb ++= "kill -9 `cat " ++= Path.BASE ++= "pdnsd.pid`" ++= "\n" sb ++= "kill -9 `cat " ++= Path.BASE ++= "pdnsd.pid`" ++= "\n"
sb ++= "killall -9 pdnsd" ++= "\n" sb ++= "killall -9 pdnsd" ++= "\n"
sb ++= "kill -9 `cat " ++= Path.BASE ++= "shadowsocks.pid`" ++= "\n" sb ++= "kill -9 `cat " ++= Path.BASE ++= "ss-local.pid`" ++= "\n"
sb ++= "killall -9 shadowsocks" ++= "\n" sb ++= "killall -9 ss-local" ++= "\n"
sb ++= "kill -9 `cat " ++= Path.BASE ++= "ss-tunnel.pid`" ++= "\n"
sb ++= "killall -9 ss-tunnel" ++= "\n"
Utils.runCommand(sb.toString()) Utils.runCommand(sb.toString())
} }
......
...@@ -84,11 +84,15 @@ class ShadowsocksVpnService extends VpnService with BaseService { ...@@ -84,11 +84,15 @@ class ShadowsocksVpnService extends VpnService with BaseService {
} }
def startDnsDaemon() { def startDnsDaemon() {
val cmd: String = Path.BASE + "pdnsd -c " + Path.BASE + "pdnsd.conf" val cmd = (Path.BASE +
val conf: String = ConfigUtils.PDNSD.format("0.0.0.0") "ss-tunnel -b 127.0.0.1 -s \"%s\" -p \"%d\" -l \"%d\" -k \"%s\" -m \"%s\" -L 8.8.8.8:53 -u -f " +
ConfigUtils.printToFile(new File(Path.BASE + "pdnsd.conf"))(p => { Path.BASE + "ss-local.pid")
p.println(conf) .format(config.proxy, config.remotePort, 8153, config.sitekey, config.encMethod)
}) // val cmd: String = Path.BASE + "pdnsd -c " + Path.BASE + "pdnsd.conf"
// val conf: String = ConfigUtils.PDNSD.format("0.0.0.0")
// ConfigUtils.printToFile(new File(Path.BASE + "pdnsd.conf"))(p => {
// p.println(conf)
// })
Utils.runCommand(cmd) Utils.runCommand(cmd)
} }
...@@ -243,12 +247,14 @@ class ShadowsocksVpnService extends VpnService with BaseService { ...@@ -243,12 +247,14 @@ class ShadowsocksVpnService extends VpnService with BaseService {
def killProcesses() { def killProcesses() {
val sb = new StringBuilder val sb = new StringBuilder
sb ++= "kill -9 `cat " ++= Path.BASE ++= "shadowsocks.pid`" ++= "\n" sb ++= "kill -9 `cat " ++= Path.BASE ++= "ss-local.pid`" ++= "\n"
sb ++= "killall -9 shadowsocks" ++= "\n" sb ++= "killall -9 ss-local" ++= "\n"
sb ++= "kill -9 `cat " ++= Path.BASE ++= "ss-tunnel.pid`" ++= "\n"
sb ++= "killall -9 ss-tunnel" ++= "\n"
sb ++= "kill -9 `cat " ++= Path.BASE ++= "tun2socks.pid`" ++= "\n" sb ++= "kill -9 `cat " ++= Path.BASE ++= "tun2socks.pid`" ++= "\n"
sb ++= "killall -9 tun2socks" ++= "\n" sb ++= "killall -9 tun2socks" ++= "\n"
sb ++= "kill -9 `cat " ++= Path.BASE ++= "pdnsd.pid`" ++= "\n" // sb ++= "kill -9 `cat " ++= Path.BASE ++= "pdnsd.pid`" ++= "\n"
sb ++= "killall -9 pdnsd" ++= "\n" // sb ++= "killall -9 pdnsd" ++= "\n"
Utils.runCommand(sb.toString()) Utils.runCommand(sb.toString())
} }
......
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