mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-23 09:06:24 +00:00
wgengine/{magicsock,userspace,router}: move portupdates to the eventbus (#17423)
Also pull out interface method only needed in Linux. Instead of having userspace do the call into the router, just let the router pick up the change itself. Updates #15160 Signed-off-by: Claus Lensbøl <claus@tailscale.com>
This commit is contained in:
@@ -35,14 +35,6 @@ type Router interface {
|
||||
// implementation should handle gracefully.
|
||||
Set(*Config) error
|
||||
|
||||
// UpdateMagicsockPort tells the OS network stack what port magicsock
|
||||
// is currently listening on, so it can be threaded through firewalls
|
||||
// and such. This is distinct from Set() since magicsock may rebind
|
||||
// ports independently from the Config changing.
|
||||
//
|
||||
// network should be either "udp4" or "udp6".
|
||||
UpdateMagicsockPort(port uint16, network string) error
|
||||
|
||||
// Close closes the router.
|
||||
Close() error
|
||||
}
|
||||
@@ -56,6 +48,14 @@ type NewOpts struct {
|
||||
Bus *eventbus.Bus // required
|
||||
}
|
||||
|
||||
// PortUpdate is an eventbus value, reporting the port and address family
|
||||
// magicsock is currently listening on, so it can be threaded through firewalls
|
||||
// and such.
|
||||
type PortUpdate struct {
|
||||
UDPPort uint16
|
||||
EndpointNetwork string // either "udp4" or "udp6".
|
||||
}
|
||||
|
||||
// HookNewUserspaceRouter is the registration point for router implementations
|
||||
// to register a constructor for userspace routers. It's meant for implementations
|
||||
// in wgengine/router/osrouter.
|
||||
|
||||
Reference in New Issue
Block a user