mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #6051] [MERGED] fix(wireguard): preserve all Allowed IPs in share link, .conf, and subscription #6064
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#6064
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/6051
Author: @H-TTTTT
Created: 7/20/2026
Status: ✅ Merged
Merged: 7/21/2026
Merged by: @MHSanaei
Base:
main← Head:fix/wg-multi-allowed-ips📝 Commits (1)
aca4f0dfix(wireguard): preserve all Allowed IPs in share link, .conf, and subscription📊 Changes
4 files changed (+72 additions, -5 deletions)
View changed files
📝
frontend/src/lib/xray/inbound-link.ts(+3 -3)📝
frontend/src/test/inbound-link.test.ts(+37 -0)📝
internal/sub/service.go(+2 -2)📝
internal/sub/service_wireguard_test.go(+30 -0)📄 Description
Summary
The WireGuard client tunnel address is stored end-to-end as a string slice (
model.AllowedIPs []string, comma-split/joined in the DB layer), and the inbound UI hint explicitly documents comma-separated multi-value input. Three of the export paths only read index[0], silently dropping every address after the first — a dual-stack IPv4+IPv6 client never receives its second address in the exported text.genWireguardLinkshare linkaddressparam (frontend/src/lib/xray/inbound-link.ts)genWireguardConfigdownloadable.confAddress =line (frontend/src/lib/xray/inbound-link.ts)SubService.genWireguardLinkraw subscriptionaddressparam (internal/sub/service.go)The sibling JSON and Clash subscriptions already emit the full slice (
json_service.go,clash_service.go), andWireguardPeerFromClientpasses the whole slice into the real Xray peer config, so only the exported text was wrong. The actual proxying is unaffected.Changes
AllowedIPsentries instead of indexing[0]:,(no space), matching the model'sstrings.Join(..., \",\")and the existing multi-value link-param joins inservice.go..confAddress =line uses,(comma-space), matching theAllowedIPs = 0.0.0.0/0, ::/0line a few lines below in the samegenWireguardConfig.wireguardConfigFromLink) already treatsaddressas an opaque string, so the comma-joined value round-trips unchanged.TestGenWireguardLinkMultiAllowedIPs(Go) and agenWireguardLink + genWireguardConfig multi allowedIPsblock (frontend). Existing single-address snapshots are unchanged (joining a one-element slice is a no-op).Fixes #6031
Verification
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.