Skip to content

Commit

Permalink
Server: favor global IP scope instead of local scope
Browse files Browse the repository at this point in the history
  • Loading branch information
grandcat committed Jul 25, 2016
1 parent 21b4f26 commit e16f7d3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,16 @@ func Register(instance, service, domain string, port int, text []string, iface *
if ipnet.IP.To4() != nil {
entry.AddrIPv4 = ipnet.IP
} else if ipnet.IP.To16() != nil {
entry.AddrIPv6 = ipnet.IP
// Favor global instead of local IP scope
if entry.AddrIPv6 != nil {
if ipnet.IP.IsGlobalUnicast() {
entry.AddrIPv6 = ipnet.IP
log.Printf("Added global IPv6: %v\n", entry.AddrIPv6)
}

} else {
entry.AddrIPv6 = ipnet.IP
}
}
}
}
Expand Down

0 comments on commit e16f7d3

Please sign in to comment.