summaryrefslogtreecommitdiffhomepage
path: root/wgengine/userspace.go
diff options
context:
space:
mode:
Diffstat (limited to 'wgengine/userspace.go')
-rw-r--r--wgengine/userspace.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/wgengine/userspace.go b/wgengine/userspace.go
index 4a22c888a..820e40f0e 100644
--- a/wgengine/userspace.go
+++ b/wgengine/userspace.go
@@ -119,6 +119,8 @@ type userspaceEngine struct {
statusBufioReader *bufio.Reader // reusable for UAPI
lastStatusPollTime mono.Time // last time we polled the engine status
+ connMetrics metrics // counts for success/failure/kinds of connections.
+
mu sync.Mutex // guards following; see lock order comment below
netMap *netmap.NetworkMap // or nil
closing bool // Close was called (even if we're still closing)
@@ -133,6 +135,19 @@ type userspaceEngine struct {
// Lock ordering: magicsock.Conn.mu, wgLock, then mu.
}
+type metrics struct {
+ // offline is the number of flows magicsock attempted to connect to which are offline.
+ offline uint32
+ // relayed is the number of flows magicsock connected thru over DERP.
+ relayed uint32
+ // direct is the number of flows connected to directly.
+ direct uint32
+ // unreachable is the number of flows which were expected to be online but could not be
+ // connected to. This is expected to be small, as there is only a brief window where flows are
+ // offline but have not yet notified control.
+ unreachable uint32
+}
+
// InternalsGetter is implemented by Engines that can export their internals.
type InternalsGetter interface {
GetInternals() (_ *tstun.Wrapper, _ *magicsock.Conn, ok bool)