Compare commits

...
14 Commits
Author SHA1 Message Date
Max Lv c2f02994f8 Refine DNS server with China List 2016-10-02 19:36:53 +08:00
Max Lv 54247d6b2b Update DNS 2016-09-30 20:48:20 +08:00
Max Lv e7fbfd668d Update config name 2016-09-30 19:43:30 +08:00
Max Lv b6d0af1ec3 Fix #910 2016-09-30 19:28:03 +08:00
Max Lv f58301b80b Bump version 2016-09-30 13:49:16 +08:00
Max Lv 792870b289 Update ACL 2016-09-29 11:53:40 +08:00
Max Lv 3b6eff6d9d Fix #905 2016-09-28 14:36:36 +08:00
Max Lv 528fea136d Clean up 2016-09-28 10:40:16 +08:00
Mygod 5d7e88310b Update dependencies 2016-09-26 19:51:38 +08:00
Max Lv 8c4508843b Refine DNS resolution 2016-09-26 13:54:34 +08:00
Max Lv 79acf14069 Reduce the timeout of default DNS server 2016-09-26 09:48:42 +08:00
Max Lv 5f43500b9f Fix auto-start again 2016-09-26 07:51:54 +08:00
Max Lv 8b4a8a92f2 Bump version 2016-09-25 18:29:41 +08:00
Max Lv 7887d18f6f Clean up 2016-09-25 17:40:53 +08:00
17 changed files with 102 additions and 4573 deletions
+3 -3
View File
@@ -37,8 +37,8 @@ libraryDependencies ++= Seq(
"com.github.clans" % "fab" % "1.6.4", "com.github.clans" % "fab" % "1.6.4",
"com.github.jorgecastilloprz" % "fabprogresscircle" % "1.01", "com.github.jorgecastilloprz" % "fabprogresscircle" % "1.01",
"com.github.kevinsawicki" % "http-request" % "6.0", "com.github.kevinsawicki" % "http-request" % "6.0",
"com.google.android.gms" % "play-services-ads" % "9.6.0", "com.google.android.gms" % "play-services-ads" % "9.6.1",
"com.google.android.gms" % "play-services-analytics" % "9.6.0", "com.google.android.gms" % "play-services-analytics" % "9.6.1",
"com.j256.ormlite" % "ormlite-android" % "5.0", "com.j256.ormlite" % "ormlite-android" % "5.0",
"com.twofortyfouram" % "android-plugin-api-for-locale" % "1.0.2", "com.twofortyfouram" % "android-plugin-api-for-locale" % "1.0.2",
"dnsjava" % "dnsjava" % "2.1.7", "dnsjava" % "dnsjava" % "2.1.7",
@@ -47,7 +47,7 @@ libraryDependencies ++= Seq(
"net.glxn.qrgen" % "android" % "2.0" "net.glxn.qrgen" % "android" % "2.0"
) )
proguardVersion in Android := "5.2.1" proguardVersion in Android := "5.3"
proguardCache in Android := Seq() proguardCache in Android := Seq()
+2 -2
View File
@@ -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="159" android:versionCode="162"
android:versionName="3.1.7"> android:versionName="3.2.2">
<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
View File
@@ -8213,6 +8213,7 @@
.*\.eu .*\.eu
.*\.ru .*\.ru
.*\.au .*\.au
.*\.google\.cn
.*\.google\.com .*\.google\.com
.*\.google\.ad .*\.google\.ad
.*\.google\.ae .*\.google\.ae
+1
View File
@@ -8227,6 +8227,7 @@
.*\.eu .*\.eu
.*\.ru .*\.ru
.*\.au .*\.au
.*\.google\.cn
.*\.google\.com .*\.google\.com
.*\.google\.ad .*\.google\.ad
.*\.google\.ae .*\.google\.ae
+1
View File
@@ -3795,6 +3795,7 @@
.*\.eu .*\.eu
.*\.ru .*\.ru
.*\.au .*\.au
.*\.google\.cn
.*\.google\.com .*\.google\.com
.*\.google\.ad .*\.google\.ad
.*\.google\.ae .*\.google\.ae
+6 -110
View File
@@ -48,20 +48,12 @@
</string-array> </string-array>
<string-array name="private_route"> <string-array name="private_route">
<item>0.0.0.0/8</item>
<item>10.0.0.0/8</item> <item>10.0.0.0/8</item>
<item>100.64.0.0/10</item>
<item>127.0.0.0/8</item> <item>127.0.0.0/8</item>
<item>169.254.0.0/16</item> <item>169.254.0.0/16</item>
<item>172.16.0.0/12</item> <item>172.16.0.0/12</item>
<item>192.0.0.0/29</item> <item>192.0.0.0/29</item>
<item>192.0.2.0/24</item> <item>192.0.2.0/24</item>
<item>192.88.99.0/24</item>
<item>192.168.0.0/16</item>
<item>198.18.0.0/15</item>
<item>198.51.100.0/24</item>
<item>203.0.113.0/24</item>
<item>224.0.0.0/3</item>
</string-array> </string-array>
<string-array name="bypass_private_route"> <string-array name="bypass_private_route">
@@ -74,47 +66,8 @@
<item>16.0.0.0/4</item> <item>16.0.0.0/4</item>
<item>32.0.0.0/3</item> <item>32.0.0.0/3</item>
<item>64.0.0.0/3</item> <item>64.0.0.0/3</item>
<item>96.0.0.0/6</item> <item>96.0.0.0/4</item>
<item>100.0.0.0/10</item> <item>112.0.0.0/5</item>
<item>100.128.0.0/9</item>
<item>101.0.0.0/8</item>
<item>102.0.0.0/7</item>
<item>104.0.0.0/5</item>
<item>112.0.0.0/10</item>
<item>112.64.0.0/11</item>
<item>112.96.0.0/12</item>
<item>112.112.0.0/13</item>
<item>112.120.0.0/14</item>
<item>112.124.0.0/19</item>
<item>112.124.32.0/21</item>
<item>112.124.40.0/22</item>
<item>112.124.44.0/23</item>
<item>112.124.46.0/24</item>
<item>112.124.48.0/20</item>
<item>112.124.64.0/18</item>
<item>112.124.128.0/17</item>
<item>112.125.0.0/16</item>
<item>112.126.0.0/15</item>
<item>112.128.0.0/9</item>
<item>113.0.0.0/8</item>
<item>114.0.0.0/10</item>
<item>114.64.0.0/11</item>
<item>114.96.0.0/12</item>
<item>114.112.0.0/15</item>
<item>114.114.0.0/18</item>
<item>114.114.64.0/19</item>
<item>114.114.96.0/20</item>
<item>114.114.112.0/23</item>
<item>114.114.115.0/24</item>
<item>114.114.116.0/22</item>
<item>114.114.120.0/21</item>
<item>114.114.128.0/17</item>
<item>114.115.0.0/16</item>
<item>114.116.0.0/14</item>
<item>114.120.0.0/13</item>
<item>114.128.0.0/9</item>
<item>115.0.0.0/8</item>
<item>116.0.0.0/6</item>
<item>120.0.0.0/6</item> <item>120.0.0.0/6</item>
<item>124.0.0.0/7</item> <item>124.0.0.0/7</item>
<item>126.0.0.0/8</item> <item>126.0.0.0/8</item>
@@ -156,69 +109,12 @@
<item>192.8.0.0/13</item> <item>192.8.0.0/13</item>
<item>192.16.0.0/12</item> <item>192.16.0.0/12</item>
<item>192.32.0.0/11</item> <item>192.32.0.0/11</item>
<item>192.64.0.0/12</item> <item>192.64.0.0/10</item>
<item>192.80.0.0/13</item> <item>192.128.0.0/9</item>
<item>192.88.0.0/18</item>
<item>192.88.64.0/19</item>
<item>192.88.96.0/23</item>
<item>192.88.98.0/24</item>
<item>192.88.100.0/22</item>
<item>192.88.104.0/21</item>
<item>192.88.112.0/20</item>
<item>192.88.128.0/17</item>
<item>192.89.0.0/16</item>
<item>192.90.0.0/15</item>
<item>192.92.0.0/14</item>
<item>192.96.0.0/11</item>
<item>192.128.0.0/11</item>
<item>192.160.0.0/13</item>
<item>192.169.0.0/16</item>
<item>192.170.0.0/15</item>
<item>192.172.0.0/14</item>
<item>192.176.0.0/12</item>
<item>192.192.0.0/10</item>
<item>193.0.0.0/8</item> <item>193.0.0.0/8</item>
<item>194.0.0.0/7</item> <item>194.0.0.0/7</item>
<item>196.0.0.0/7</item> <item>196.0.0.0/6</item>
<item>198.0.0.0/12</item> <item>200.0.0.0/5</item>
<item>198.16.0.0/15</item>
<item>198.20.0.0/14</item>
<item>198.24.0.0/13</item>
<item>198.32.0.0/12</item>
<item>198.48.0.0/15</item>
<item>198.50.0.0/16</item>
<item>198.51.0.0/18</item>
<item>198.51.64.0/19</item>
<item>198.51.96.0/22</item>
<item>198.51.101.0/24</item>
<item>198.51.102.0/23</item>
<item>198.51.104.0/21</item>
<item>198.51.112.0/20</item>
<item>198.51.128.0/17</item>
<item>198.52.0.0/14</item>
<item>198.56.0.0/13</item>
<item>198.64.0.0/10</item>
<item>198.128.0.0/9</item>
<item>199.0.0.0/8</item>
<item>200.0.0.0/7</item>
<item>202.0.0.0/8</item>
<item>203.0.0.0/18</item>
<item>203.0.64.0/19</item>
<item>203.0.96.0/20</item>
<item>203.0.112.0/24</item>
<item>203.0.114.0/23</item>
<item>203.0.116.0/22</item>
<item>203.0.120.0/21</item>
<item>203.0.128.0/17</item>
<item>203.1.0.0/16</item>
<item>203.2.0.0/15</item>
<item>203.4.0.0/14</item>
<item>203.8.0.0/13</item>
<item>203.16.0.0/12</item>
<item>203.32.0.0/11</item>
<item>203.64.0.0/10</item>
<item>203.128.0.0/9</item>
<item>204.0.0.0/6</item>
<item>208.0.0.0/4</item> <item>208.0.0.0/4</item>
</string-array> </string-array>
</resources> </resources>
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -298,4 +298,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 + ";"
}
}
} }
@@ -1,6 +1,5 @@
package com.github.shadowsocks package com.github.shadowsocks
import android.Manifest
import android.app.Activity import android.app.Activity
import android.content.Intent import android.content.Intent
import android.content.pm.PackageManager import android.content.pm.PackageManager
@@ -48,13 +47,13 @@ class ScannerActivity extends AppCompatActivity with ZXingScannerView.ResultHand
override def onResume() { override def onResume() {
super.onResume() super.onResume()
val permissionCheck = ContextCompat.checkSelfPermission(this, val permissionCheck = ContextCompat.checkSelfPermission(this,
Manifest.permission.CAMERA) android.Manifest.permission.CAMERA)
if (permissionCheck == PackageManager.PERMISSION_GRANTED) { if (permissionCheck == PackageManager.PERMISSION_GRANTED) {
scannerView.setResultHandler(this) // Register ourselves as a handler for scan results. scannerView.setResultHandler(this) // Register ourselves as a handler for scan results.
scannerView.startCamera() // Start camera on resume scannerView.startCamera() // Start camera on resume
} else { } else {
ActivityCompat.requestPermissions(this, ActivityCompat.requestPermissions(this,
Array(Manifest.permission.CAMERA), MY_PERMISSIONS_REQUEST_CAMERA) Array(android.Manifest.permission.CAMERA), MY_PERMISSIONS_REQUEST_CAMERA)
} }
} }
@@ -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(" "))
@@ -178,18 +183,22 @@ class ShadowsocksNatService extends BaseService {
def startDnsDaemon() { def startDnsDaemon() {
val reject = if (profile.ipv6) "224.0.0.0/3" else "224.0.0.0/3, ::/0"
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, 208.67.222.222", "", 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 => { 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", "", profile.localPort + 63, "") "127.0.0.1", profile.localPort + 53, "8.8.8.8, 208.67.222.222",
"", 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, "") "127.0.0.1", profile.localPort + 53, profile.localPort + 63, reject)
} }
} }
@@ -54,11 +54,13 @@ class ShadowsocksRunnerService extends Service with ServiceBoundContext {
} }
override def onServiceConnected() { override def onServiceConnected() {
if (bgService != null) { handler.postDelayed(() => {
if (app.isNatEnabled) startBackgroundService() if (bgService != null) {
else if (VpnService.prepare(ShadowsocksRunnerService.this) == null) startBackgroundService() if (app.isNatEnabled) startBackgroundService()
handler.postDelayed(() => stopSelf(), 10000) else if (VpnService.prepare(ShadowsocksRunnerService.this) == null) startBackgroundService()
} handler.postDelayed(() => stopSelf(), 10000)
}
}, 1000)
} }
def startBackgroundService() = bgService.useSync(app.profileId) def startBackgroundService() = bgService.useSync(app.profileId)
@@ -282,13 +282,17 @@ class ShadowsocksVpnService extends VpnService with BaseService {
}) })
val cmd = ArrayBuffer[String](getApplicationInfo.dataDir + "/ss-tunnel" val cmd = ArrayBuffer[String](getApplicationInfo.dataDir + "/ss-tunnel"
, "-V" , "-V"
, "-u"
, "-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 +301,21 @@ class ShadowsocksVpnService extends VpnService with BaseService {
} }
def startDnsDaemon() { 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 { 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,
"0.0.0.0", profile.localPort + 53, "1.2.4.8, 114.114.114.114, 208.67.222.222", 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 => { case Route.CHINALIST => {
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir, 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 _ => { case _ => {
ConfigUtils.PDNSD_LOCAL.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir, 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 => { Utils.printToFile(new File(getApplicationInfo.dataDir + "/pdnsd-vpn.conf"))(p => {
@@ -73,7 +73,6 @@ object ConfigUtils {
| server_ip = %s; | server_ip = %s;
| server_port = %d; | server_port = %d;
| query_method = tcp_only; | query_method = tcp_only;
| run_ipv4 = on;
| min_ttl = 15m; | min_ttl = 15m;
| max_ttl = 1w; | max_ttl = 1w;
| timeout = 10; | timeout = 10;
@@ -84,10 +83,9 @@ object ConfigUtils {
| label = "local"; | label = "local";
| ip = 127.0.0.1; | ip = 127.0.0.1;
| port = %d; | port = %d;
| %s | reject = %s;
| reject_policy = negate; | reject_policy = negate;
| reject_recursively = on; | reject_recursively = on;
| timeout = 5;
|} |}
| |
|rr { |rr {
@@ -106,28 +104,34 @@ object ConfigUtils {
| cache_dir = "%s"; | cache_dir = "%s";
| server_ip = %s; | server_ip = %s;
| server_port = %d; | server_port = %d;
| query_method = tcp_only; | query_method = udp_only;
| run_ipv4 = on;
| min_ttl = 15m; | min_ttl = 15m;
| max_ttl = 1w; | max_ttl = 1w;
| timeout = 10; | timeout = 10;
| daemon = off; | daemon = off;
| par_queries = 4;
|} |}
| |
|server { |server {
| label = "remote-servers"; | label = "remote-servers";
| ip = %s; | ip = %s;
| timeout = 5; | timeout = 3;
| uptest = none; | query_method = udp_only;
| preset = on;
| %s | %s
| policy = included;
| reject = %s;
| reject_policy = fail;
| reject_recursively = on;
|} |}
| |
|server { |server {
| label = "local-server"; | label = "local-server";
| ip = 127.0.0.1; | ip = 127.0.0.1;
| query_method = tcp_only;
| port = %d; | port = %d;
| %s | reject = %s;
| reject_policy = negate;
| reject_recursively = on;
|} |}
| |
|rr { |rr {
@@ -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 = _
{ {