Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55f25d3272 | ||
|
|
93273cbc44 | ||
|
|
c0514ee169 | ||
|
|
06d736b22d | ||
|
|
e34d5675eb | ||
|
|
94c7ffb788 | ||
|
|
0647ef4c6d |
@@ -4,7 +4,7 @@ import android.Dependencies.{apklib,aar}
|
||||
|
||||
android.Plugin.androidBuild
|
||||
|
||||
platformTarget in Android := "android-19"
|
||||
platformTarget in Android := "android-21"
|
||||
|
||||
name := "shadowsocks"
|
||||
|
||||
|
||||
+1
-1
Submodule jni/shadowsocks updated: 06f1a57c9b...5d7dd372fc
@@ -1,7 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.github.shadowsocks"
|
||||
android:versionCode="72"
|
||||
android:versionName="2.2.4">
|
||||
android:versionCode="75"
|
||||
android:versionName="2.3.0">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="16"
|
||||
android:targetSdkVersion="19"/>
|
||||
android:targetSdkVersion="21"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
||||
@@ -755,7 +755,6 @@ class Shadowsocks
|
||||
}
|
||||
|
||||
private def setPreferenceEnabled(enabled: Boolean) {
|
||||
val isRoot = status.getBoolean(Key.isRoot, false)
|
||||
for (name <- Shadowsocks.PROXY_PREFS) {
|
||||
val pref = findPreference(name)
|
||||
if (pref != null) {
|
||||
@@ -767,7 +766,7 @@ class Shadowsocks
|
||||
if (pref != null) {
|
||||
if (Seq(Key.isGlobalProxy, Key.isTrafficStat, Key.proxyedApps)
|
||||
.contains(name)) {
|
||||
pref.setEnabled(enabled && isRoot)
|
||||
pref.setEnabled(enabled && !isVpnEnabled)
|
||||
} else {
|
||||
pref.setEnabled(enabled)
|
||||
}
|
||||
@@ -827,10 +826,6 @@ class Shadowsocks
|
||||
|
||||
copyAssets(System.getABI)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 20) {
|
||||
copyToSystem()
|
||||
}
|
||||
|
||||
val ab = new ArrayBuffer[String]
|
||||
for (executable <- Shadowsocks.EXECUTABLES) {
|
||||
ab.append("chmod 755 " + Path.BASE + executable)
|
||||
@@ -879,8 +874,8 @@ class Shadowsocks
|
||||
|
||||
def isVpnEnabled: Boolean = {
|
||||
if (vpnEnabled < 0) {
|
||||
vpnEnabled = if (Build.VERSION.SDK_INT
|
||||
>= Build.VERSION_CODES.ICE_CREAM_SANDWICH && !status.getBoolean(Key.isRoot, false)) {
|
||||
vpnEnabled = if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP
|
||||
|| !status.getBoolean(Key.isRoot, false)) {
|
||||
1
|
||||
} else {
|
||||
0
|
||||
|
||||
@@ -114,49 +114,52 @@ class ShadowsocksNatService extends Service with BaseService {
|
||||
})
|
||||
}
|
||||
|
||||
val raw_args = ("ss-local -b 127.0.0.1 -s %s -p %d -l %d -k %s -m %s -f " +
|
||||
Path.BASE + "ss-local.pid")
|
||||
.format(config.proxy, config.remotePort, config.localPort, config.sitekey, config.encMethod)
|
||||
val args = if (Build.VERSION.SDK_INT >= 20) {
|
||||
raw_args
|
||||
} else {
|
||||
Path.BASE + raw_args
|
||||
}
|
||||
val cmd = if (config.isGFWList && isACLEnabled) args + " --acl " + Path.BASE + "chn.acl" else args
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, cmd)
|
||||
val cmd = new ArrayBuffer[String]
|
||||
cmd += ("ss-local"
|
||||
, "-b" , "127.0.0.1"
|
||||
, "-s" , config.proxy
|
||||
, "-p" , config.remotePort.toString
|
||||
, "-l" , config.localPort.toString
|
||||
, "-k" , config.sitekey
|
||||
, "-m" , config.encMethod
|
||||
, "-f" , (Path.BASE + "ss-local.pid"))
|
||||
|
||||
Core.sslocal(cmd.split(" "))
|
||||
if (config.isGFWList && isACLEnabled) {
|
||||
cmd += "--acl"
|
||||
cmd += (Path.BASE + "chn.acl")
|
||||
}
|
||||
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
|
||||
|
||||
Core.sslocal(cmd.toArray)
|
||||
}
|
||||
|
||||
def startDnsDaemon() {
|
||||
val args = if (config.isUdpDns) {
|
||||
("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 " +
|
||||
Path.BASE + "ss-tunnel.pid")
|
||||
.format(config.proxy, config.remotePort, 8153, config.sitekey, config.encMethod)
|
||||
if (config.isUdpDns) {
|
||||
val cmd = new ArrayBuffer[String]
|
||||
cmd += ("ss-tunnel" , "-u"
|
||||
, "-b" , "127.0.0.1"
|
||||
, "-l" , "8153"
|
||||
, "-L" , "8.8.8.8:53"
|
||||
, "-s" , config.proxy
|
||||
, "-p" , config.remotePort.toString
|
||||
, "-k" , config.sitekey
|
||||
, "-m" , config.encMethod
|
||||
, "-f" , (Path.BASE + "ss-tunnel.pid"))
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
|
||||
Core.sstunnel(cmd.toArray)
|
||||
} else {
|
||||
val conf = {
|
||||
if (config.isGFWList)
|
||||
ConfigUtils.PDNSD_BYPASS.format("127.0.0.1", getString(R.string.exclude))
|
||||
else
|
||||
ConfigUtils.PDNSD.format("127.0.0.1")
|
||||
ConfigUtils.PDNSD.format("127.0.0.1")
|
||||
}
|
||||
ConfigUtils.printToFile(new File(Path.BASE + "pdnsd.conf"))(p => {
|
||||
p.println(conf)
|
||||
})
|
||||
"pdnsd -c " + Path.BASE + "pdnsd.conf"
|
||||
}
|
||||
|
||||
val cmd = if (Build.VERSION.SDK_INT >= 20) {
|
||||
"/system/bin/" + args
|
||||
} else {
|
||||
Path.BASE + args
|
||||
}
|
||||
val args = "pdnsd -c " + Path.BASE + "pdnsd.conf"
|
||||
val cmd = Path.BASE + args
|
||||
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, cmd)
|
||||
|
||||
if (config.isUdpDns) {
|
||||
Core.sstunnel(cmd.split(" "))
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, cmd)
|
||||
Console.runRootCommand(cmd)
|
||||
}
|
||||
}
|
||||
@@ -180,11 +183,7 @@ class ShadowsocksNatService extends Service with BaseService {
|
||||
ConfigUtils.printToFile(new File(Path.BASE + "redsocks.conf"))(p => {
|
||||
p.println(conf)
|
||||
})
|
||||
val cmd = if (Build.VERSION.SDK_INT >= 20) {
|
||||
"/system/bin/" + args
|
||||
} else {
|
||||
Path.BASE + args
|
||||
}
|
||||
val cmd = Path.BASE + args
|
||||
Console.runRootCommand(cmd)
|
||||
}
|
||||
|
||||
@@ -225,10 +224,6 @@ class ShadowsocksNatService extends Service with BaseService {
|
||||
|
||||
val icon = getResources.getDrawable(R.drawable.ic_stat_shadowsocks)
|
||||
if (rate >= 0) {
|
||||
val bitmap = Utils
|
||||
.getBitmap(rate.toString, icon.getIntrinsicWidth * 4, icon.getIntrinsicHeight * 4,
|
||||
Color.TRANSPARENT)
|
||||
builder.setLargeIcon(bitmap)
|
||||
|
||||
if (rate < 1000) {
|
||||
builder.setSmallIcon(R.drawable.ic_stat_speed, rate)
|
||||
@@ -327,10 +322,6 @@ class ShadowsocksNatService extends Service with BaseService {
|
||||
init_sb.append(cmd_bypass.replace("-d 0.0.0.0", "-m owner --uid-owner " + myUid))
|
||||
|
||||
if (config.isGFWList) {
|
||||
// Bypass DNS in China
|
||||
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 (!isACLEnabled)
|
||||
{
|
||||
val chn_list: Array[String] = getResources.getStringArray(R.array.chn_list)
|
||||
|
||||
@@ -76,24 +76,26 @@ 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)
|
||||
}
|
||||
|
||||
def startShadowsocksDaemon() {
|
||||
val cmd: String = (Path.BASE +
|
||||
"ss-local -b 127.0.0.1 -s %s -p %d -l %d -k %s -m %s -u -f " +
|
||||
Path.BASE + "ss-local.pid")
|
||||
.format(config.proxy, config.remotePort, config.localPort, config.sitekey, config.encMethod)
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, cmd)
|
||||
Core.sslocal(cmd.split(" "))
|
||||
val cmd = new ArrayBuffer[String]
|
||||
cmd += ("ss-local" , "-u"
|
||||
, "-b" , "127.0.0.1"
|
||||
, "-s" , config.proxy
|
||||
, "-p" , config.remotePort.toString
|
||||
, "-l" , config.localPort.toString
|
||||
, "-k" , config.sitekey
|
||||
, "-m" , config.encMethod
|
||||
, "-f" , (Path.BASE + "ss-local.pid"))
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
|
||||
Core.sslocal(cmd.toArray)
|
||||
}
|
||||
|
||||
def startDnsDaemon() {
|
||||
val conf = {
|
||||
if (config.isGFWList)
|
||||
ConfigUtils.PDNSD_BYPASS.format("0.0.0.0", getString(R.string.exclude))
|
||||
else
|
||||
ConfigUtils.PDNSD.format("0.0.0.0")
|
||||
ConfigUtils.PDNSD.format("0.0.0.0")
|
||||
}
|
||||
ConfigUtils.printToFile(new File(Path.BASE + "pdnsd.conf"))(p => {
|
||||
p.println(conf)
|
||||
@@ -142,7 +144,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
for (i <- 1 to 254) {
|
||||
for (i <- 1 to 223) {
|
||||
if (i != 26 && i != 127) {
|
||||
val addr = i.toString + ".0.0.0"
|
||||
val cidr = addr + "/8"
|
||||
|
||||
Reference in New Issue
Block a user