diff options
| author | Brad Fitzpatrick <bradfitz@tailscale.com> | 2025-11-14 10:18:30 -0800 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@tailscale.com> | 2025-11-14 10:18:30 -0800 |
| commit | 5b0997536fa8ea9cbde7961e08bbe78378d0fde4 (patch) | |
| tree | 99ac1621342910b9f7c54bcc1ca80c179c0a2dd4 /wgengine/wgengine.go | |
| parent | 124301fbb651382959f8bfe9b1f1765e42e8a3ef (diff) | |
| download | tailscale-bradfitz/getstatus.tar.xz tailscale-bradfitz/getstatus.zip | |
wgengine, ipn/ipnlocal, wgengine/magicsock: remove RequestStatus, eventbus-ify thingsbradfitz/getstatus
Updates #17900
Change-Id: Ia53a3f195a82256d8f915c8928d8a775f723259d
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Diffstat (limited to 'wgengine/wgengine.go')
| -rw-r--r-- | wgengine/wgengine.go | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/wgengine/wgengine.go b/wgengine/wgengine.go index be7873147..04de2bed2 100644 --- a/wgengine/wgengine.go +++ b/wgengine/wgengine.go @@ -7,7 +7,6 @@ package wgengine import ( "errors" "net/netip" - "time" "tailscale.com/ipn/ipnstate" "tailscale.com/net/dns" @@ -24,19 +23,12 @@ import ( // Status is the Engine status. // // TODO(bradfitz): remove this, subset of ipnstate? Need to migrate users. +// TODO(bradfitz): at least view-ify this? type Status struct { - AsOf time.Time // the time at which the status was calculated - Peers []ipnstate.PeerStatusLite - LocalAddrs []tailcfg.Endpoint // the set of possible endpoints for the magic conn - DERPs int // number of active DERP connections + Peers []ipnstate.PeerStatusLite + DERPs int // number of active DERP connections } -// StatusCallback is the type of status callbacks used by -// Engine.SetStatusCallback. -// -// Exactly one of Status or error is non-nil. -type StatusCallback func(*Status, error) - // NetworkMapCallback is the type used by callbacks that hook // into network map updates. type NetworkMapCallback func(*netmap.NetworkMap) @@ -93,13 +85,12 @@ type Engine interface { // SetJailedFilter updates the packet filter for jailed nodes. SetJailedFilter(*filter.Filter) - // SetStatusCallback sets the function to call when the - // WireGuard status changes. - SetStatusCallback(StatusCallback) + // GetStatus returns the current Engine status. + GetStatus() *Status - // RequestStatus requests a WireGuard status update right - // away, sent to the callback registered via SetStatusCallback. - RequestStatus() + // NumConfiguredPeers returns the number of currently configured peers, + // regardless of activity. + NumConfiguredPeers() int // PeerByKey returns the WireGuard status of the provided peer. // If the peer is not found, ok is false. |
