Skip to content

Commit 0aa3396

Browse files
authored
Fix for empty ts name when tailscale isn't running on windows (#370)
* Blind fix of proxy exit without error message * Reproed on windows and thus updating the message * Linter fix
1 parent 4e2cd83 commit 0aa3396

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

config/tailscale.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ func TailscaleServerName() string {
3636
log.Critf("Error getting tailscale status: %v", err)
3737
return ""
3838
}
39+
if status.Self == nil {
40+
log.Critf("No self info in tailscale status: %+v", status)
41+
return ""
42+
}
43+
if status.Self.DNSName == "" {
44+
log.Critf("No DNSName in tailscale self info - check if tailscale is running?")
45+
return ""
46+
}
3947
// Remove the trailing dot as it's not there in ServerName.
4048
return strings.TrimSuffix(status.Self.DNSName, ".")
4149
}

proxy_main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ func main() {
115115
ErrorLog: log.NewStdLogger("rp", log.Error),
116116
}
117117

118-
log.Printf("Fortio Proxy %s started - hostid %q - tailscale %t", cli.LongVersion, rp.HostID.Get(), config.HasTailscale)
118+
log.Printf("Fortio Proxy %s started - hostid %q - tailscale capable: %t, on: %t",
119+
cli.LongVersion, rp.HostID.Get(), config.HasTailscale, *autoTailscale)
119120

120121
if *httpPort != disabled {
121122
fhttp.HTTPServerWithHandler("http-reverse-proxy", *httpPort, hdlr)

0 commit comments

Comments
 (0)