mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6976] [MERGED] fix(link): keep IPv6 brackets in imported wireguard endpoints #6558
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#6558
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?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6976
Author: @jayhemnani9910
Created: 10/27/2026
Status: ✅ Merged
Merged: 11/3/2026
Merged by: @MHSanaei
Base:
main← Head:fix/wireguard-ipv6-endpoint📝 Commits (2)
e3c04e7fix(link): keep IPv6 brackets in imported wireguard endpoints65abcddMerge remote-tracking branch 'origin/main' into pr/6976📊 Changes
2 files changed (+24 additions, -1 deletions)
View changed files
📝
internal/util/link/outbound.go(+2 -1)📝
internal/util/link/outbound_helpers_test.go(+22 -0)📄 Description
Summary
A wireguard link with an IPv6 server now imports with a usable endpoint,
[2001:db8::1]:51820instead of2001:db8::1:51820.Why
parseWireguardininternal/util/link/outbound.gobuilt the peer endpoint asu.Hostname() + ":" + port.Hostname()drops the brackets, sowireguard://key@[2001:db8::1]:51820?...became2001:db8::1:51820. Xray reads the endpoint withnet.ParseDestination("udp:" + endpoint), which fails on that:So an IPv6 wireguard server imported from a link or an outbound subscription could not connect. The panel's own link import (
parseWireguardLink, which uses the JSURL.hostname) keeps the brackets.The endpoint is now built with
net.JoinHostPort, as the outbound address list ininternal/web/service/outbound/outbound.goalready does. IPv4 and hostname endpoints are unchanged. The identity string of an IPv6 wireguard outbound includes the endpoint, so it changes once for those entries.Type of change
Areas affected
How was this tested?
TestParseWireguard_Endpointininternal/util/link/outbound_helpers_test.gocovers a hostname, IPv4, IPv6 and a link without a port. The IPv6 case fails on main and passes with the change.net.ParseDestinationaccepts the new endpointudp:[2001:db8::1]:51820and rejects the old one.go test -shuffle=on -count=1 ./...passes (52 packages).golangci-lint run ./internal/util/link/reports 0 issues.Breaking changes
None.
Checklist
go build ./...and the test suite pass locally.npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
[PR #6976] fix(link): keep IPv6 brackets in imported wireguard endpointsto [PR #6976] [MERGED] fix(link): keep IPv6 brackets in imported wireguard endpoints