safesocket: simplify API.

On unix, we want to provide a full path to the desired unix socket.

On windows, currently we want to provide a TCP port, but someday
we'll also provide a "path-ish" object for a named pipe.

For now, simplify the API down to exactly a path and a TCP port.

Signed-off-by: David Anderson <dave@natulte.net>
This commit is contained in:
David Anderson
2020-02-18 12:33:28 -08:00
committed by Dave Anderson
parent b72e6446e2
commit 4460bd638b
6 changed files with 29 additions and 23 deletions

View File

@@ -38,6 +38,7 @@ func main() {
tunname := getopt.StringLong("tun", 0, "ts0", "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', "/run/tailscale/tailscaled.sock", "Path of the service unix socket")
logf := wgengine.RusagePrefixLog(log.Printf)
@@ -56,6 +57,10 @@ func main() {
log.Fatalf("--state is required")
}
if *socketpath == "" {
log.Fatalf("--socket is required")
}
if *debug != "" {
go runDebugServer(*debug)
}
@@ -72,6 +77,7 @@ func main() {
e = wgengine.NewWatchdog(e)
opts := ipnserver.Options{
SocketPath: *socketpath,
StatePath: *statepath,
AutostartStateKey: globalStateKey,
SurviveDisconnects: true,