mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-21 10:27:30 +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
@@ -14,6 +14,7 @@ import (
|
||||
"io"
|
||||
"net"
|
||||
"os"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -169,6 +170,25 @@ func NewFakeUserspaceEngine(logf logger.Logf, listenPort uint16) (Engine, error)
|
||||
})
|
||||
}
|
||||
|
||||
// NetstackRouterType is a gross cross-package init-time registration
|
||||
// from netstack to here, informing this package of netstack's router
|
||||
// type.
|
||||
var NetstackRouterType reflect.Type
|
||||
|
||||
// IsNetstackRouter reports whether e is either fully netstack based
|
||||
// (without TUN) or is at least using netstack for routing.
|
||||
func IsNetstackRouter(e Engine) bool {
|
||||
switch e := e.(type) {
|
||||
case *userspaceEngine:
|
||||
if reflect.TypeOf(e.router) == NetstackRouterType {
|
||||
return true
|
||||
}
|
||||
case *watchdogEngine:
|
||||
return IsNetstackRouter(e.wrap)
|
||||
}
|
||||
return IsNetstack(e)
|
||||
}
|
||||
|
||||
// IsNetstack reports whether e is a netstack-based TUN-free engine.
|
||||
func IsNetstack(e Engine) bool {
|
||||
ig, ok := e.(InternalsGetter)
|
||||
|
Reference in New Issue
Block a user