Add local DNS to dns list. #1281
This commit is contained in:
@@ -349,12 +349,21 @@ trait BaseService extends Service {
|
||||
val remoteDns = new JSONArray(profile.remoteDns.split(",").zipWithIndex.map {
|
||||
case (dns, i) => makeDns("UserDef-" + i, dns.trim)
|
||||
})
|
||||
val localDns = new JSONArray(Array(
|
||||
makeDns("Primary-1", "119.29.29.29", edns = false),
|
||||
makeDns("Primary-2", "114.114.114.114", edns = false)
|
||||
))
|
||||
|
||||
try {
|
||||
val localLinkDns = com.github.shadowsocks.utils.Dns.getDnsResolver(this)
|
||||
localDns.put(makeDns("Primary-3", localLinkDns, edns = false))
|
||||
} catch {
|
||||
case _: Exception => // Ignore
|
||||
}
|
||||
|
||||
profile.route match {
|
||||
case Acl.BYPASS_CHN | Acl.BYPASS_LAN_CHN | Acl.GFWLIST | Acl.CUSTOM_RULES => config
|
||||
.put("PrimaryDNS", new JSONArray(Array(
|
||||
makeDns("Primary-1", "119.29.29.29", edns = false),
|
||||
makeDns("Primary-2", "114.114.114.114", edns = false)
|
||||
)))
|
||||
.put("PrimaryDNS", localDns)
|
||||
.put("AlternativeDNS", remoteDns)
|
||||
.put("IPNetworkFile", "china_ip_list.txt")
|
||||
.put("DomainFile", "gfwlist.txt")
|
||||
|
||||
Reference in New Issue
Block a user