Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2f02994f8 | ||
|
|
54247d6b2b | ||
|
|
e7fbfd668d | ||
|
|
b6d0af1ec3 | ||
|
|
f58301b80b | ||
|
|
792870b289 | ||
|
|
3b6eff6d9d |
@@ -1,7 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools" package="com.github.shadowsocks"
|
||||
android:versionCode="160"
|
||||
android:versionName="3.2.0">
|
||||
android:versionCode="162"
|
||||
android:versionName="3.2.2">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
|
||||
@@ -8213,6 +8213,7 @@
|
||||
.*\.eu
|
||||
.*\.ru
|
||||
.*\.au
|
||||
.*\.google\.cn
|
||||
.*\.google\.com
|
||||
.*\.google\.ad
|
||||
.*\.google\.ae
|
||||
|
||||
@@ -8227,6 +8227,7 @@
|
||||
.*\.eu
|
||||
.*\.ru
|
||||
.*\.au
|
||||
.*\.google\.cn
|
||||
.*\.google\.com
|
||||
.*\.google\.ad
|
||||
.*\.google\.ae
|
||||
|
||||
@@ -3795,6 +3795,7 @@
|
||||
.*\.eu
|
||||
.*\.ru
|
||||
.*\.au
|
||||
.*\.google\.cn
|
||||
.*\.google\.com
|
||||
.*\.google\.ad
|
||||
.*\.google\.ae
|
||||
|
||||
@@ -116,6 +116,5 @@
|
||||
<item>196.0.0.0/6</item>
|
||||
<item>200.0.0.0/5</item>
|
||||
<item>208.0.0.0/4</item>
|
||||
<item>224.0.0.0/3</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
||||
@@ -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>
|
||||
@@ -298,4 +298,16 @@ trait BaseService extends Service {
|
||||
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"
|
||||
, "-t" , "10"
|
||||
, "-b" , "127.0.0.1"
|
||||
, "-L" , "8.8.8.8:53"
|
||||
, "-l" , (profile.localPort + 53).toString
|
||||
, "-P" , getApplicationInfo.dataDir
|
||||
, "-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 (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
|
||||
@@ -178,18 +183,22 @@ class ShadowsocksNatService extends BaseService {
|
||||
|
||||
def startDnsDaemon() {
|
||||
|
||||
val reject = if (profile.ipv6) "224.0.0.0/3" else "224.0.0.0/3, ::/0"
|
||||
|
||||
val conf = profile.route match {
|
||||
case Route.BYPASS_CHN | Route.BYPASS_LAN_CHN | Route.GFWLIST => {
|
||||
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
|
||||
"127.0.0.1", profile.localPort + 53, "1.2.4.8, 114.114.114.114", "", profile.localPort + 63, "")
|
||||
"127.0.0.1", profile.localPort + 53, "1.2.4.8, 114.114.114.114",
|
||||
getBlackList, reject, profile.localPort + 63, reject)
|
||||
}
|
||||
case Route.CHINALIST => {
|
||||
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
|
||||
"127.0.0.1", profile.localPort + 53, "8.8.8.8, 208.67.222.222", "", profile.localPort + 63, "")
|
||||
"127.0.0.1", profile.localPort + 53, "8.8.8.8, 208.67.222.222",
|
||||
"", reject, profile.localPort + 63, reject)
|
||||
}
|
||||
case _ => {
|
||||
ConfigUtils.PDNSD_LOCAL.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
|
||||
"127.0.0.1", profile.localPort + 53, profile.localPort + 63, "")
|
||||
"127.0.0.1", profile.localPort + 53, profile.localPort + 63, reject)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -284,10 +284,15 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
||||
, "-V"
|
||||
, "-t", "10"
|
||||
, "-b", "127.0.0.1"
|
||||
, "-L", "8.8.8.8:53"
|
||||
, "-P", getApplicationInfo.dataDir
|
||||
, "-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 (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
|
||||
@@ -296,19 +301,21 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
||||
}
|
||||
|
||||
def startDnsDaemon() {
|
||||
val ipv6 = if (profile.ipv6) "" else "reject = ::/0;"
|
||||
val reject = if (profile.ipv6) "224.0.0.0/3" else "224.0.0.0/3, ::/0"
|
||||
val conf = profile.route match {
|
||||
case Route.BYPASS_CHN | Route.BYPASS_LAN_CHN | Route.GFWLIST => {
|
||||
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
|
||||
"0.0.0.0", profile.localPort + 53, "1.2.4.8, 114.114.114.114", ipv6, profile.localPort + 63, ipv6)
|
||||
"0.0.0.0", profile.localPort + 53, "114.114.114.114, 119.29.29.29, 1.2.4.8",
|
||||
getBlackList, reject, profile.localPort + 63, reject)
|
||||
}
|
||||
case Route.CHINALIST => {
|
||||
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
|
||||
"0.0.0.0", profile.localPort + 53, "8.8.8.8, 208.67.222.222", ipv6, profile.localPort + 63, ipv6)
|
||||
"0.0.0.0", profile.localPort + 53, "8.8.8.8, 8.8.4.4, 208.67.222.222",
|
||||
"", reject, profile.localPort + 63, reject)
|
||||
}
|
||||
case _ => {
|
||||
ConfigUtils.PDNSD_LOCAL.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
|
||||
"0.0.0.0", profile.localPort + 53, profile.localPort + 63, ipv6)
|
||||
"0.0.0.0", profile.localPort + 53, profile.localPort + 63, reject)
|
||||
}
|
||||
}
|
||||
Utils.printToFile(new File(getApplicationInfo.dataDir + "/pdnsd-vpn.conf"))(p => {
|
||||
|
||||
@@ -83,7 +83,7 @@ object ConfigUtils {
|
||||
| label = "local";
|
||||
| ip = 127.0.0.1;
|
||||
| port = %d;
|
||||
| %s
|
||||
| reject = %s;
|
||||
| reject_policy = negate;
|
||||
| reject_recursively = on;
|
||||
|}
|
||||
@@ -118,7 +118,9 @@ object ConfigUtils {
|
||||
| timeout = 3;
|
||||
| query_method = udp_only;
|
||||
| %s
|
||||
| reject_policy = negate;
|
||||
| policy = included;
|
||||
| reject = %s;
|
||||
| reject_policy = fail;
|
||||
| reject_recursively = on;
|
||||
|}
|
||||
|
|
||||
@@ -127,7 +129,7 @@ object ConfigUtils {
|
||||
| ip = 127.0.0.1;
|
||||
| query_method = tcp_only;
|
||||
| port = %d;
|
||||
| %s
|
||||
| reject = %s;
|
||||
| reject_policy = negate;
|
||||
| reject_recursively = on;
|
||||
|}
|
||||
|
||||
@@ -4,12 +4,37 @@ import android.content.Context
|
||||
import android.content.res.TypedArray
|
||||
import android.support.v7.preference.DialogPreference
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.view.ViewGroup.LayoutParams
|
||||
import android.widget.NumberPicker
|
||||
import android.widget.EditText
|
||||
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)
|
||||
extends DialogPreference(context, attrs) with SummaryPreference {
|
||||
private[preference] val picker = new NumberPicker(context)
|
||||
private[preference] val picker = new MyNumberPicker(context)
|
||||
private var value: Int = _
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user