mirror of
https://github.com/tailscale/tailscale.git
synced 2024-12-04 23:45:34 +00:00
6e967446e4
This is part of an effort to clean up tailscaled initialization between tailscaled, tailscaled Windows service, tsnet, and the mac GUI. Updates #8036 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
29 lines
613 B
Go
29 lines
613 B
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
package netstack
|
|
|
|
import (
|
|
"tailscale.com/wgengine/router"
|
|
)
|
|
|
|
type subnetRouter struct {
|
|
router.Router
|
|
}
|
|
|
|
// NewSubnetRouterWrapper returns a Router wrapper that prevents the
|
|
// underlying Router r from seeing any advertised subnet routes, as
|
|
// netstack will handle them instead.
|
|
func NewSubnetRouterWrapper(r router.Router) router.Router {
|
|
return &subnetRouter{
|
|
Router: r,
|
|
}
|
|
}
|
|
|
|
func (r *subnetRouter) Set(c *router.Config) error {
|
|
if c != nil {
|
|
c.SubnetRoutes = nil // netstack will handle
|
|
}
|
|
return r.Router.Set(c)
|
|
}
|