internal: only delete old ipv6 if it is non-link local

So the client is removed from table only when it's global ipv6 changed.
This commit is contained in:
Cuong Manh Le
2024-04-05 17:59:21 +07:00
committed by Cuong Manh Le
parent affef963c1
commit b002dff624
4 changed files with 27 additions and 15 deletions
+9
View File
@@ -115,6 +115,15 @@ func IsIPv6(ip string) bool {
return parsedIP != nil && parsedIP.To4() == nil && parsedIP.To16() != nil
}
// IsLinkLocalUnicastIPv6 checks if the provided IP is a link local unicast v6 address.
func IsLinkLocalUnicastIPv6(ip string) bool {
parsedIP := net.ParseIP(ip)
if parsedIP == nil || parsedIP.To4() != nil || parsedIP.To16() == nil {
return false
}
return parsedIP.To16().IsLinkLocalUnicast()
}
type parallelDialerResult struct {
conn net.Conn
err error