mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-14 15:07:55 +00:00
cmd/tailscaled, wgengine{,/netstack}: add netstack hybrid mode, add to Windows
For #707 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
1f99f889e1
commit
d488678fdc
36
wgengine/netstack/subnet_router_wrapper.go
Normal file
36
wgengine/netstack/subnet_router_wrapper.go
Normal file
@@ -0,0 +1,36 @@
|
||||
// Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package netstack
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"tailscale.com/wgengine"
|
||||
"tailscale.com/wgengine/router"
|
||||
)
|
||||
|
||||
func init() {
|
||||
wgengine.NetstackRouterType = reflect.TypeOf(&subnetRouter{})
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
Reference in New Issue
Block a user