[GH-ISSUE #4766] [Bug]: #3304

Closed
opened 2026-10-31 20:31:30 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @mcroff88 on GitHub (Jun 1, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4766

Describe the bug

Testing connection in "outbound" via ipv6 failed, but connection is working. This problem since 3.0.0 release (ipv6 - "test connection" works fine in 2.9.4)

How to reproduce the problem

  1. Open Outbounds
  2. Find connection through ipv6
  3. CLick test connection

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.2.5

Xray-core version

26

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu 24

Which parts of the panel are affected?

No response

Browser (only if it is a UI bug)

Any

Is the panel behind a reverse proxy or CDN?

Yes — Cloudflare (proxied DNS)

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @mcroff88 on GitHub (Jun 1, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4766 ### Describe the bug Testing connection in "outbound" via ipv6 failed, but connection is working. This problem since 3.0.0 release (ipv6 - "test connection" works fine in 2.9.4) ### How to reproduce the problem 1. Open Outbounds 2. Find connection through ipv6 3. CLick test connection ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.2.5 ### Xray-core version 26 ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu 24 ### Which parts of the panel are affected? _No response_ ### Browser (only if it is a UI bug) Any ### Is the panel behind a reverse proxy or CDN? Yes — Cloudflare (proxied DNS) ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:31:30 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Jun 1, 2026):

Thanks for the detailed report!

Root cause identified: The default "Test Connection" mode is TCP, and the code that builds the dial address for TCP mode formats IPv6 addresses incorrectly.

In web/service/outbound.go, the addServer helper inside extractOutboundEndpoints produces:

2001:db8::1:443   ← invalid (bare IPv6 + port)

But Go's net.DialTimeout requires:

[2001:db8::1]:443  ← correct (bracketed IPv6 + port)

Because colons are already part of an IPv6 address, Go cannot parse the unbracketed form as host:port and the dial fails immediately — even though the outbound itself is perfectly reachable. The fix is to use net.JoinHostPort(host, port) (or wrap the host in […] when it contains a colon) so IPv6 addresses are formatted correctly.

Workaround (until a fix is released): In the outbound test dialog, switch the mode from TCP to HTTP before clicking "Test Connection". HTTP mode spins up a temporary xray instance to do the real protocol handshake, so it bypasses the broken address formatter and should correctly report the outbound as alive.

Could you confirm that using HTTP mode resolves the false-negative for you?

<!-- gh-comment-id:4593218504 --> @github-actions[bot] commented on GitHub (Jun 1, 2026): Thanks for the detailed report\! **Root cause identified:** The default "Test Connection" mode is TCP, and the code that builds the dial address for TCP mode formats IPv6 addresses incorrectly. In `web/service/outbound.go`, the `addServer` helper inside `extractOutboundEndpoints` produces: ``` 2001:db8::1:443 ← invalid (bare IPv6 + port) ``` But Go's `net.DialTimeout` requires: ``` [2001:db8::1]:443 ← correct (bracketed IPv6 + port) ``` Because colons are already part of an IPv6 address, Go cannot parse the unbracketed form as `host:port` and the dial fails immediately — even though the outbound itself is perfectly reachable. The fix is to use `net.JoinHostPort(host, port)` (or wrap the host in `[…]` when it contains a colon) so IPv6 addresses are formatted correctly. **Workaround (until a fix is released):** In the outbound test dialog, switch the mode from **TCP** to **HTTP** before clicking "Test Connection". HTTP mode spins up a temporary xray instance to do the real protocol handshake, so it bypasses the broken address formatter and should correctly report the outbound as alive. Could you confirm that using HTTP mode resolves the false-negative for you?
Author
Owner

@mcroff88 commented on GitHub (Jun 1, 2026):

Yep, switching to http works great, thank you!

<!-- gh-comment-id:4593308868 --> @mcroff88 commented on GitHub (Jun 1, 2026): Yep, switching to http works great, thank you!
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#3304
No description provided.