wgengine: define default tunname for each platform
The device name "tailscale0" will be used for all platforms except for OpenBSD where "tun" is enforced by the kernel. `CreateTUN()` in `wireguard-go` will select the next available "tunX" device name on the OpenBSD system. Signed-off-by: Martin Baillie <martin@baillie.email>pull/166/head
parent
bb93d7aaba
commit
8ae3ba0cf5
|
@ -36,7 +36,7 @@ const globalStateKey = "_daemon"
|
||||||
func main() {
|
func main() {
|
||||||
fake := getopt.BoolLong("fake", 0, "fake tunnel+routing instead of tuntap")
|
fake := getopt.BoolLong("fake", 0, "fake tunnel+routing instead of tuntap")
|
||||||
debug := getopt.StringLong("debug", 0, "", "Address of debug server")
|
debug := getopt.StringLong("debug", 0, "", "Address of debug server")
|
||||||
tunname := getopt.StringLong("tun", 0, "tailscale0", "tunnel interface name")
|
tunname := getopt.StringLong("tun", 0, wgengine.DefaultTunName, "tunnel interface name")
|
||||||
listenport := getopt.Uint16Long("port", 'p', magicsock.DefaultPort, "WireGuard port (0=autoselect)")
|
listenport := getopt.Uint16Long("port", 'p', magicsock.DefaultPort, "WireGuard port (0=autoselect)")
|
||||||
statepath := getopt.StringLong("state", 0, paths.DefaultTailscaledStateFile(), "Path of state file")
|
statepath := getopt.StringLong("state", 0, paths.DefaultTailscaledStateFile(), "Path of state file")
|
||||||
socketpath := getopt.StringLong("socket", 's', paths.DefaultTailscaledSocket(), "Path of the service unix socket")
|
socketpath := getopt.StringLong("socket", 's', paths.DefaultTailscaledSocket(), "Path of the service unix socket")
|
||||||
|
|
|
@ -10,6 +10,8 @@ import (
|
||||||
"tailscale.com/types/logger"
|
"tailscale.com/types/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const DefaultTunName = "tailscale0"
|
||||||
|
|
||||||
type darwinRouter struct {
|
type darwinRouter struct {
|
||||||
tunname string
|
tunname string
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ import (
|
||||||
"tailscale.com/types/logger"
|
"tailscale.com/types/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const DefaultTunName = "tailscale0"
|
||||||
|
|
||||||
func newUserspaceRouter(logf logger.Logf, tunname string, dev *device.Device, tuntap tun.Device, netChanged func()) Router {
|
func newUserspaceRouter(logf logger.Logf, tunname string, dev *device.Device, tuntap tun.Device, netChanged func()) Router {
|
||||||
return NewFakeRouter(logf, tunname, dev, tuntap, netChanged)
|
return NewFakeRouter(logf, tunname, dev, tuntap, netChanged)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ import (
|
||||||
// Work is currently underway for an in-kernel FreeBSD implementation of wireguard
|
// Work is currently underway for an in-kernel FreeBSD implementation of wireguard
|
||||||
// https://svnweb.freebsd.org/base?view=revision&revision=357986
|
// https://svnweb.freebsd.org/base?view=revision&revision=357986
|
||||||
|
|
||||||
|
const DefaultTunName = "tailscale0"
|
||||||
|
|
||||||
type freebsdRouter struct {
|
type freebsdRouter struct {
|
||||||
logf logger.Logf
|
logf logger.Logf
|
||||||
tunname string
|
tunname string
|
||||||
|
|
|
@ -22,6 +22,8 @@ import (
|
||||||
"tailscale.com/types/logger"
|
"tailscale.com/types/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const DefaultTunName = "tailscale0"
|
||||||
|
|
||||||
type linuxRouter struct {
|
type linuxRouter struct {
|
||||||
logf func(fmt string, args ...interface{})
|
logf func(fmt string, args ...interface{})
|
||||||
tunname string
|
tunname string
|
||||||
|
|
|
@ -25,6 +25,8 @@ import (
|
||||||
// There is an experimental kernel version in the works for OpenBSD:
|
// There is an experimental kernel version in the works for OpenBSD:
|
||||||
// https://git.zx2c4.com/wireguard-openbsd.
|
// https://git.zx2c4.com/wireguard-openbsd.
|
||||||
|
|
||||||
|
const DefaultTunName = "tun"
|
||||||
|
|
||||||
type openbsdRouter struct {
|
type openbsdRouter struct {
|
||||||
logf logger.Logf
|
logf logger.Logf
|
||||||
tunname string
|
tunname string
|
||||||
|
|
|
@ -13,6 +13,8 @@ import (
|
||||||
"tailscale.com/types/logger"
|
"tailscale.com/types/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const DefaultTunName = "tailscale0"
|
||||||
|
|
||||||
type winRouter struct {
|
type winRouter struct {
|
||||||
logf func(fmt string, args ...interface{})
|
logf func(fmt string, args ...interface{})
|
||||||
tunname string
|
tunname string
|
||||||
|
|
Loading…
Reference in New Issue