mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 16:54:15 -04:00
Properly create hostname from IPv6 (#7431)
Generate valid hostname from IPv6 when the address ends with `::`. Signed-off-by: Guillaume Jacquet <guillaume.jacquet@gmail.com>
This commit is contained in:
committed by
GitHub
parent
17020f09a8
commit
1025a199e9
@@ -351,7 +351,11 @@ func endpointHostname(addr object.EndpointAddress, endpointNameMode bool) string
|
||||
return strings.ReplaceAll(addr.IP, ".", "-")
|
||||
}
|
||||
if strings.Contains(addr.IP, ":") {
|
||||
return strings.ReplaceAll(addr.IP, ":", "-")
|
||||
ipv6Hostname := strings.ReplaceAll(addr.IP, ":", "-")
|
||||
if strings.HasSuffix(ipv6Hostname, "-") {
|
||||
return ipv6Hostname + "0"
|
||||
}
|
||||
return ipv6Hostname
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user