[client] Eliminate upstream server strings in dns code (#4267)

This commit is contained in:
Viktor Liu
2025-08-11 11:57:21 +02:00
committed by GitHub
parent 375fcf2752
commit 1022a5015c
30 changed files with 161 additions and 308 deletions

View File

@@ -102,6 +102,11 @@ func (n *NameServer) IsEqual(other *NameServer) bool {
other.Port == n.Port
}
// AddrPort returns the nameserver as a netip.AddrPort
func (n *NameServer) AddrPort() netip.AddrPort {
return netip.AddrPortFrom(n.IP, uint16(n.Port))
}
// ParseNameServerURL parses a nameserver url in the format <type>://<ip>:<port>, e.g., udp://1.1.1.1:53
func ParseNameServerURL(nsURL string) (NameServer, error) {
parsedURL, err := url.Parse(nsURL)