diff --git a/service/model/v2ray/v2rayTmpl.go b/service/model/v2ray/v2rayTmpl.go index 08dac628..d8a30b42 100644 --- a/service/model/v2ray/v2rayTmpl.go +++ b/service/model/v2ray/v2rayTmpl.go @@ -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