mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
commit
58744967be
1 changed files with 8 additions and 1 deletions
|
@ -178,7 +178,14 @@ func GetNameservers(resolvConf []byte, kind int) []string {
|
|||
func GetNameserversAsCIDR(resolvConf []byte) []string {
|
||||
nameservers := []string{}
|
||||
for _, nameserver := range GetNameservers(resolvConf, types.IP) {
|
||||
nameservers = append(nameservers, nameserver+"/32")
|
||||
var address string
|
||||
// If IPv6, strip zone if present
|
||||
if strings.Contains(nameserver, ":") {
|
||||
address = strings.Split(nameserver, "%")[0] + "/128"
|
||||
} else {
|
||||
address = nameserver + "/32"
|
||||
}
|
||||
nameservers = append(nameservers, address)
|
||||
}
|
||||
return nameservers
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue