mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-25 20:57:31 +00:00
all: use various net/netip parse funcs directly
Mechanical change with perl+goimports. Changed {Must,}Parse{IP,IPPrefix,IPPort} to their netip variants, then goimports -d . Finally, removed the net/netaddr wrappers, to prevent future use. Updates #5162 Change-Id: I59c0e38b5fbca5a935d701645789cddf3d7863ad Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
730ca4203c
commit
6a396731eb
@@ -441,7 +441,7 @@ func (c *Conn) addDerpPeerRoute(peer key.NodePublic, derpID int, dc *derphttp.Cl
|
||||
mak.Set(&c.derpRoute, peer, derpRoute{derpID, dc})
|
||||
}
|
||||
|
||||
var derpMagicIPAddr = netaddr.MustParseIP(tailcfg.DerpMagicIP)
|
||||
var derpMagicIPAddr = netip.MustParseAddr(tailcfg.DerpMagicIP)
|
||||
|
||||
// activeDerp contains fields for an active DERP connection.
|
||||
type activeDerp struct {
|
||||
@@ -1034,7 +1034,7 @@ func (c *Conn) determineEndpoints(ctx context.Context) ([]tailcfg.Endpoint, erro
|
||||
// back.
|
||||
return []tailcfg.Endpoint{
|
||||
{
|
||||
Addr: netaddr.MustParseIPPort("[fe80:123:456:789::1]:12345"),
|
||||
Addr: netip.MustParseAddrPort("[fe80:123:456:789::1]:12345"),
|
||||
Type: tailcfg.EndpointLocal,
|
||||
},
|
||||
}, nil
|
||||
@@ -1044,7 +1044,7 @@ func (c *Conn) determineEndpoints(ctx context.Context) ([]tailcfg.Endpoint, erro
|
||||
var eps []tailcfg.Endpoint // unique endpoints
|
||||
|
||||
ipp := func(s string) (ipp netaddr.IPPort) {
|
||||
ipp, _ = netaddr.ParseIPPort(s)
|
||||
ipp, _ = netip.ParseAddrPort(s)
|
||||
return
|
||||
}
|
||||
addAddr := func(ipp netaddr.IPPort, et tailcfg.EndpointType) {
|
||||
@@ -2359,7 +2359,7 @@ func (c *Conn) SetNetworkMap(nm *netmap.NetworkMap) {
|
||||
c.logf("magicsock: created endpoint key=%s: disco=%s; %v", n.Key.ShortString(), n.DiscoKey.ShortString(), logger.ArgWriter(func(w *bufio.Writer) {
|
||||
const derpPrefix = "127.3.3.40:"
|
||||
if strings.HasPrefix(n.DERP, derpPrefix) {
|
||||
ipp, _ := netaddr.ParseIPPort(n.DERP)
|
||||
ipp, _ := netip.ParseAddrPort(n.DERP)
|
||||
regionID := int(ipp.Port())
|
||||
code := c.derpRegionCodeLocked(regionID)
|
||||
if code != "" {
|
||||
@@ -3751,7 +3751,7 @@ func (de *endpoint) updateFromNode(n *tailcfg.Node) {
|
||||
if n.DERP == "" {
|
||||
de.derpAddr = netaddr.IPPort{}
|
||||
} else {
|
||||
de.derpAddr, _ = netaddr.ParseIPPort(n.DERP)
|
||||
de.derpAddr, _ = netip.ParseAddrPort(n.DERP)
|
||||
}
|
||||
|
||||
for _, st := range de.endpointState {
|
||||
@@ -3762,7 +3762,7 @@ func (de *endpoint) updateFromNode(n *tailcfg.Node) {
|
||||
// Seems unlikely.
|
||||
continue
|
||||
}
|
||||
ipp, err := netaddr.ParseIPPort(epStr)
|
||||
ipp, err := netip.ParseAddrPort(epStr)
|
||||
if err != nil {
|
||||
de.c.logf("magicsock: bogus netmap endpoint %q", epStr)
|
||||
continue
|
||||
|
Reference in New Issue
Block a user