derp, wgengine: let clients advertise an opaque app name to DERP servers
Add an AppName field to the DERP ClientInfo so DERP servers can attribute connections to the application making them, primarily for best effort stats purposes. The value is plumbed per engine instance rather than via a process global, so a process hosting multiple stacks can attribute each one's DERP connections separately: wgengine.Config.DERPAppName flows through magicsock.Options and derphttp.Client into the naclbox-sealed ClientInfo JSON. Old servers ignore the unknown field. There are no callers in the tree yet setting the name. Updates tailscale/corp#24454 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com> Change-Id: Ia7d3e9c2b6f8140e5a9d7c3b2e6f1a8d4c0b5e9f
This commit is contained in:
committed by
Brad Fitzpatrick
parent
37e175a032
commit
246c82a658
@@ -210,6 +210,11 @@ type Config struct {
|
||||
// connections (e.g. DERP). Passed through to magicsock.
|
||||
ExtraRootCAs *x509.CertPool
|
||||
|
||||
// DERPAppName, if non-empty, is an opaque app name string to
|
||||
// advertise to DERP servers for stats purposes. It is passed
|
||||
// through to magicsock.
|
||||
DERPAppName string
|
||||
|
||||
// ControlKnobs is the set of control plane-provied knobs
|
||||
// to use.
|
||||
// If nil, defaults are used.
|
||||
@@ -425,6 +430,7 @@ func NewUserspaceEngine(logf logger.Logf, conf Config) (_ Engine, reterr error)
|
||||
NetMon: e.netMon,
|
||||
HealthTracker: e.health,
|
||||
ExtraRootCAs: conf.ExtraRootCAs,
|
||||
DERPAppName: conf.DERPAppName,
|
||||
Metrics: conf.Metrics,
|
||||
ControlKnobs: conf.ControlKnobs,
|
||||
PeerByKeyFunc: e.PeerByKey,
|
||||
|
||||
Reference in New Issue
Block a user