diff --git a/ipn/prefs.go b/ipn/prefs.go index 8edbc14ab..6fc4ce69a 100644 --- a/ipn/prefs.go +++ b/ipn/prefs.go @@ -256,6 +256,9 @@ func (p *Prefs) pretty(goos string) string { if p.ControlURL != "" && p.ControlURL != "https://login.tailscale.com" { fmt.Fprintf(&sb, "url=%q ", p.ControlURL) } + if p.Hostname != "" { + fmt.Fprintf(&sb, "host=%q ", p.Hostname) + } if p.Persist != nil { sb.WriteString(p.Persist.Pretty()) } else { diff --git a/ipn/prefs_test.go b/ipn/prefs_test.go index 211a8a7e7..251bf9c13 100644 --- a/ipn/prefs_test.go +++ b/ipn/prefs_test.go @@ -393,6 +393,13 @@ func TestPrefsPretty(t *testing.T) { "linux", `Prefs{ra=false mesh=false dns=false want=false exit=myNodeABC routes=[] nf=off Persist=nil}`, }, + { + Prefs{ + Hostname: "foo", + }, + "linux", + `Prefs{ra=false mesh=false dns=false want=false routes=[] nf=off host="foo" Persist=nil}`, + }, } for i, tt := range tests { got := tt.p.pretty(tt.os)