Skip to content

Preserve IPv6 wildcard binds in preconn-managed services - #21

Merged
Xeloan merged 2 commits into
mainfrom
copilot/check-preconnect-function-v6
Apr 27, 2026
Merged

Preserve IPv6 wildcard binds in preconn-managed services#21
Xeloan merged 2 commits into
mainfrom
copilot/check-preconnect-function-v6

Conversation

Copilot AI commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

tcpPreconn was rewriting explicit dual-stack listeners from [::]:port to 0.0.0.0:port, which dropped IPv6 ingress for tunnel and forward services using the default listen address. The preconn address parser also had no focused regression coverage for wildcard and IPv6 bind cases.

  • Problem

    • Preconn startup normalized :: as IPv4 wildcard instead of preserving the configured bind semantics.
    • Services generated with [::] in the backend became IPv4-only once handed to tcp_pool.
  • Code changes

    • Preconn listen parsing
      • Updated go-gost/x/socket/preconn_manager.go so parseListenAddr preserves an explicit IPv6 wildcard host (::).
      • Kept existing fallback behavior for empty host / 0.0.0.0 inputs to avoid changing legacy IPv4-default cases.
    • Regression coverage
      • Added go-gost/x/socket/preconn_manager_test.go.
      • Locked in behavior for:
        • :port
        • 0.0.0.0:port
        • [::]:port
        • [2001:db8::1]:port
  • Result

    • Preconn-managed tunnel and forward services now keep the backend’s intended bind address.
    • Default dual-stack listeners remain IPv6-capable instead of being collapsed to IPv4-only.
// before
if host == "" || host == "0.0.0.0" || host == "::" {
	host = "0.0.0.0"
}

// after
if host == "" || host == "0.0.0.0" {
	host = "0.0.0.0"
}

Copilot AI and others added 2 commits April 26, 2026 23:32
@Xeloan
Xeloan marked this pull request as ready for review April 27, 2026 00:04
@Xeloan
Xeloan merged commit 475c56c into main Apr 27, 2026
1 check passed
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.

2 participants