Fix parse UDP DNS server with addr:port address

This commit is contained in:
世界 2024-06-08 21:31:43 +08:00
parent 0ca5909b06
commit c1f4755c4e
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4

View File

@ -221,7 +221,7 @@ func NewRouter(
if serverAddress == "" {
serverAddress = server.Address
}
_, notIpAddress := netip.ParseAddr(serverAddress)
notIpAddress := !M.ParseSocksaddr(serverAddress).Addr.IsValid()
if server.AddressResolver != "" {
if !transportTagMap[server.AddressResolver] {
return nil, E.New("parse dns server[", tag, "]: address resolver not found: ", server.AddressResolver)
@ -231,7 +231,7 @@ func NewRouter(
} else {
continue
}
} else if notIpAddress != nil && strings.Contains(server.Address, ".") {
} else if notIpAddress && strings.Contains(server.Address, ".") {
return nil, E.New("parse dns server[", tag, "]: missing address_resolver")
}
}