From dd10babaed7811885a9fe946b88620be9a789909 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Fri, 29 Jan 2021 13:11:11 -0800 Subject: [PATCH] wgenginer/magicsock: remove Addrs methods They are now unused. Signed-off-by: Josh Bleecher Snyder --- go.mod | 2 +- go.sum | 2 ++ wgengine/magicsock/legacy.go | 26 +++++++++++--------------- wgengine/magicsock/magicsock.go | 7 ------- 4 files changed, 14 insertions(+), 23 deletions(-) diff --git a/go.mod b/go.mod index 9fca67cc8..4f976363f 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3 github.com/peterbourgon/ff/v2 v2.0.0 github.com/tailscale/depaware v0.0.0-20201214215404-77d1e9757027 - github.com/tailscale/wireguard-go v0.0.0-20210129202040-ddaf8316eff8 + github.com/tailscale/wireguard-go v0.0.0-20210201213041-c9817e648365 github.com/tcnksm/go-httpstat v0.2.0 github.com/toqueteos/webbrowser v1.2.0 go4.org/mem v0.0.0-20201119185036-c04c5a6ff174 diff --git a/go.sum b/go.sum index 4ffdb0116..d5becc8b9 100644 --- a/go.sum +++ b/go.sum @@ -298,6 +298,8 @@ github.com/tailscale/wireguard-go v0.0.0-20210120212909-7ad8a0443bd3 h1:wpgSErXu github.com/tailscale/wireguard-go v0.0.0-20210120212909-7ad8a0443bd3/go.mod h1:K/wyv4+3PcdVVTV7szyoiEjJ1nVHonM8cJ2mQwG5Fl8= github.com/tailscale/wireguard-go v0.0.0-20210129202040-ddaf8316eff8 h1:7OWHhbjWEuEjt+VlgOXLC4+iPkAvwTMU4zASxa+mKbw= github.com/tailscale/wireguard-go v0.0.0-20210129202040-ddaf8316eff8/go.mod h1:K/wyv4+3PcdVVTV7szyoiEjJ1nVHonM8cJ2mQwG5Fl8= +github.com/tailscale/wireguard-go v0.0.0-20210201213041-c9817e648365 h1:0OC8+fnUCx5ww7uRSlzbcVC6Q/FK0PmVclmimbpWbyk= +github.com/tailscale/wireguard-go v0.0.0-20210201213041-c9817e648365/go.mod h1:K/wyv4+3PcdVVTV7szyoiEjJ1nVHonM8cJ2mQwG5Fl8= github.com/tcnksm/go-httpstat v0.2.0 h1:rP7T5e5U2HfmOBmZzGgGZjBQ5/GluWUylujl0tJ04I0= github.com/tcnksm/go-httpstat v0.2.0/go.mod h1:s3JVJFtQxtBEBC9dwcdTTXS9xFnM3SXAZwPG41aurT8= github.com/toqueteos/webbrowser v1.2.0 h1:tVP/gpK69Fx+qMJKsLE7TD8LuGWPnEV71wBN9rrstGQ= diff --git a/wgengine/magicsock/legacy.go b/wgengine/magicsock/legacy.go index 856700925..7620cc1ce 100644 --- a/wgengine/magicsock/legacy.go +++ b/wgengine/magicsock/legacy.go @@ -438,7 +438,17 @@ func (a *addrSet) DstToBytes() []byte { return packIPPort(a.dst()) } func (a *addrSet) DstToString() string { - return a.Addrs() + var addrs []string + for _, addr := range a.addrs { + addrs = append(addrs, addr.String()) + } + + a.mu.Lock() + defer a.mu.Unlock() + if a.roamAddr != nil { + addrs = append(addrs, a.roamAddr.String()) + } + return strings.Join(addrs, ",") } func (a *addrSet) DstIP() net.IP { return a.dst().IP.IPAddr().IP // TODO: add netaddr accessor to cut an alloc here? @@ -577,20 +587,6 @@ func (as *addrSet) populatePeerStatus(ps *ipnstate.PeerStatus) { } } -func (a *addrSet) Addrs() string { - var addrs []string - for _, addr := range a.addrs { - addrs = append(addrs, addr.String()) - } - - a.mu.Lock() - defer a.mu.Unlock() - if a.roamAddr != nil { - addrs = append(addrs, a.roamAddr.String()) - } - return strings.Join(addrs, ",") -} - // Message types copied from wireguard-go/device/noise-protocol.go const ( messageInitiationType = 1 diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go index 1260f85ca..d28a07db3 100644 --- a/wgengine/magicsock/magicsock.go +++ b/wgengine/magicsock/magicsock.go @@ -3056,13 +3056,6 @@ func (de *discoEndpoint) String() string { return fmt.Sprintf("magicsock.discoEndpoint{%v, %v}", de.publicKey.ShortString(), de.discoShort) } -func (de *discoEndpoint) Addrs() string { - // This has to be the same string that was passed to - // CreateEndpoint, otherwise Reconfig will end up recreating - // Endpoints and losing state over time. - return de.wgEndpointHostPort -} - func (de *discoEndpoint) ClearSrc() {} func (de *discoEndpoint) SrcToString() string { panic("unused") } // unused by wireguard-go func (de *discoEndpoint) SrcIP() net.IP { panic("unused") } // unused by wireguard-go