Fix overture with NAT mode
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -123,7 +123,7 @@ trait BaseService extends Service {
|
||||
false
|
||||
} else true
|
||||
|
||||
def getExternalIp() {
|
||||
def getExternalIp(): String = {
|
||||
val url = "http://icanhazip.com"
|
||||
val client = new OkHttpClient.Builder()
|
||||
.connectTimeout(10, TimeUnit.SECONDS)
|
||||
@@ -133,7 +133,11 @@ trait BaseService extends Service {
|
||||
val request = new Request.Builder()
|
||||
.url(url)
|
||||
.build()
|
||||
client.newCall(request).execute().body.string
|
||||
val response = client.newCall(request).execute()
|
||||
if (response.isSuccessful)
|
||||
response.body.string.trim
|
||||
else
|
||||
""
|
||||
}
|
||||
|
||||
def connect() {
|
||||
|
||||
@@ -89,9 +89,9 @@ class ShadowsocksNatService extends BaseService {
|
||||
ConfigUtils.OVERTURE_DIRECT.formatLocal(Locale.ENGLISH,
|
||||
profile.localPort + 53, // Local Port
|
||||
"119.29.29.29", // Primary DNS 1
|
||||
"tcp", // DNS type of Primary DNS 1
|
||||
"udp", // DNS type of Primary DNS 1
|
||||
"114.114.114.114", // Primary DNS 2
|
||||
"tcp", // DNS type of Primary DNS 2
|
||||
"udp", // DNS type of Primary DNS 2
|
||||
profile.remoteDns, // Alternative DNS
|
||||
"127.0.0.1:" + profile.localPort, // Local SOCKS5 Proxy
|
||||
externalIp) // External IP
|
||||
|
||||
Reference in New Issue
Block a user