|
|
|
@ -44,15 +44,14 @@ func main() {
|
|
|
|
|
log.Printf("fixConsoleOutput: %v\n", err)
|
|
|
|
|
}
|
|
|
|
|
config := getopt.StringLong("config", 'f', "", "path to config file")
|
|
|
|
|
statekey := getopt.StringLong("statekey", 0, "", "state key for daemon-side config")
|
|
|
|
|
server := getopt.StringLong("server", 's', "https://login.tailscale.com", "URL to tailcontrol server")
|
|
|
|
|
nuroutes := getopt.BoolLong("no-single-routes", 'N', "disallow (non-subnet) routes to single nodes")
|
|
|
|
|
rroutes := getopt.BoolLong("remote-routes", 'R', "allow routing subnets to remote nodes")
|
|
|
|
|
droutes := getopt.BoolLong("default-routes", 'D', "allow default route on remote node")
|
|
|
|
|
getopt.Parse()
|
|
|
|
|
if *config == "" && *statekey == "" {
|
|
|
|
|
if *config == "" {
|
|
|
|
|
logpolicy.New("tailnode.log.tailscale.io", "tailscale")
|
|
|
|
|
log.Fatal("no --config or --statekey provided")
|
|
|
|
|
log.Fatal("no --config provided")
|
|
|
|
|
}
|
|
|
|
|
if len(getopt.Args()) > 0 {
|
|
|
|
|
log.Fatalf("too many non-flag arguments: %#v", getopt.Args()[0])
|
|
|
|
@ -61,8 +60,6 @@ func main() {
|
|
|
|
|
pol := logpolicy.New("tailnode.log.tailscale.io", *config)
|
|
|
|
|
defer pol.Close()
|
|
|
|
|
|
|
|
|
|
var prefs *ipn.Prefs
|
|
|
|
|
if *config != "" {
|
|
|
|
|
localCfg, err := loadConfig(*config)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
@ -70,11 +67,10 @@ func main() {
|
|
|
|
|
|
|
|
|
|
// TODO(apenwarr): fix different semantics between prefs and uflags
|
|
|
|
|
// TODO(apenwarr): allow setting/using CorpDNS
|
|
|
|
|
prefs = &localCfg
|
|
|
|
|
prefs := &localCfg
|
|
|
|
|
prefs.WantRunning = true
|
|
|
|
|
prefs.RouteAll = *rroutes || *droutes
|
|
|
|
|
prefs.AllowSingleHosts = !*nuroutes
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
c, err := safesocket.Connect("", "Tailscale", "tailscaled", 41112)
|
|
|
|
|
if err != nil {
|
|
|
|
@ -95,7 +91,6 @@ func main() {
|
|
|
|
|
|
|
|
|
|
bc := ipn.NewBackendClient(log.Printf, clientToServer)
|
|
|
|
|
opts := ipn.Options{
|
|
|
|
|
StateKey: ipn.StateKey(*statekey),
|
|
|
|
|
Prefs: prefs,
|
|
|
|
|
ServerURL: *server,
|
|
|
|
|
Notify: func(n ipn.Notify) {
|
|
|
|
|