Compare commits

...
3 Commits
Author SHA1 Message Date
Max Lv 60d7d90565 Fix a DNS issue with GFWList mode 2017-03-05 16:11:24 +08:00
Max Lv d2ba9493c0 Bump version 2017-03-04 10:26:43 +08:00
Max Lv 0eaece7af9 Remove external IP #1148 2017-03-04 09:56:52 +08:00
3 changed files with 7 additions and 21 deletions
+2 -2
View File
@@ -2,8 +2,8 @@ enablePlugins(AndroidApp)
android.useSupportVectors android.useSupportVectors
name := "shadowsocks" name := "shadowsocks"
version := "4.1.0" version := "4.1.1"
versionCode := Some(180) versionCode := Some(181)
proguardOptions ++= proguardOptions ++=
"-keep class com.github.shadowsocks.JniHelper { *; }" :: "-keep class com.github.shadowsocks.JniHelper { *; }" ::
@@ -135,9 +135,9 @@ trait BaseService extends Service {
case Some(ip) => util.Arrays.asList(InetAddress.getByName(ip)) case Some(ip) => util.Arrays.asList(InetAddress.getByName(ip))
case _ => Dns.SYSTEM.lookup(hostname) case _ => Dns.SYSTEM.lookup(hostname)
}) })
.connectTimeout(5, TimeUnit.SECONDS) .connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(5, TimeUnit.SECONDS) .writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(5, TimeUnit.SECONDS) .readTimeout(30, TimeUnit.SECONDS)
.build() .build()
val requestBody = new FormBody.Builder() val requestBody = new FormBody.Builder()
.add("sig", sig) .add("sig", sig)
@@ -330,18 +330,6 @@ trait BaseService extends Service {
} }
protected final def buildOvertureConfig(file: String): String = { protected final def buildOvertureConfig(file: String): String = {
val url = "http://icanhazip.com"
val client = new OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.build()
val request = new Request.Builder()
.url(url)
.build()
val response = client.newCall(request).execute()
val externalIp = if (response.isSuccessful) response.body.string.trim else ""
val config = new JSONObject() val config = new JSONObject()
.put("BindAddress", ":" + (profile.localPort + 53)) .put("BindAddress", ":" + (profile.localPort + 53))
.put("RedirectIPv6Record", true) .put("RedirectIPv6Record", true)
@@ -357,9 +345,7 @@ trait BaseService extends Service {
if (edns) dns if (edns) dns
.put("Protocol", "tcp") .put("Protocol", "tcp")
.put("Socks5Address", "127.0.0.1:" + profile.localPort) .put("Socks5Address", "127.0.0.1:" + profile.localPort)
.put("EDNSClientSubnet", new JSONObject() .put("EDNSClientSubnet", new JSONObject().put("Policy", "disable"))
.put("Policy", "auto")
.put("ExternalIP", externalIp))
else dns else dns
.put("Protocol", "udp") .put("Protocol", "udp")
.put("EDNSClientSubnet", new JSONObject().put("Policy", "disable")) .put("EDNSClientSubnet", new JSONObject().put("Policy", "disable"))