[PR #6850] [MERGED] fix(outbound): correctly dial IPv6 literals in TCP probes #6481

Closed
opened 2026-11-02 04:09:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6850
Author: @HamedSanaei
Created: 10/16/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @MHSanaei

Base: main ← Head: fix/outbound-ipv6-probes


📝 Commits (3)

  • 17adc54 fix(outbound): handle IPv6 literals in TCP probes
  • 082ecfc Merge remote-tracking branch 'origin/main' into pr/6850
  • e50f949 test(outbound): keep only the IPv6 probe tests that can fail

📊 Changes

2 files changed (+150 additions, -1 deletions)

View changed files

📝 internal/web/service/outbound/outbound.go (+7 -1)
📝 internal/web/service/outbound/outbound_endpoints_test.go (+143 -0)

📄 Description

Summary

Fix false-negative TCP connectivity results for outbound servers configured with unbracketed IPv6 literals.

Previously, the TCP probe constructed a dial address with string formatting (host:port), producing an invalid dial target when host was an IPv6 literal. The outbound itself could still carry traffic.

Changes

  • Construct TCP dial addresses using Go's net.JoinHostPort and handle already-bracketed IPv6 literals without double brackets.
  • Preserve IPv4, DNS, port, existing outbound settings, and genuine connection-failure reporting.
  • Add regression tests for raw/bracketed IPv6, protocols sharing endpoint extraction, single/batch TCP probing, real IPv6 loopback connections, IPv4/DNS, malformed inputs and refused connections.
  • Add Xray-backed HTTP and Real Delay regression coverage to verify those existing paths with standard IPv6 outbounds.

Scope / Root cause

Only the TCP probe implementation required a fix. HTTP and Real Delay use separate temporary-Xray-based probe paths; their production code is unchanged.

During validation, a separate reverse-tunnel outbound produced HTTP/Real Delay failures with both IPv6 spellings. Its reverse tag/configuration caused those failures, not IPv6 bracket handling; this PR does not attempt to change reverse-tunnel probing.

Validation

All completed successfully on Windows (Go 1.27.2, GCC 16.2.0, CGO enabled):

  • go test ./internal/web/service/outbound -count=1
  • go test ./...
  • go build ./...
  • go vet ./...
  • git diff --check
  • TestOutboundProbesIPv6ThroughXray with an Xray 26.10.10 executable built from the pinned module: HTTP and Real Delay pass for raw and bracketed IPv6 on the standard local test setup.

Additional live VPS checks on the reported endpoint confirmed that TCP succeeded with both IPv6 formats (three repetitions each); reverse-tunnel HTTP/Real Delay failures were independent of address formatting.

Compatibility

No persistent configuration changes, dependency updates, or intentional breaking changes.

Related to #4766.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6850 **Author:** [@HamedSanaei](https://github.com/HamedSanaei) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/outbound-ipv6-probes` --- ### 📝 Commits (3) - [`17adc54`](https://github.com/MHSanaei/3x-ui/commit/17adc5428ab91cb2a0a356d99ac6b126ebbd23fd) fix(outbound): handle IPv6 literals in TCP probes - [`082ecfc`](https://github.com/MHSanaei/3x-ui/commit/082ecfc8d1dd6081dccebe55ba2bc593e79680e0) Merge remote-tracking branch 'origin/main' into pr/6850 - [`e50f949`](https://github.com/MHSanaei/3x-ui/commit/e50f949a04174e26de247b40baa2e260415174e9) test(outbound): keep only the IPv6 probe tests that can fail ### 📊 Changes **2 files changed** (+150 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `internal/web/service/outbound/outbound.go` (+7 -1) 📝 `internal/web/service/outbound/outbound_endpoints_test.go` (+143 -0) </details> ### 📄 Description ## Summary Fix false-negative TCP connectivity results for outbound servers configured with unbracketed IPv6 literals. Previously, the TCP probe constructed a dial address with string formatting (`host:port`), producing an invalid dial target when `host` was an IPv6 literal. The outbound itself could still carry traffic. ## Changes - Construct TCP dial addresses using Go's `net.JoinHostPort` and handle already-bracketed IPv6 literals without double brackets. - Preserve IPv4, DNS, port, existing outbound settings, and genuine connection-failure reporting. - Add regression tests for raw/bracketed IPv6, protocols sharing endpoint extraction, single/batch TCP probing, real IPv6 loopback connections, IPv4/DNS, malformed inputs and refused connections. - Add Xray-backed HTTP and Real Delay regression coverage to verify those *existing* paths with standard IPv6 outbounds. ## Scope / Root cause Only the TCP probe implementation required a fix. HTTP and Real Delay use separate temporary-Xray-based probe paths; their production code is unchanged. During validation, a separate reverse-tunnel outbound produced HTTP/Real Delay failures with **both** IPv6 spellings. Its reverse tag/configuration caused those failures, not IPv6 bracket handling; this PR does not attempt to change reverse-tunnel probing. ## Validation All completed successfully on Windows (Go 1.27.2, GCC 16.2.0, CGO enabled): - `go test ./internal/web/service/outbound -count=1` - `go test ./...` - `go build ./...` - `go vet ./...` - `git diff --check` - `TestOutboundProbesIPv6ThroughXray` with an Xray 26.10.10 executable built from the pinned module: HTTP and Real Delay pass for raw and bracketed IPv6 on the standard local test setup. Additional live VPS checks on the reported endpoint confirmed that TCP succeeded with both IPv6 formats (three repetitions each); reverse-tunnel HTTP/Real Delay failures were independent of address formatting. ## Compatibility No persistent configuration changes, dependency updates, or intentional breaking changes. Related to #4766. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:09:06 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6481
No description provided.