mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6751] [MERGED] fix(service): overlay WireGuard peer public key from the inbound #6439
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#6439
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/6751
Author: @mvanhorn
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @MHSanaei
Base:
main← Head:fix/6731-wireguard-inbound-public-key📝 Commits (2)
2a6a9d5web: overlay WireGuard peer public key from the inbound7a490c4Merge branch 'main' into fix/6731-wireguard-inbound-public-key📊 Changes
2 files changed (+46 additions, -6 deletions)
View changed files
📝
internal/web/service/xray.go(+8 -0)📝
internal/web/service/xray_wireguard_config_test.go(+38 -6)📄 Description
Summary
The WireGuard branch now copies PublicKey from the matching inbound settings client. When that entry's KeepAlive is nil the peer keepalive is cleared, and when it is set the integer is copied into a new pointer. The dual-tunnel test seeds different keys and keepalives, checks that the shared row still has the AmneziaWG identity, and expects the emitted WireGuard peer to use the WireGuard public key and keepalive, including a case where the WireGuard settings entry has no keepalive and the peer omits it.
Closes #6731
Why
A client attached to both a WireGuard inbound and an AmneziaWG inbound gets a WireGuard peer in the generated Xray config whose public key is the AmneziaWG identity, and the peer can also keep the other tunnel's keepalive. The subscription still gives that client the WireGuard inbound's private key, so the WireGuard handshake is never answered. GetXrayConfig builds the WireGuard peer from the shared clients row and only overwrites AllowedIPs and PreSharedKey from the inbound settings entry for that email. PublicKey and KeepAlive stay as stored on the shared row, which holds the tunnel identity of whichever WireGuard or AmneziaWG inbound was synced last, and WireguardPeerFromClient emits those leftover fields. A keepalive missing from this inbound's settings therefore also leaves the other tunnel's interval in place.
Type of change
Areas affected
How was this tested?
gofmt -l on the changed WireGuard config files printed nothing.
go vet ./internal/web/service/... printed no diagnostics.
go test ./internal/web/service/... passed.
Screenshots / recordings
No user-visible surface changes in this PR, so there is nothing to show.
Breaking changes
Covered in the summary above.
Checklist
go build ./...and the test suite pass locally.Not claimed:
go build ./...is a different command from the local runs that passed,gofmt,go vetandgo test.npm run lint,npm run typecheck, andnpm run buildpass.Not claimed:
npm run lintis a different command from the local runs that passed,gofmt,go vetandgo test.AI disclosure
AI was used for assistance.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.