Skip to content

cmd/tailcat: accept a bare IPv6 address in socks --listen - #155

Open
RaphaelFakhri wants to merge 1 commit into
tailscale:mainfrom
RaphaelFakhri:socks-listen-bare-ipv6
Open

RaphaelFakhri wants to merge 1 commit into
tailscale:mainfrom
RaphaelFakhri:socks-listen-bare-ipv6

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

The socks --listen help says a bare address means an OS-assigned port. For an unbracketed IPv6 address such as ::1 or ::, normalizeListenAddrPort appended ":0", producing ::1:0, and the proxy exited with listen tcp: address ::1:0: too many colons in address.

This change joins a bare IP address with port 0 through net.JoinHostPort, which brackets IPv6 ([::1]:0). Hostnames, IPv4 addresses, bare ports, and bracketed IPv6 keep their current behavior.

Testing

  • Added ::1 and :: cases to TestNormalizeListenAddrPort. Both fail on main and pass with the change.
  • tailcat socks --listen=::1 true now runs the command instead of exiting with the listen error.
  • go test ./cmd/tailcat/, go vet ./cmd/tailcat, and gofmt -l are clean.

Fixes #154

The socks --listen flag documents that a bare address means an
OS-assigned port, but normalizeListenAddrPort appended ":0" to an
unbracketed IPv6 address, so --listen=::1 became "::1:0" and the
proxy exited with "too many colons in address". Join a bare IP
address with port 0 via net.JoinHostPort, which brackets IPv6.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

socks: --listen with a bare IPv6 address fails with "too many colons in address"

1 participant