cmd/tailscale/cli: fix plain TCP serve status

Do not label plain TCP forwarding as TLS over TCP. Render status
annotations only when TLS termination or PROXY protocol is configured.

Fixes #20367

Change-Id: I3f6507365ceedc2950451810e9715afb85176fc5
Signed-off-by: coyaSONG <66289470+coyaSONG@users.noreply.github.com>
This commit is contained in:
coyaSONG 2026-07-14 14:32:40 +09:00 committed by Harry Harpham
parent a534ad5e86
commit f68e4d93fd
2 changed files with 9 additions and 6 deletions

View File

@ -1101,16 +1101,19 @@ func (e *serveEnv) messageForPort(sc *ipn.ServeConfig, st *ipnstate.Status, dnsN
output.WriteString(fmt.Sprintf("%s %-5s %s\n\n", "|--", t, d))
}
} else if tcpHandler != nil {
tlsStatus := "TLS over TCP"
var annotations []string
if tcpHandler.TerminateTLS != "" {
tlsStatus = "TLS terminated"
annotations = append(annotations, "TLS terminated")
}
if ver := tcpHandler.ProxyProtocol; ver != 0 {
tlsStatus = fmt.Sprintf("%s, PROXY protocol v%d", tlsStatus, ver)
annotations = append(annotations, fmt.Sprintf("PROXY protocol v%d", ver))
}
output.WriteString(fmt.Sprintf("|-- tcp://%s:%d (%s)\n", host, srvPort, tlsStatus))
output.WriteString(fmt.Sprintf("|-- tcp://%s:%d", host, srvPort))
if len(annotations) != 0 {
output.WriteString(fmt.Sprintf(" (%s)", strings.Join(annotations, ", ")))
}
output.WriteString("\n")
for _, a := range ips {
ipp := net.JoinHostPort(a.String(), strconv.Itoa(int(srvPort)))
output.WriteString(fmt.Sprintf("|-- tcp://%s\n", ipp))

View File

@ -1603,7 +1603,7 @@ func TestMessageForPort(t *testing.T) {
expected: strings.Join([]string{
msgServeAvailable,
"",
"|-- tcp://foo.test.ts.net:2200 (TLS over TCP)",
"|-- tcp://foo.test.ts.net:2200",
"|-- tcp://100.101.101.101:2200",
"|-- tcp://[fd7a:115c:a1e0:ab12:4843:cd96:6565:6565]:2200",
"|--> tcp://localhost:3000",