mirror of
https://github.com/tailscale/tailscale.git
synced 2025-03-28 12:02:23 +00:00
ipn: add DefaultControlURL const, replace few literals with it
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
f1d45bc4bb
commit
4df6e62fbc
@ -57,7 +57,7 @@ var upFlagSet = (func() *flag.FlagSet {
|
|||||||
upf.BoolVar(&upArgs.forceReauth, "force-reauth", false, "force reauthentication")
|
upf.BoolVar(&upArgs.forceReauth, "force-reauth", false, "force reauthentication")
|
||||||
upf.BoolVar(&upArgs.reset, "reset", false, "reset unspecified settings to their default values")
|
upf.BoolVar(&upArgs.reset, "reset", false, "reset unspecified settings to their default values")
|
||||||
|
|
||||||
upf.StringVar(&upArgs.server, "login-server", "https://login.tailscale.com", "base URL of control server")
|
upf.StringVar(&upArgs.server, "login-server", ipn.DefaultControlURL, "base URL of control server")
|
||||||
upf.BoolVar(&upArgs.acceptRoutes, "accept-routes", false, "accept routes advertised by other Tailscale nodes")
|
upf.BoolVar(&upArgs.acceptRoutes, "accept-routes", false, "accept routes advertised by other Tailscale nodes")
|
||||||
upf.BoolVar(&upArgs.acceptDNS, "accept-dns", true, "accept DNS configuration from the admin panel")
|
upf.BoolVar(&upArgs.acceptDNS, "accept-dns", true, "accept DNS configuration from the admin panel")
|
||||||
upf.BoolVar(&upArgs.singleRoutes, "host-routes", true, "install host routes to other Tailscale nodes")
|
upf.BoolVar(&upArgs.singleRoutes, "host-routes", true, "install host routes to other Tailscale nodes")
|
||||||
|
@ -246,7 +246,7 @@ func webHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
// TODO(crawshaw): some of this is very similar to the code in 'tailscale up', can we share anything?
|
// TODO(crawshaw): some of this is very similar to the code in 'tailscale up', can we share anything?
|
||||||
func tailscaleUp(ctx context.Context) (authURL string, retErr error) {
|
func tailscaleUp(ctx context.Context) (authURL string, retErr error) {
|
||||||
prefs := ipn.NewPrefs()
|
prefs := ipn.NewPrefs()
|
||||||
prefs.ControlURL = "https://login.tailscale.com"
|
prefs.ControlURL = ipn.DefaultControlURL
|
||||||
prefs.WantRunning = true
|
prefs.WantRunning = true
|
||||||
prefs.CorpDNS = true
|
prefs.CorpDNS = true
|
||||||
prefs.AllowSingleHosts = true
|
prefs.AllowSingleHosts = true
|
||||||
|
@ -25,6 +25,11 @@ import (
|
|||||||
|
|
||||||
//go:generate go run tailscale.com/cmd/cloner -type=Prefs -output=prefs_clone.go
|
//go:generate go run tailscale.com/cmd/cloner -type=Prefs -output=prefs_clone.go
|
||||||
|
|
||||||
|
// DefaultControlURL returns the URL base of the control plane
|
||||||
|
// ("coordination server") for use when no explicit one is configured.
|
||||||
|
// The default control plane is the hosted version run by Tailscale.com.
|
||||||
|
const DefaultControlURL = "https://login.tailscale.com"
|
||||||
|
|
||||||
// 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 is the URL of the control server to use.
|
||||||
@ -258,7 +263,7 @@ func (p *Prefs) pretty(goos string) string {
|
|||||||
if goos == "linux" {
|
if goos == "linux" {
|
||||||
fmt.Fprintf(&sb, "nf=%v ", p.NetfilterMode)
|
fmt.Fprintf(&sb, "nf=%v ", p.NetfilterMode)
|
||||||
}
|
}
|
||||||
if p.ControlURL != "" && p.ControlURL != "https://login.tailscale.com" {
|
if p.ControlURL != "" && p.ControlURL != DefaultControlURL {
|
||||||
fmt.Fprintf(&sb, "url=%q ", p.ControlURL)
|
fmt.Fprintf(&sb, "url=%q ", p.ControlURL)
|
||||||
}
|
}
|
||||||
if p.Hostname != "" {
|
if p.Hostname != "" {
|
||||||
@ -340,7 +345,7 @@ func NewPrefs() *Prefs {
|
|||||||
// Provide default values for options which might be missing
|
// Provide default values for options which might be missing
|
||||||
// from the json data for any reason. The json can still
|
// from the json data for any reason. The json can still
|
||||||
// override them to false.
|
// override them to false.
|
||||||
ControlURL: "https://login.tailscale.com",
|
ControlURL: DefaultControlURL,
|
||||||
RouteAll: true,
|
RouteAll: true,
|
||||||
AllowSingleHosts: true,
|
AllowSingleHosts: true,
|
||||||
CorpDNS: true,
|
CorpDNS: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user