wgengine/router: split out from wgengine.

The router implementations are logically separate, with their own API.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson
2020-04-30 13:20:09 -07:00
committed by Dave Anderson
parent ee3395e63a
commit 1ac570def7
16 changed files with 98 additions and 85 deletions

View File

@@ -14,6 +14,7 @@ import (
"log"
"net/http"
"net/http/pprof"
"runtime"
"github.com/apenwarr/fixconsole"
"github.com/pborman/getopt/v2"
@@ -33,10 +34,18 @@ import (
// later, the global state key doesn't look like a username.
const globalStateKey = "_daemon"
var defaultTunName = "tailscale0"
func init() {
if runtime.GOOS == "openbsd" {
defaultTunName = "tun"
}
}
func main() {
fake := getopt.BoolLong("fake", 0, "fake tunnel+routing instead of tuntap")
debug := getopt.StringLong("debug", 0, "", "Address of debug server")
tunname := getopt.StringLong("tun", 0, wgengine.DefaultTunName, "tunnel interface name")
tunname := getopt.StringLong("tun", 0, defaultTunName, "tunnel interface name")
listenport := getopt.Uint16Long("port", 'p', magicsock.DefaultPort, "WireGuard port (0=autoselect)")
statepath := getopt.StringLong("state", 0, paths.DefaultTailscaledStateFile(), "Path of state file")
socketpath := getopt.StringLong("socket", 's', paths.DefaultTailscaledSocket(), "Path of the service unix socket")