From 99bb3557916c43f6b50f9b7770a5b5474317b017 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 13 Sep 2023 09:52:47 -0700 Subject: [PATCH] wgengine: remove DiscoKey method from Engine interface It has one user (LocalBackend) which can ask magicsock itself. Updates #cleanup Change-Id: I8c03cbb1e5ba57b0b442621b5fa467030c14a2e2 Signed-off-by: Brad Fitzpatrick --- ipn/ipnlocal/local.go | 2 +- wgengine/userspace.go | 4 ---- wgengine/watchdog.go | 5 ----- wgengine/wgengine.go | 5 ----- 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index b975b0730..8e561b3e0 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -1467,7 +1467,7 @@ func (b *LocalBackend) Start(opts ipn.Options) error { }) } - discoPublic := b.e.DiscoPublicKey() + discoPublic := b.magicConn().DiscoPublicKey() var err error diff --git a/wgengine/userspace.go b/wgengine/userspace.go index 5385146a6..8de1cfca2 100644 --- a/wgengine/userspace.go +++ b/wgengine/userspace.go @@ -1157,10 +1157,6 @@ func (e *userspaceEngine) SetNetworkMap(nm *netmap.NetworkMap) { e.mu.Unlock() } -func (e *userspaceEngine) DiscoPublicKey() key.DiscoPublic { - return e.magicConn.DiscoPublicKey() -} - func (e *userspaceEngine) UpdateStatus(sb *ipnstate.StatusBuilder) { st, err := e.getStatus() if err != nil { diff --git a/wgengine/watchdog.go b/wgengine/watchdog.go index 968751e66..e1aa222eb 100644 --- a/wgengine/watchdog.go +++ b/wgengine/watchdog.go @@ -18,7 +18,6 @@ "tailscale.com/ipn/ipnstate" "tailscale.com/net/dns" "tailscale.com/tailcfg" - "tailscale.com/types/key" "tailscale.com/types/netmap" "tailscale.com/wgengine/capture" "tailscale.com/wgengine/filter" @@ -140,10 +139,6 @@ func (e *watchdogEngine) RequestStatus() { func (e *watchdogEngine) SetNetworkMap(nm *netmap.NetworkMap) { e.watchdog("SetNetworkMap", func() { e.wrap.SetNetworkMap(nm) }) } -func (e *watchdogEngine) DiscoPublicKey() (k key.DiscoPublic) { - e.watchdog("DiscoPublicKey", func() { k = e.wrap.DiscoPublicKey() }) - return k -} func (e *watchdogEngine) Ping(ip netip.Addr, pingType tailcfg.PingType, size int, cb func(*ipnstate.PingResult)) { e.watchdog("Ping", func() { e.wrap.Ping(ip, pingType, size, cb) }) } diff --git a/wgengine/wgengine.go b/wgengine/wgengine.go index 7f3d249b3..f9f113390 100644 --- a/wgengine/wgengine.go +++ b/wgengine/wgengine.go @@ -11,7 +11,6 @@ "tailscale.com/ipn/ipnstate" "tailscale.com/net/dns" "tailscale.com/tailcfg" - "tailscale.com/types/key" "tailscale.com/types/netmap" "tailscale.com/wgengine/capture" "tailscale.com/wgengine/filter" @@ -102,10 +101,6 @@ type Engine interface { // The network map should only be read from. SetNetworkMap(*netmap.NetworkMap) - // DiscoPublicKey gets the public key used for path discovery - // messages. - DiscoPublicKey() key.DiscoPublic - // UpdateStatus populates the network state using the provided // status builder. UpdateStatus(*ipnstate.StatusBuilder)