fix: ssr can not query dns

This commit is contained in:
mzz2017 committed 2020-02-16 15:39:27 +08:00
1 parent fb6a7655d4
commit fcc879ede0
1 file changed
+8 -9
+8 -9
View File
@@ -333,7 +333,6 @@ func ResolveOutbound(v *vmessInfo.VmessInfo, tag string, ssrLocalPortIfNeed int)
}
func (t *Template) SetDNS(v vmessInfo.VmessInfo, supportUDP bool) (dohIPs, dohHosts []string) {
notSupportUDP := supportUDP
setting := configure.GetSettingNotNil()
//先修改DNS设置
t.DNS = new(DNS)
@@ -348,7 +347,14 @@ func (t *Template) SetDNS(v vmessInfo.VmessInfo, supportUDP bool) (dohIPs, dohHo
t.DNS.Servers = append(t.DNS.Servers, doh)
}
case configure.DnsForward:
if notSupportUDP {
if supportUDP {
t.DNS.Servers = []interface{}{
DnsServer{
Address: "8.8.8.8",
Port: 53,
},
}
} else {
//由于ss, ssr不支持udp
//先优先请求DoH(tcp)
if err := CheckDohSupported(); err == nil {
@@ -366,13 +372,6 @@ func (t *Template) SetDNS(v vmessInfo.VmessInfo, supportUDP bool) (dohIPs, dohHo
},
}
}
} else {
t.DNS.Servers = []interface{}{
DnsServer{
Address: "8.8.8.8",
Port: 53,
},
}
}
case configure.AntipollutionNone:
t.DNS.Servers = []interface{}{"119.29.29.29", "114.114.114.114"} //防止DNS劫持,使用DNSPod作为主DNS