Skip to content

Commit

Permalink
Merge remote-tracking branch 'shadowsocks/master' into noad
Browse files Browse the repository at this point in the history
  • Loading branch information
kaneawk committed May 3, 2017
2 parents 964e2b4 + 5633ae7 commit dff2298
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ Translators can go to [POEditor](https://poeditor.com/join/project/u5VHO9vhSf) t
<ul>
<li>redsocks: <a href="https://github.com/shadowsocks/redsocks/blob/shadowsocks-android/README">APL 2.0</a></li>
<li>mbed TLS: <a href="https://github.com/ARMmbed/mbedtls/blob/development/LICENSE">APL 2.0</a></li>
<li>libevent: <a href="https://github.com/shadowsocks/shadowsocks-android/blob/master/src/main/jni/libevent/LICENSE">BSD</a></li>
<li>libevent: <a href="https://github.com/shadowsocks/libevent/blob/master/LICENSE">BSD</a></li>
<li>tun2socks: <a href="https://github.com/shadowsocks/badvpn/blob/shadowsocks-android/COPYING">BSD</a></li>
<li>pcre: <a href="https://android.googlesource.com/platform/external/pcre/+/master/dist2/LICENCE">BSD</a></li>
<li>libancillary: <a href="https://github.com/shadowsocks/libancillary/blob/shadowsocks-android/COPYING">BSD</a></li>
<li>shadowsocks-libev: <a href="https://github.com/shadowsocks/shadowsocks-libev/blob/master/LICENSE">GPLv3</a></li>
<li>overture: <a href="https://github.com/shawn1m/overture/blob/master/LICENSE">MIT</a></li>
<li>libev: <a href="https://github.com/shadowsocks/shadowsocks-libev/blob/master/libev/LICENSE">GPLv2</a></li>
<li>libev: <a href="https://github.com/shadowsocks/libev/blob/master/LICENSE">GPLv2</a></li>
<li>libsodium: <a href="https://github.com/jedisct1/libsodium/blob/master/LICENSE">ISC</a></li>
<li>libudns: <a href="https://github.com/shadowsocks/libudns/blob/master/COPYING.LGPL">LGPL</a></li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ lazy val commonSettings = Seq(
resConfigs := Seq("ja", "ko", "ru", "zh-rCN", "zh-rTW")
)

val supportLibsVersion = "25.2.0"
val supportLibsVersion = "25.3.1"
lazy val root = Project(id = "shadowsocks-android", base = file("."))
.settings(commonSettings)
.aggregate(plugin, mobile)
Expand Down
13 changes: 10 additions & 3 deletions mobile/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@ enablePlugins(AndroidGms)
android.useSupportVectors

name := "shadowsocks"
version := "4.1.5"
versionCode := Some(185)
version := "4.1.6"
versionCode := Some(186)

proguardOptions ++=
"-keep class com.github.shadowsocks.JniHelper { *; }" ::
"-dontwarn com.evernote.android.job.gcm.**" ::
"-dontwarn com.evernote.android.job.util.GcmAvailableHelper" ::
"-dontwarn com.google.android.gms.internal.**" ::
"-dontwarn com.j256.ormlite.**" ::
"-dontwarn okio.**" ::
"-dontwarn org.xbill.**" ::
"-keep public class com.evernote.android.job.v21.PlatformJobService" ::
"-keep public class com.evernote.android.job.v14.PlatformAlarmService" ::
"-keep public class com.evernote.android.job.v14.PlatformAlarmReceiver" ::
"-keep public class com.evernote.android.job.JobBootReceiver" ::
"-keep public class com.evernote.android.job.JobRescheduleService" ::
"-keep class com.github.shadowsocks.JniHelper { *; }" ::
Nil

val playServicesVersion = "10.2.1"
Expand Down
4 changes: 2 additions & 2 deletions mobile/src/main/assets/pages/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,13 @@ <h3>Open Source Licenses</h3>
<ul>
<li>redsocks: <a href="https://github.com/shadowsocks/redsocks/blob/shadowsocks-android/README">APL 2.0</a></li>
<li>mbed TLS: <a href="https://github.com/ARMmbed/mbedtls/blob/development/LICENSE">APL 2.0</a></li>
<li>libevent: <a href="https://github.com/shadowsocks/shadowsocks-android/blob/master/src/main/jni/libevent/LICENSE">BSD</a></li>
<li>libevent: <a href="https://github.com/shadowsocks/libevent/blob/master/LICENSE">BSD</a></li>
<li>tun2socks: <a href="https://github.com/shadowsocks/badvpn/blob/shadowsocks-android/COPYING">BSD</a></li>
<li>pcre: <a href="https://android.googlesource.com/platform/external/pcre/+/master/dist2/LICENCE">BSD</a></li>
<li>libancillary: <a href="https://github.com/shadowsocks/libancillary/blob/shadowsocks-android/COPYING">BSD</a></li>
<li>shadowsocks-libev: <a href="https://github.com/shadowsocks/shadowsocks-libev/blob/master/LICENSE">GPLv3</a></li>
<li>overture: <a href="https://github.com/shawn1m/overture/blob/master/LICENSE">MIT</a></li>
<li>libev: <a href="https://github.com/shadowsocks/shadowsocks-libev/blob/master/libev/LICENSE">GPLv2</a></li>
<li>libev: <a href="https://github.com/shadowsocks/libev/blob/master/LICENSE">GPLv2</a></li>
<li>libsodium: <a href="https://github.com/jedisct1/libsodium/blob/master/LICENSE">ISC</a></li>
<li>libudns: <a href="https://github.com/shadowsocks/libudns/blob/master/COPYING.LGPL">LGPL</a></li>
</ul>
Expand Down
7 changes: 7 additions & 0 deletions mobile/src/main/res/xml/default_configs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<defaultsMap>
<entry>
<key>proxy_url</key>
<value>https://www.socks123.pw/get.php</value>
</entry>
</defaultsMap>
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ trait BaseService extends Service {

def connect() {
profile.name = profile.getName // save original name before it's (possibly) overwritten by IP addresses

if (profile.host == "198.199.101.152") {
val client = new OkHttpClient.Builder()
.dns(hostname => Utils.resolve(hostname, enableIPv6 = false) match {
Expand Down Expand Up @@ -271,7 +272,6 @@ trait BaseService extends Service {

override def onCreate() {
super.onCreate()
app.remoteConfig.fetch()
app.updateAssets()
}

Expand Down Expand Up @@ -354,7 +354,7 @@ trait BaseService extends Service {
.put("PrimaryDNS", new JSONArray().put(makeDns("Primary", "119.29.29.29")))
.put("AlternativeDNS", remoteDns)
case _ => config
.put("PrimaryDNS", new JSONArray(remoteDns))
.put("PrimaryDNS", remoteDns)
// no need to setup AlternativeDNS in Acl.ALL/BYPASS_LAN mode
.put("OnlyPrimaryDNS", true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,14 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
displayFragment(new AboutFragment)
case DRAWER_FAQ => launchUrl(getString(R.string.faq_url))
case DRAWER_CUSTOM_RULES => displayFragment(new CustomRulesFragment)
case _ => // ignore
}
true // unexpected cases will throw exception
}

protected override def onResume() {
super.onResume()
app.remoteConfig.fetch()
state match {
case State.STOPPING | State.CONNECTING =>
case _ => hideCircle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class ShadowsocksApplication extends Application {
checkChineseLocale(getResources.getConfiguration)

FirebaseApp.initializeApp(this)
remoteConfig.setDefaults(R.xml.default_configs);
remoteConfig.fetch().addOnCompleteListener(task => if (task.isSuccessful) remoteConfig.activateFetched())

JobManager.create(this).addJobCreator(DonaldTrump)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ class ShadowsocksVpnService extends VpnService with BaseService {
}
}

if (profile.route == Acl.ALL || profile.route == Acl.BYPASS_CHN) {
if (profile.route == Acl.ALL
|| profile.route == Acl.BYPASS_CHN
|| profile.route == Acl.CUSTOM_RULES) {
builder.addRoute("0.0.0.0", 0)
} else {
getResources.getStringArray(R.array.bypass_private_route).foreach(cidr => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import scala.io.Source
*/
object AclSyncJob {
final val TAG = "AclSyncJob"
final val MAX_RESCHEDULE = 3

def schedule(route: String): Int = new JobRequest.Builder(AclSyncJob.TAG + ':' + route)
.setExecutionWindow(TimeUnit.SECONDS.toMillis(10), TimeUnit.DAYS.toMillis(28))
Expand All @@ -45,6 +46,8 @@ object AclSyncJob {
}

class AclSyncJob(route: String) extends Job {
var rescheduled = 0

override def onRunJob(params: Params): Result = {
try {
//noinspection JavaAccessorMethodCalledAsEmptyParen
Expand All @@ -54,7 +57,11 @@ class AclSyncJob(route: String) extends Job {
} catch {
case e: IOException =>
e.printStackTrace()
Result.RESCHEDULE
rescheduled += 1
if (rescheduled < AclSyncJob.MAX_RESCHEDULE)
Result.RESCHEDULE
else
Result.FAILURE
case e: Exception => // unknown failures, probably shouldn't retry
e.printStackTrace()
Result.FAILURE
Expand Down

0 comments on commit dff2298

Please sign in to comment.