mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 13:18:53 +00:00
tailcfg, all: use []netip.AddrPort instead of []string for Endpoints
It's JSON wire compatible. Updates #cleanup Change-Id: Ifa5c17768fec35b305b06d75eb5f0611c8a135a6 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
5f5c9142cc
commit
425cf9aa9d
@@ -1035,7 +1035,7 @@ func (s *Server) encode(mkey key.MachinePublic, compress bool, v any) (b []byte,
|
||||
//
|
||||
// Two types of IPv6 endpoints are considered invalid: link-local
|
||||
// addresses, and anything with a zone.
|
||||
func filterInvalidIPv6Endpoints(eps []string) []string {
|
||||
func filterInvalidIPv6Endpoints(eps []netip.AddrPort) []netip.AddrPort {
|
||||
clean := eps[:0]
|
||||
for _, ep := range eps {
|
||||
if keepClientEndpoint(ep) {
|
||||
@@ -1045,13 +1045,7 @@ func filterInvalidIPv6Endpoints(eps []string) []string {
|
||||
return clean
|
||||
}
|
||||
|
||||
func keepClientEndpoint(ep string) bool {
|
||||
ipp, err := netip.ParseAddrPort(ep)
|
||||
if err != nil {
|
||||
// Shouldn't have made it this far if we unmarshalled
|
||||
// the incoming JSON response.
|
||||
return false
|
||||
}
|
||||
func keepClientEndpoint(ipp netip.AddrPort) bool {
|
||||
ip := ipp.Addr()
|
||||
if ip.Zone() != "" {
|
||||
return false
|
||||
|
Reference in New Issue
Block a user