mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #6373] [Bug]: Error in parsing the Custom share address, clash, ipv6 node #4326
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#4326
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @oopb on GitHub (Aug 31, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6373
Describe the bug
The node custom share address is ipv6 of the VPS. When sharing the subscription link to clash verge, the ipv6 node does not work. Because 3xui will auto add [] on both sides of ipv6 address(can not remove []). And in clash yaml file it will be like: "[ipv6]", which can not be parsed normally.
If remove the [] manually, then ipv6 node works normally.
How to reproduce the problem
new inbound
Share address strategy: custom
Custom share address: ipv6 address of VPS
share subscription to clash verge
the node exits parsing error
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.7.0
Xray-core version
No response
How did you install 3x-ui?
install.sh script
Operating system
Debian 12
Which parts of the panel are affected?
Subscription (share links / Clash / JSON)
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
No response
Before submitting
@github-actions[bot] commented on GitHub (Aug 31, 2026):
Confirmed — this is a real bug and it is still present on the default branch (
f727d04f, v3.7.0). The Clash renderer copies the resolved share address into the proxy'sserver:field verbatim, and forShare address strategy: Customthe panel deliberately stores that address with brackets, so mihomo/Clash Verge receivesserver: "[2001:db8::1]"instead ofserver: 2001:db8::1. (I can't open images attached to an issue, so I did not read your screenshots — but the two behaviours you describe in text are exactly what the code does, so nothing further is needed from you.)The chain
customstrategy:destand writes it straight intoserver::The same
inbound.Listenis used atclash_service.go:315(hysteria / hysteria2) andclash_service.go:397(wireguard), so every protocol is affected.Raw share links are not affected, because they go through
joinHostPort, which strips any stored brackets and re-adds exactly one (internal/sub/service.go:1050-1052) — that helper exists because of the opposite complaint in #5305.A Clash
server:value is a bare host, not a URI authority, so it must not be bracketed — and the panel's other paths already treat it that way, which is why only the custom share address hits this:host := strings.Trim(endpoint[:i], "[]")(internal/sub/clash_external.go:235)parseHostAndPort(internal/web/service/host.go:117), pinned byTestParseHostAndPort_IPv6EdgeCases(internal/web/service/host_test.go:278:{"[2001:db8::1]", 8443, "2001:db8::1", 8443})netsafe.NormalizeHoststrips the brackets and returnsip.String()(internal/util/netsafe/netsafe.go:116-120), used atinternal/web/service/node.go:407Workaround until this is fixed
Set the inbound's Share address strategy back to
Node/Listenand put the IPv6 address on a Host row instead (Hosts page → Add Host → Address). A Host address is stored bare, so the Clash proxy getsserver: 2001:db8::1, while the raw/share link still comes out correctly bracketed viajoinHostPort. Editing the YAML by hand, as you did, works too but is undone on every subscription refresh.Verdict: Confirmed bug
Severity: Medium
Confidence: High
Root cause:
internal/sub/clash_service.go:187assignsworkingInbound.Listenfrom the resolveddestandclash_service.go:240(also:315,:397) emits it as the Clashserver:without stripping brackets. Triggered wheneverresolveInboundAddress(internal/sub/service.go:1298-1326) returns a bracketed host, which today is only thecustomshare-address strategy with an IPv6 literal, becausenormalizeInboundShareHoststores it as"[" + ip.String() + "]"(internal/web/service/inbound.go:97,107). Introduced with the strategy itself in2a7342ba feat: add inbound share address strategy (#5162).Already fixed: Still present on the default branch (
f727d04f, v3.7.0 — the reporter's version is the tip).Duplicate of: None. Related: #5305 (URI share links needed the brackets; the fix for it,
joinHostPort, is what keeps the raw format correct here).Evidence:
internal/web/service/inbound.go:107return "[" + ip.String() + "]", nil;internal/web/service/inbound_update_tag_test.go:176-177pins the bracketed storage as intended;internal/sub/service.go:1315candidates = []string{strings.TrimSpace(inbound.ShareAddr), nodeAddr, listenAddr};internal/sub/clash_service.go:187,:240,:315,:397;internal/sub/service.go:1050-1052host = strings.Trim(host, "[]")(why raw links are fine);internal/sub/clash_external.go:235,internal/web/service/host.go:117,internal/util/netsafe/netsafe.go:116-120(three places that already emit a bare host).Not determined: I could not run mihomo here, so mihomo's exact failure mode on a bracketed
server:is taken from your report rather than verified. The JSON subscription emits the same bracketed value as"address"(internal/sub/json_service.go:706,:732,:813); whether xray-core accepts that is untested here — fetching the JSON subscription for the same inbound and importing it would settle it.Suggested fix: strip the brackets once where the Clash renderer takes the dest (
internal/sub/clash_service.go:187), since all three proxy builders readinbound.Listenfrom there. Changing the stored form instead would be wider than the bug and would breakinternal/sub/service.go:781(fmt.Fprintf(&b, "Endpoint = %s:%d", host, port)), which relies on the brackets already being present.This reply was generated automatically; a maintainer may follow up.