tailscaled: add tunnel name and port flags
OpenBSD tunnel names are prefixed with `tun`. Controlling the port allows for deterministic configuration of firewall rules (using `pf` in this case). Signed-off-by: Martin Baillie <martin@baillie.email>
This commit is contained in:
parent
15f8c8dde4
commit
3d5ef74f26
|
@ -20,11 +20,14 @@ import (
|
||||||
"tailscale.com/ipn/ipnserver"
|
"tailscale.com/ipn/ipnserver"
|
||||||
"tailscale.com/logpolicy"
|
"tailscale.com/logpolicy"
|
||||||
"tailscale.com/wgengine"
|
"tailscale.com/wgengine"
|
||||||
|
"tailscale.com/wgengine/magicsock"
|
||||||
)
|
)
|
||||||
|
|
||||||
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, "ts0", "tunnel interface name")
|
||||||
|
listenport := getopt.Uint16Long("port", 'p', magicsock.DefaultPort, "WireGuard port (0=autoselect)")
|
||||||
|
|
||||||
logf := wgengine.RusagePrefixLog(log.Printf)
|
logf := wgengine.RusagePrefixLog(log.Printf)
|
||||||
|
|
||||||
|
@ -47,7 +50,7 @@ func main() {
|
||||||
if *fake {
|
if *fake {
|
||||||
e, err = wgengine.NewFakeUserspaceEngine(logf, 0, false)
|
e, err = wgengine.NewFakeUserspaceEngine(logf, 0, false)
|
||||||
} else {
|
} else {
|
||||||
e, err = wgengine.NewUserspaceEngine(logf, "ts0", 0, false)
|
e, err = wgengine.NewUserspaceEngine(logf, *tunname, *listenport, false)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("wgengine.New: %v\n", err)
|
log.Fatalf("wgengine.New: %v\n", err)
|
||||||
|
|
Loading…
Reference in New Issue