dns

DNS client and server implementations using the Go project's dnsmessage package
Log | Files | Refs | README | LICENSE

commit 11f7c1c6cd3a633c23b4f79de0712ad7a21fe302
parent 1f9c5f7d3e3cb82ed12d1f801522d6d31318d5a0
Author: Oliver Lowe <o@olowe.co>
Date:   Tue, 14 Dec 2021 11:20:31 +1100

cmd/recursor: use net.JoinHostPort to make a dial string

don't roll our own

Diffstat:
Mcmd/recursor/recursor.go | 7+------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/cmd/recursor/recursor.go b/cmd/recursor/recursor.go @@ -24,13 +24,8 @@ func isIPv6(ip net.IP) bool { } // appends the DNS port to the IP to be used in a dial string. -// If IP is IPv6 address, it is wrapped in square brackets ("[" and "]"). func ip2dial(ip net.IP) string { - s := ip.String() - if isIPv6(ip) { - return "["+s+"]:domain" - } - return s+":domain" + return net.JoinHostPort(ip.String(), "domain") } func newID() uint16 {