ipn: remove FakeExpireAfter Backend function

No callers remain (last one was removed with
tailscale/corp@1c095ae08f), and it's
pretty esoteric.

Signed-off-by: Mihai Parparita <mihai@tailscale.com>
pull/4585/head
Mihai Parparita 3 years ago committed by GitHub
parent d915e0054c
commit 2ec371fe8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -245,11 +245,6 @@ type Backend interface {
// counts. Connection events are emitted automatically without
// polling.
RequestEngineStatus()
// FakeExpireAfter pretends that the current key is going to
// expire after duration x. This is useful for testing GUIs to
// make sure they react properly with keys that are going to
// expire.
FakeExpireAfter(x time.Duration)
// Ping attempts to start connecting to the given IP and sends a Notify
// with its PingResult. If the host is down, there might never
// be a PingResult sent. The cmd/tailscale CLI client adds a timeout.

@ -5,8 +5,6 @@
package ipn
import (
"time"
"tailscale.com/ipn/ipnstate"
"tailscale.com/tailcfg"
"tailscale.com/types/netmap"
@ -102,12 +100,6 @@ func (b *FakeBackend) RequestEngineStatus() {
}
}
func (b *FakeBackend) FakeExpireAfter(x time.Duration) {
if b.notify != nil {
b.notify(Notify{NetMap: &netmap.NetworkMap{}})
}
}
func (b *FakeBackend) Ping(ip string, useTSMP bool) {
if b.notify != nil {
b.notify(Notify{PingResult: &ipnstate.PingResult{}})

@ -174,7 +174,3 @@ func (h *Handle) Logout() {
func (h *Handle) RequestEngineStatus() {
h.b.RequestEngineStatus()
}
func (h *Handle) FakeExpireAfter(x time.Duration) {
h.b.FakeExpireAfter(x)
}

@ -1699,28 +1699,6 @@ func (b *LocalBackend) StartLoginInteractive() {
}
}
// FakeExpireAfter implements Backend.
func (b *LocalBackend) FakeExpireAfter(x time.Duration) {
b.logf("FakeExpireAfter: %v", x)
b.mu.Lock()
defer b.mu.Unlock()
if b.netMap == nil {
return
}
// This function is called very rarely,
// so we prefer to fully copy the netmap over introducing in-place modification here.
mapCopy := *b.netMap
e := mapCopy.Expiry
if e.IsZero() || time.Until(e) > x {
mapCopy.Expiry = time.Now().Add(x)
}
b.setNetMapLocked(&mapCopy)
b.send(ipn.Notify{NetMap: b.netMap})
}
func (b *LocalBackend) Ping(ipStr string, useTSMP bool) {
ip, err := netaddr.ParseIP(ipStr)
if err != nil {

@ -13,7 +13,6 @@ import (
"fmt"
"io"
"log"
"time"
"tailscale.com/envknob"
"tailscale.com/tailcfg"
@ -52,10 +51,6 @@ type SetPrefsArgs struct {
New *Prefs
}
type FakeExpireAfterArgs struct {
Duration time.Duration
}
type PingArgs struct {
IP string
UseTSMP bool
@ -83,7 +78,6 @@ type Command struct {
SetPrefs *SetPrefsArgs
RequestEngineStatus *NoArgs
RequestStatus *NoArgs
FakeExpireAfter *FakeExpireAfterArgs
Ping *PingArgs
}
@ -205,9 +199,6 @@ func (bs *BackendServer) GotCommand(ctx context.Context, cmd *Command) error {
} else if c := cmd.SetPrefs; c != nil {
bs.b.SetPrefs(c.New)
return nil
} else if c := cmd.FakeExpireAfter; c != nil {
bs.b.FakeExpireAfter(c.Duration)
return nil
}
return fmt.Errorf("BackendServer.Do: no command specified")
}
@ -320,10 +311,6 @@ func (bc *BackendClient) RequestStatus() {
bc.send(Command{AllowVersionSkew: true, RequestStatus: &NoArgs{}})
}
func (bc *BackendClient) FakeExpireAfter(x time.Duration) {
bc.send(Command{FakeExpireAfter: &FakeExpireAfterArgs{Duration: x}})
}
func (bc *BackendClient) Ping(ip string, useTSMP bool) {
bc.send(Command{Ping: &PingArgs{
IP: ip,

Loading…
Cancel
Save