fix(amneziawg): keep port forwards per inbound and off future relay ports

Attach and BulkAttach copied a client record's forwardedPorts onto the
target inbound. A client a node reports keeps the forwards the node
chose, so attaching it to one of the master's AmneziaWG inbounds opened
listeners of the node's choosing on the master, among them the
loopback relay port a later AmneziaWG or TUIC inbound derives from its
id; that inbound's traffic then went to the forward and Xray failed to
bind.

A forward is set per inbound and is no longer carried by an attach, and
creating an AmneziaWG or TUIC inbound is refused while a peer forward
already holds its relay port.
This commit is contained in:
MHSanaei
2026-11-01 01:22:51 +01:00
parent 6dbd219a14
commit 30f17ef5a3
5 changed files with 134 additions and 2 deletions
+2
View File
@@ -111,6 +111,8 @@ func (s *ClientService) BulkAttach(inboundSvc *InboundService, emails []string,
continue
}
client := *rec.ToClient()
// Forwards are set per inbound; see Attach.
client.ForwardedPorts = ""
if flow, ok := flowsByEmail[rec.Email]; ok && flow != "" {
client.Flow = flow
}