Commit 0eaece7a authored by Max Lv's avatar Max Lv

Remove external IP #1148

parent 96320896
...@@ -135,9 +135,9 @@ trait BaseService extends Service { ...@@ -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 { ...@@ -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 { ...@@ -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"))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment