Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c842f7fd41 | ||
|
|
c2f02994f8 | ||
|
|
54247d6b2b | ||
|
|
e7fbfd668d | ||
|
|
b6d0af1ec3 | ||
|
|
f58301b80b |
@@ -1,7 +1,7 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools" package="com.github.shadowsocks"
|
xmlns:tools="http://schemas.android.com/tools" package="com.github.shadowsocks"
|
||||||
android:versionCode="161"
|
android:versionCode="163"
|
||||||
android:versionName="3.2.1">
|
android:versionName="3.2.3">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
|
|||||||
+1
-1
Submodule src/main/jni/pdnsd updated: eb5c47e5bd...960c1c6469
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="black_list" translatable="false">".appspot.com",".blogspot.com",".blogspot.kr",".blogspot.sg",".cdninstagram.com",".connect.facebook.net",".facebook.br",".facebook.com",".facebook.hu",".facebook.nl",".facebook.se",".fbcdn.net",".google.co.kr",".google.com",".google.com",".google.com.hk",".google.com.sg",".google.com.tw",".googleapis.com",".googleapps.com",".googleartproject.com",".googleblog.com",".googlecode.com",".googlecommerce.com",".googledomains.com",".googledrive.com",".googleearth.com",".googlegroups.com",".googlehosted.com",".googleideas.com",".googlelabs.com",".googlemail.com",".googleplay.com",".googleplus.com",".googlesile.com",".googlesource.com",".googleusercontent.com",".googlevideo.com",".googlezip.net",".gstatic.com",".yahoo.com",".igoogle.com",".instagram.com",".institut-tibetain.org",".nic.google",".registry.google",".thinkwithgoogle.com",".withgoogle.com",".youtube-nocookie.com",".youtube.com",".gvt1.com",".gvt2.com",".gvt3.com",".1e100.net"</string>
|
||||||
|
</resources>
|
||||||
@@ -70,6 +70,7 @@ trait BaseService extends Service {
|
|||||||
var callbacksCount: Int = _
|
var callbacksCount: Int = _
|
||||||
lazy val handler = new Handler(getMainLooper)
|
lazy val handler = new Handler(getMainLooper)
|
||||||
lazy val restartHanlder = new Handler(getMainLooper)
|
lazy val restartHanlder = new Handler(getMainLooper)
|
||||||
|
lazy val protectPath = getApplicationInfo.dataDir + "/protect_path"
|
||||||
|
|
||||||
private val closeReceiver: BroadcastReceiver = (context: Context, intent: Intent) => {
|
private val closeReceiver: BroadcastReceiver = (context: Context, intent: Intent) => {
|
||||||
Toast.makeText(context, R.string.stopping, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, R.string.stopping, Toast.LENGTH_SHORT).show()
|
||||||
@@ -298,4 +299,16 @@ trait BaseService extends Service {
|
|||||||
state = s
|
state = s
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def getBlackList = {
|
||||||
|
val default = getString(R.string.black_list)
|
||||||
|
try {
|
||||||
|
val container = app.containerHolder.getContainer
|
||||||
|
val update = container.getString("black_list_lite")
|
||||||
|
val list = if (update == null || update.isEmpty) default else update
|
||||||
|
"exclude = " + list + ";"
|
||||||
|
} catch {
|
||||||
|
case ex: Exception => "exclude = " + default + ";"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,11 +136,16 @@ class ShadowsocksNatService extends BaseService {
|
|||||||
, "-u"
|
, "-u"
|
||||||
, "-t" , "10"
|
, "-t" , "10"
|
||||||
, "-b" , "127.0.0.1"
|
, "-b" , "127.0.0.1"
|
||||||
, "-L" , "8.8.8.8:53"
|
|
||||||
, "-l" , (profile.localPort + 53).toString
|
, "-l" , (profile.localPort + 53).toString
|
||||||
, "-P" , getApplicationInfo.dataDir
|
, "-P" , getApplicationInfo.dataDir
|
||||||
, "-c" , getApplicationInfo.dataDir + "/ss-tunnel-nat.conf")
|
, "-c" , getApplicationInfo.dataDir + "/ss-tunnel-nat.conf")
|
||||||
|
|
||||||
|
cmd += "-L"
|
||||||
|
if (profile.route == Route.CHINALIST)
|
||||||
|
cmd += "114.114.114.114:53"
|
||||||
|
else
|
||||||
|
cmd += "8.8.8.8:53"
|
||||||
|
|
||||||
if (profile.auth) cmd += "-A"
|
if (profile.auth) cmd += "-A"
|
||||||
|
|
||||||
if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
|
if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
|
||||||
@@ -182,17 +187,17 @@ class ShadowsocksNatService extends BaseService {
|
|||||||
|
|
||||||
val conf = profile.route match {
|
val conf = profile.route match {
|
||||||
case Route.BYPASS_CHN | Route.BYPASS_LAN_CHN | Route.GFWLIST => {
|
case Route.BYPASS_CHN | Route.BYPASS_LAN_CHN | Route.GFWLIST => {
|
||||||
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
|
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, "", getApplicationInfo.dataDir,
|
||||||
"127.0.0.1", profile.localPort + 53, "1.2.4.8, 114.114.114.114",
|
"127.0.0.1", profile.localPort + 53, "1.2.4.8, 114.114.114.114",
|
||||||
reject, profile.localPort + 63, reject)
|
getBlackList, reject, profile.localPort + 63, reject)
|
||||||
}
|
}
|
||||||
case Route.CHINALIST => {
|
case Route.CHINALIST => {
|
||||||
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
|
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, "", getApplicationInfo.dataDir,
|
||||||
"127.0.0.1", profile.localPort + 53, "8.8.8.8, 208.67.222.222",
|
"127.0.0.1", profile.localPort + 53, "8.8.8.8, 208.67.222.222",
|
||||||
reject, profile.localPort + 63, reject)
|
"", reject, profile.localPort + 63, reject)
|
||||||
}
|
}
|
||||||
case _ => {
|
case _ => {
|
||||||
ConfigUtils.PDNSD_LOCAL.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
|
ConfigUtils.PDNSD_LOCAL.formatLocal(Locale.ENGLISH, "", getApplicationInfo.dataDir,
|
||||||
"127.0.0.1", profile.localPort + 53, profile.localPort + 63, reject)
|
"127.0.0.1", profile.localPort + 53, profile.localPort + 63, reject)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
|||||||
val cmd = ArrayBuffer(getApplicationInfo.dataDir + "/kcptun"
|
val cmd = ArrayBuffer(getApplicationInfo.dataDir + "/kcptun"
|
||||||
, "-r", profile.host + ":" + profile.kcpPort
|
, "-r", profile.host + ":" + profile.kcpPort
|
||||||
, "-l", "127.0.0.1:" + (profile.localPort + 90)
|
, "-l", "127.0.0.1:" + (profile.localPort + 90)
|
||||||
, "--path", getApplicationInfo.dataDir + "/protect_path")
|
, "--path", protectPath)
|
||||||
try cmd ++= Utils.translateCommandline(profile.kcpcli) catch {
|
try cmd ++= Utils.translateCommandline(profile.kcpcli) catch {
|
||||||
case exc: Exception => throw KcpcliParseException(exc)
|
case exc: Exception => throw KcpcliParseException(exc)
|
||||||
}
|
}
|
||||||
@@ -284,10 +284,15 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
|||||||
, "-V"
|
, "-V"
|
||||||
, "-t", "10"
|
, "-t", "10"
|
||||||
, "-b", "127.0.0.1"
|
, "-b", "127.0.0.1"
|
||||||
, "-L", "8.8.8.8:53"
|
|
||||||
, "-P", getApplicationInfo.dataDir
|
, "-P", getApplicationInfo.dataDir
|
||||||
, "-c", getApplicationInfo.dataDir + "/ss-tunnel-vpn.conf")
|
, "-c", getApplicationInfo.dataDir + "/ss-tunnel-vpn.conf")
|
||||||
|
|
||||||
|
cmd += "-L"
|
||||||
|
if (profile.route == Route.CHINALIST)
|
||||||
|
cmd += "114.114.114.114:53"
|
||||||
|
else
|
||||||
|
cmd += "8.8.8.8:53"
|
||||||
|
|
||||||
if (profile.auth) cmd += "-A"
|
if (profile.auth) cmd += "-A"
|
||||||
|
|
||||||
if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
|
if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
|
||||||
@@ -297,19 +302,20 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
|||||||
|
|
||||||
def startDnsDaemon() {
|
def startDnsDaemon() {
|
||||||
val reject = if (profile.ipv6) "224.0.0.0/3" else "224.0.0.0/3, ::/0"
|
val reject = if (profile.ipv6) "224.0.0.0/3" else "224.0.0.0/3, ::/0"
|
||||||
|
val protect = "protect = \"" + protectPath +"\";"
|
||||||
val conf = profile.route match {
|
val conf = profile.route match {
|
||||||
case Route.BYPASS_CHN | Route.BYPASS_LAN_CHN | Route.GFWLIST => {
|
case Route.BYPASS_CHN | Route.BYPASS_LAN_CHN | Route.GFWLIST => {
|
||||||
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
|
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, protect, getApplicationInfo.dataDir,
|
||||||
"0.0.0.0", profile.localPort + 53, "1.2.4.8, 114.114.114.114",
|
"0.0.0.0", profile.localPort + 53, "114.114.114.114, 119.29.29.29, 1.2.4.8",
|
||||||
reject, profile.localPort + 63, reject)
|
getBlackList, reject, profile.localPort + 63, reject)
|
||||||
}
|
}
|
||||||
case Route.CHINALIST => {
|
case Route.CHINALIST => {
|
||||||
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
|
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, protect, getApplicationInfo.dataDir,
|
||||||
"0.0.0.0", profile.localPort + 53, "8.8.8.8, 208.67.222.222",
|
"0.0.0.0", profile.localPort + 53, "8.8.8.8, 8.8.4.4, 208.67.222.222",
|
||||||
reject, profile.localPort + 63, reject)
|
"", reject, profile.localPort + 63, reject)
|
||||||
}
|
}
|
||||||
case _ => {
|
case _ => {
|
||||||
ConfigUtils.PDNSD_LOCAL.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
|
ConfigUtils.PDNSD_LOCAL.formatLocal(Locale.ENGLISH, protect, getApplicationInfo.dataDir,
|
||||||
"0.0.0.0", profile.localPort + 53, profile.localPort + 63, reject)
|
"0.0.0.0", profile.localPort + 53, profile.localPort + 63, reject)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ object ConfigUtils {
|
|||||||
"""
|
"""
|
||||||
|global {
|
|global {
|
||||||
| perm_cache = 2048;
|
| perm_cache = 2048;
|
||||||
|
| %s
|
||||||
| cache_dir = "%s";
|
| cache_dir = "%s";
|
||||||
| server_ip = %s;
|
| server_ip = %s;
|
||||||
| server_port = %d;
|
| server_port = %d;
|
||||||
@@ -101,6 +102,7 @@ object ConfigUtils {
|
|||||||
"""
|
"""
|
||||||
|global {
|
|global {
|
||||||
| perm_cache = 2048;
|
| perm_cache = 2048;
|
||||||
|
| %s
|
||||||
| cache_dir = "%s";
|
| cache_dir = "%s";
|
||||||
| server_ip = %s;
|
| server_ip = %s;
|
||||||
| server_port = %d;
|
| server_port = %d;
|
||||||
@@ -117,6 +119,8 @@ object ConfigUtils {
|
|||||||
| ip = %s;
|
| ip = %s;
|
||||||
| timeout = 3;
|
| timeout = 3;
|
||||||
| query_method = udp_only;
|
| query_method = udp_only;
|
||||||
|
| %s
|
||||||
|
| policy = included;
|
||||||
| reject = %s;
|
| reject = %s;
|
||||||
| reject_policy = fail;
|
| reject_policy = fail;
|
||||||
| reject_recursively = on;
|
| reject_recursively = on;
|
||||||
|
|||||||
@@ -4,12 +4,37 @@ import android.content.Context
|
|||||||
import android.content.res.TypedArray
|
import android.content.res.TypedArray
|
||||||
import android.support.v7.preference.DialogPreference
|
import android.support.v7.preference.DialogPreference
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup.LayoutParams
|
||||||
import android.widget.NumberPicker
|
import android.widget.NumberPicker
|
||||||
|
import android.widget.EditText
|
||||||
import com.github.shadowsocks.R
|
import com.github.shadowsocks.R
|
||||||
|
|
||||||
|
class MyNumberPicker(private val context: Context, attrs: AttributeSet = null)
|
||||||
|
extends NumberPicker(context, attrs) {
|
||||||
|
override def addView(child: View) {
|
||||||
|
super.addView(child)
|
||||||
|
updateView(child)
|
||||||
|
}
|
||||||
|
override def addView(child: View, params: LayoutParams) {
|
||||||
|
super.addView(child, params)
|
||||||
|
updateView(child)
|
||||||
|
}
|
||||||
|
override def addView(child: View, index: Int, params: LayoutParams) {
|
||||||
|
super.addView(child, index, params)
|
||||||
|
updateView(child)
|
||||||
|
}
|
||||||
|
def updateView(child: View) {
|
||||||
|
if (child.isInstanceOf[EditText]) {
|
||||||
|
child.asInstanceOf[EditText].setTextSize(dp2px(6))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
def dp2px(dp: Float): Int = (dp*getResources().getDisplayMetrics().density).toInt
|
||||||
|
}
|
||||||
|
|
||||||
class NumberPickerPreference(private val context: Context, attrs: AttributeSet = null)
|
class NumberPickerPreference(private val context: Context, attrs: AttributeSet = null)
|
||||||
extends DialogPreference(context, attrs) with SummaryPreference {
|
extends DialogPreference(context, attrs) with SummaryPreference {
|
||||||
private[preference] val picker = new NumberPicker(context)
|
private[preference] val picker = new MyNumberPicker(context)
|
||||||
private var value: Int = _
|
private var value: Int = _
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user