Skip to content

Commit 6220f46

Browse files
committed
expand ipv6
1 parent eff2f58 commit 6220f46

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

ci/test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,13 @@ func getIPFromCIDR(cidr string) (string, error) {
361361
}
362362

363363
// For IPv6, we can usually just use the network address.
364+
if ipv6 := ip.To16(); ipv6 != nil {
365+
parts := make([]string, 8)
366+
for i := 0; i < 8; i++ {
367+
parts[i] = fmt.Sprintf("%04x", uint16(ipv6[i*2])<<8|uint16(ipv6[i*2+1]))
368+
}
369+
return strings.Join(parts, ":"), nil
370+
}
364371
return ip.String(), nil
365372
}
366373

0 commit comments

Comments
 (0)