@ -19,6 +19,8 @@ import (
// Prefs are the user modifiable settings of the Tailscale node agent.
// Prefs are the user modifiable settings of the Tailscale node agent.
type Prefs struct {
type Prefs struct {
// ControlURL is the URL of the control server to use.
ControlURL string
// RouteAll specifies whether to accept subnet and default routes
// RouteAll specifies whether to accept subnet and default routes
// advertised by other nodes on the Tailscale network.
// advertised by other nodes on the Tailscale network.
RouteAll bool
RouteAll bool
@ -91,6 +93,7 @@ func (p *Prefs) Equals(p2 *Prefs) bool {
}
}
return p != nil && p2 != nil &&
return p != nil && p2 != nil &&
p . ControlURL == p2 . ControlURL &&
p . RouteAll == p2 . RouteAll &&
p . RouteAll == p2 . RouteAll &&
p . AllowSingleHosts == p2 . AllowSingleHosts &&
p . AllowSingleHosts == p2 . AllowSingleHosts &&
p . CorpDNS == p2 . CorpDNS &&
p . CorpDNS == p2 . CorpDNS &&
@ -118,6 +121,7 @@ func NewPrefs() Prefs {
// Provide default values for options which are normally
// Provide default values for options which are normally
// true, but might be missing from the json data for any
// true, but might be missing from the json data for any
// reason. The json can still override them to false.
// reason. The json can still override them to false.
ControlURL : "https://login.tailscale.com" ,
RouteAll : true ,
RouteAll : true ,
AllowSingleHosts : true ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
@ -142,6 +146,11 @@ func PrefsFromBytes(b []byte, enforceDefaults bool) (Prefs, error) {
log . Printf ( "Prefs parse: %v: %v\n" , err , b )
log . Printf ( "Prefs parse: %v: %v\n" , err , b )
}
}
}
}
if p . ControlURL == "" {
// TODO(danderson): compat shim, remove after
// Options.ServerURL has been gone for a release.
p . ControlURL = "https://login.tailscale.com"
}
if enforceDefaults {
if enforceDefaults {
p . RouteAll = true
p . RouteAll = true
p . AllowSingleHosts = true
p . AllowSingleHosts = true