diff --git a/.gitignore b/.gitignore index 39a4e8702..f9ca59c6d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ *.dylib cmd/tailscale/tailscale -cmd/tailscaled/tailscaled +cmd/tailscaled/tailscaled/tailscaled # Test binary, built with `go test -c` *.test diff --git a/cmd/tailscaled/depaware.txt b/cmd/tailscaled/depaware.txt index 0d9df8cd8..6656108b1 100644 --- a/cmd/tailscaled/depaware.txt +++ b/cmd/tailscaled/depaware.txt @@ -68,22 +68,23 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de inet.af/peercred from tailscale.com/ipn/ipnserver rsc.io/goversion/version from tailscale.com/version tailscale.com/atomicfile from tailscale.com/ipn+ + tailscale.com/cmd/tailscaled/tailscaled from tailscale.com/cmd/tailscaled tailscale.com/control/controlclient from tailscale.com/ipn/ipnlocal+ tailscale.com/derp from tailscale.com/derp/derphttp+ tailscale.com/derp/derphttp from tailscale.com/net/netcheck+ - tailscale.com/derp/derpmap from tailscale.com/cmd/tailscaled+ + tailscale.com/derp/derpmap from tailscale.com/cmd/tailscaled/tailscaled+ tailscale.com/disco from tailscale.com/derp+ tailscale.com/health from tailscale.com/control/controlclient+ tailscale.com/internal/deepprint from tailscale.com/ipn/ipnlocal+ tailscale.com/ipn from tailscale.com/ipn/ipnserver+ tailscale.com/ipn/ipnlocal from tailscale.com/ipn/ipnserver+ - tailscale.com/ipn/ipnserver from tailscale.com/cmd/tailscaled + tailscale.com/ipn/ipnserver from tailscale.com/cmd/tailscaled/tailscaled tailscale.com/ipn/ipnstate from tailscale.com/ipn+ tailscale.com/ipn/localapi from tailscale.com/ipn/ipnserver tailscale.com/ipn/policy from tailscale.com/ipn/ipnlocal tailscale.com/log/filelogger from tailscale.com/ipn/ipnserver tailscale.com/log/logheap from tailscale.com/control/controlclient - tailscale.com/logpolicy from tailscale.com/cmd/tailscaled + tailscale.com/logpolicy from tailscale.com/cmd/tailscaled/tailscaled tailscale.com/logtail from tailscale.com/logpolicy tailscale.com/logtail/backoff from tailscale.com/control/controlclient+ tailscale.com/logtail/filch from tailscale.com/logpolicy @@ -91,31 +92,31 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de tailscale.com/net/dnscache from tailscale.com/control/controlclient+ tailscale.com/net/dnsfallback from tailscale.com/control/controlclient tailscale.com/net/flowtrack from tailscale.com/wgengine/filter+ - 💣 tailscale.com/net/interfaces from tailscale.com/cmd/tailscaled+ + 💣 tailscale.com/net/interfaces from tailscale.com/cmd/tailscaled/tailscaled+ tailscale.com/net/netcheck from tailscale.com/wgengine/magicsock tailscale.com/net/netns from tailscale.com/control/controlclient+ 💣 tailscale.com/net/netstat from tailscale.com/ipn/ipnserver tailscale.com/net/packet from tailscale.com/wgengine+ tailscale.com/net/portmapper from tailscale.com/net/netcheck+ - tailscale.com/net/socks5 from tailscale.com/cmd/tailscaled + tailscale.com/net/socks5 from tailscale.com/cmd/tailscaled/tailscaled tailscale.com/net/stun from tailscale.com/net/netcheck+ tailscale.com/net/tlsdial from tailscale.com/control/controlclient+ tailscale.com/net/tsaddr from tailscale.com/ipn/ipnlocal+ 💣 tailscale.com/net/tshttpproxy from tailscale.com/control/controlclient+ - tailscale.com/paths from tailscale.com/cmd/tailscaled+ + tailscale.com/paths from tailscale.com/cmd/tailscaled/tailscaled+ tailscale.com/portlist from tailscale.com/ipn/ipnlocal tailscale.com/safesocket from tailscale.com/ipn/ipnserver tailscale.com/smallzstd from tailscale.com/ipn/ipnserver+ tailscale.com/syncs from tailscale.com/net/interfaces+ tailscale.com/tailcfg from tailscale.com/control/controlclient+ - W 💣 tailscale.com/tempfork/wireguard-windows/firewall from tailscale.com/cmd/tailscaled + W 💣 tailscale.com/tempfork/wireguard-windows/firewall from tailscale.com/cmd/tailscaled/tailscaled W tailscale.com/tsconst from tailscale.com/net/interfaces tailscale.com/tstime from tailscale.com/wgengine/magicsock tailscale.com/types/empty from tailscale.com/control/controlclient+ - tailscale.com/types/flagtype from tailscale.com/cmd/tailscaled + tailscale.com/types/flagtype from tailscale.com/cmd/tailscaled/tailscaled tailscale.com/types/ipproto from tailscale.com/net/flowtrack+ tailscale.com/types/key from tailscale.com/derp+ - tailscale.com/types/logger from tailscale.com/cmd/tailscaled+ + tailscale.com/types/logger from tailscale.com/cmd/tailscaled/tailscaled+ tailscale.com/types/netmap from tailscale.com/control/controlclient+ tailscale.com/types/nettype from tailscale.com/wgengine/magicsock tailscale.com/types/opt from tailscale.com/control/controlclient+ @@ -132,14 +133,14 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de tailscale.com/util/racebuild from tailscale.com/logpolicy tailscale.com/util/systemd from tailscale.com/control/controlclient+ tailscale.com/util/winutil from tailscale.com/logpolicy - tailscale.com/version from tailscale.com/cmd/tailscaled+ + tailscale.com/version from tailscale.com/cmd/tailscaled/tailscaled+ tailscale.com/version/distro from tailscale.com/control/controlclient+ - tailscale.com/wgengine from tailscale.com/cmd/tailscaled+ + tailscale.com/wgengine from tailscale.com/cmd/tailscaled/tailscaled+ tailscale.com/wgengine/filter from tailscale.com/control/controlclient+ - tailscale.com/wgengine/magicsock from tailscale.com/cmd/tailscaled+ + tailscale.com/wgengine/magicsock from tailscale.com/cmd/tailscaled/tailscaled+ tailscale.com/wgengine/monitor from tailscale.com/wgengine+ - tailscale.com/wgengine/netstack from tailscale.com/cmd/tailscaled - tailscale.com/wgengine/router from tailscale.com/cmd/tailscaled+ + tailscale.com/wgengine/netstack from tailscale.com/cmd/tailscaled/tailscaled + tailscale.com/wgengine/router from tailscale.com/cmd/tailscaled/tailscaled+ tailscale.com/wgengine/router/dns from tailscale.com/ipn/ipnlocal+ tailscale.com/wgengine/tsdns from tailscale.com/ipn/ipnlocal+ tailscale.com/wgengine/tstun from tailscale.com/wgengine+ @@ -175,7 +176,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de LD golang.org/x/sys/unix from github.com/jsimonetti/rtnetlink/internal/unix+ W golang.org/x/sys/windows from github.com/tailscale/wireguard-go/conn+ W golang.org/x/sys/windows/registry from golang.zx2c4.com/wireguard/windows/tunnel/winipcfg+ - W golang.org/x/sys/windows/svc from tailscale.com/cmd/tailscaled + W golang.org/x/sys/windows/svc from tailscale.com/cmd/tailscaled/tailscaled golang.org/x/term from tailscale.com/logpolicy golang.org/x/text/secure/bidirule from golang.org/x/net/idna golang.org/x/text/transform from golang.org/x/text/secure/bidirule+ @@ -223,7 +224,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de encoding/pem from crypto/tls+ errors from bufio+ expvar from tailscale.com/derp+ - flag from tailscale.com/cmd/tailscaled+ + flag from tailscale.com/cmd/tailscaled/tailscaled+ fmt from compress/flate+ hash from compress/zlib+ hash/adler32 from compress/zlib @@ -246,12 +247,12 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de net/http from expvar+ net/http/httptrace from github.com/tcnksm/go-httpstat+ net/http/internal from net/http - net/http/pprof from tailscale.com/cmd/tailscaled + net/http/pprof from tailscale.com/cmd/tailscaled/tailscaled net/textproto from golang.org/x/net/http/httpguts+ net/url from crypto/x509+ os from crypto/rand+ os/exec from github.com/coreos/go-iptables/iptables+ - os/signal from tailscale.com/cmd/tailscaled+ + os/signal from tailscale.com/cmd/tailscaled/tailscaled+ os/user from github.com/godbus/dbus/v5+ path from debug/dwarf+ path/filepath from crypto/x509+ diff --git a/cmd/tailscaled/tailscaled-main.go b/cmd/tailscaled/tailscaled-main.go new file mode 100644 index 000000000..504ff174d --- /dev/null +++ b/cmd/tailscaled/tailscaled-main.go @@ -0,0 +1,19 @@ +// Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// The tailscaled program is the Tailscale daemon. It's configured +// and controlled via either the tailscale CLI program or GUIs. +package main // import "tailscale.com/cmd/tailscaled" + +import "tailscale.com/cmd/tailscaled/tailscaled" + +// Don't add any new imports or code to this file. The real +// code is in tailscale.com/cmd/tailscale/tailscaled as a package +// so things can depend on it for dependency reasons. +// (Go programs can't import package main so we split the real code +// off where we could have a dummy package empty import it) + +func main() { + tailscaled.Main() +} diff --git a/cmd/tailscaled/debug.go b/cmd/tailscaled/tailscaled/debug.go similarity index 99% rename from cmd/tailscaled/debug.go rename to cmd/tailscaled/tailscaled/debug.go index 3419dfb3b..85d6a66ae 100644 --- a/cmd/tailscaled/debug.go +++ b/cmd/tailscaled/tailscaled/debug.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package main +package tailscaled import ( "context" diff --git a/cmd/tailscaled/install_darwin.go b/cmd/tailscaled/tailscaled/install_darwin.go similarity index 99% rename from cmd/tailscaled/install_darwin.go rename to cmd/tailscaled/tailscaled/install_darwin.go index c373c78e8..c2442de73 100644 --- a/cmd/tailscaled/install_darwin.go +++ b/cmd/tailscaled/tailscaled/install_darwin.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package main +package tailscaled import ( "errors" diff --git a/cmd/tailscaled/tailscaled.go b/cmd/tailscaled/tailscaled/tailscaled.go similarity index 97% rename from cmd/tailscaled/tailscaled.go rename to cmd/tailscaled/tailscaled/tailscaled.go index a760db708..d0b5330d8 100644 --- a/cmd/tailscaled/tailscaled.go +++ b/cmd/tailscaled/tailscaled/tailscaled.go @@ -2,12 +2,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// The tailscaled program is the Tailscale client daemon. It's configured -// and controlled via the tailscale CLI program. -// -// It primarily supports Linux, though other systems will likely be -// supported in the future. -package main // import "tailscale.com/cmd/tailscaled" +// Package tailscaled is the Tailscale daemon. It's configured +// and controlled via the tailscale CLI program and GUIs. +package tailscaled // import "tailscale.com/cmd/tailscaled/tailscaled" import ( "context" @@ -98,7 +95,7 @@ func defaultTunName() string { "debug": &debugModeFunc, } -func main() { +func Main() { // We aren't very performance sensitive, and the parts that are // performance sensitive (wireguard) try hard not to do any memory // allocations. So let's be aggressive about garbage collection, diff --git a/cmd/tailscaled/tailscaled_notwindows.go b/cmd/tailscaled/tailscaled/tailscaled_notwindows.go similarity index 88% rename from cmd/tailscaled/tailscaled_notwindows.go rename to cmd/tailscaled/tailscaled/tailscaled_notwindows.go index 58221a2ea..444ef4f37 100644 --- a/cmd/tailscaled/tailscaled_notwindows.go +++ b/cmd/tailscaled/tailscaled/tailscaled_notwindows.go @@ -4,7 +4,7 @@ // +build !windows -package main // import "tailscale.com/cmd/tailscaled" +package tailscaled import "tailscale.com/logpolicy" diff --git a/cmd/tailscaled/tailscaled_windows.go b/cmd/tailscaled/tailscaled/tailscaled_windows.go similarity index 99% rename from cmd/tailscaled/tailscaled_windows.go rename to cmd/tailscaled/tailscaled/tailscaled_windows.go index cf97bef4a..7bf9add5e 100644 --- a/cmd/tailscaled/tailscaled_windows.go +++ b/cmd/tailscaled/tailscaled/tailscaled_windows.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package main // import "tailscale.com/cmd/tailscaled" +package tailscaled // TODO: check if administrator, like tswin does. //