cmd/tailscale, cmd/tailscaled, paths: add paths package for default paths

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2020-03-03 09:33:09 -08:00
parent 06092a3af3
commit 65e7c58aa4
4 changed files with 83 additions and 4 deletions
+2 -1
View File
@@ -23,6 +23,7 @@ import (
"github.com/tailscale/wireguard-go/wgcfg"
"tailscale.com/ipn"
"tailscale.com/logpolicy"
"tailscale.com/paths"
"tailscale.com/safesocket"
)
@@ -56,7 +57,7 @@ func main() {
}
upf := flag.NewFlagSet("up", flag.ExitOnError)
upf.StringVar(&upArgs.socket, "socket", "/run/tailscale/tailscaled.sock", "path to tailscaled's unix socket")
upf.StringVar(&upArgs.socket, "socket", paths.DefaultTailscaledSocket(), "path to tailscaled's unix socket")
upf.StringVar(&upArgs.server, "login-server", "https://login.tailscale.com", "base URL of control server")
upf.BoolVar(&upArgs.acceptRoutes, "accept-routes", false, "accept routes advertised by other Tailscale nodes")
upf.BoolVar(&upArgs.noSingleRoutes, "no-single-routes", false, "don't install routes to single nodes")
+4 -3
View File
@@ -19,6 +19,7 @@ import (
"github.com/pborman/getopt/v2"
"tailscale.com/ipn/ipnserver"
"tailscale.com/logpolicy"
"tailscale.com/paths"
"tailscale.com/wgengine"
"tailscale.com/wgengine/magicsock"
)
@@ -37,8 +38,8 @@ func main() {
debug := getopt.StringLong("debug", 0, "", "Address of debug server")
tunname := getopt.StringLong("tun", 0, "tailscale0", "tunnel interface name")
listenport := getopt.Uint16Long("port", 'p', magicsock.DefaultPort, "WireGuard port (0=autoselect)")
statepath := getopt.StringLong("state", 0, "", "Path of state file")
socketpath := getopt.StringLong("socket", 's', "tailscaled.sock", "Path of the service unix socket")
statepath := getopt.StringLong("state", 0, paths.DefaultTailscaledStateFile(), "Path of state file")
socketpath := getopt.StringLong("socket", 's', paths.DefaultTailscaledSocket(), "Path of the service unix socket")
logf := wgengine.RusagePrefixLog(log.Printf)
@@ -80,7 +81,7 @@ func main() {
SocketPath: *socketpath,
StatePath: *statepath,
AutostartStateKey: globalStateKey,
LegacyConfigPath: "/var/lib/tailscale/relay.conf",
LegacyConfigPath: paths.LegacyConfigPath,
SurviveDisconnects: true,
}
err = ipnserver.Run(context.Background(), logf, pol.PublicID.String(), opts, e)