mirror of
https://github.com/coredns/coredns.git
synced 2026-08-20 23:08:28 -04:00
Support IPv6 service endpoints in trace plugin (#8410)
Use net.JoinHostPort rather than string concatenation to support both ipv4, ipv6, and hostname service endpoints for the trace plugin. Previously, ipv6 bind addresses in the coredns configuration would fail to be parsed, as the ipv6 address was not surrounded in brackets. Signed-off-by: Michael Wolf <mwolf@cloudflare.com> Closes #8409 Co-authored-by: Michael Wolf <mwolf@cloudflare.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package trace
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -38,7 +39,7 @@ func traceParse(c *caddy.Controller) (*trace, error) {
|
||||
|
||||
cfg := dnsserver.GetConfig(c)
|
||||
if len(cfg.ListenHosts) > 0 && cfg.ListenHosts[0] != "" {
|
||||
tr.serviceEndpoint = cfg.ListenHosts[0] + ":" + cfg.Port
|
||||
tr.serviceEndpoint = net.JoinHostPort(cfg.ListenHosts[0], cfg.Port)
|
||||
}
|
||||
|
||||
for c.Next() { // trace
|
||||
|
||||
Reference in New Issue
Block a user