mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-10-12 17:05:01 +03:00
fix(amneziawg): fall back to a free egress port when 64900 is refused
The panel's SOCKS5 egress for AmneziaWG outbounds bound the fixed 127.0.0.1:64900, and every generated socks bridge dialed that constant. 64900 sits inside Windows' dynamic port range, where the OS can reserve whole blocks (this host excludes 64885-64984), so on the Windows builds release.yml ships the listener could stay down and every AmneziaWG outbound with it. Listen now tries 64900 first and falls back to any free loopback port; bridges, the outbound probe and the port-conflict check use EgressPort(), the port actually held. Bridges are generated apart from the listener, so BuildSocksBridge records the port it wrote and the AmneziaWG job requests an Xray restart while the listener holds a different one. Where 64900 is free nothing changes. The job's restart request is two lines of wiring no test reaches; the staleness it acts on is pinned by TestBridgesStaleUntilRegeneratedForTheBoundPort.
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
||||
type AmneziaWGJob struct {
|
||||
inboundService service.InboundService
|
||||
settingService service.SettingService
|
||||
xrayService service.XrayService
|
||||
}
|
||||
|
||||
// NewAmneziaWGJob creates a new AmneziaWG reconcile job instance.
|
||||
@@ -55,6 +56,10 @@ func (j *AmneziaWGJob) Run() {
|
||||
return
|
||||
}
|
||||
amneziawgnet.GetOutboundManager().Reconcile(outboundDesired)
|
||||
// Xray's bridges are generated apart from the listener; one that moved needs them regenerated.
|
||||
if amneziawgnet.BridgesStale() {
|
||||
j.xrayService.SetToNeedRestart()
|
||||
}
|
||||
}
|
||||
|
||||
// desiredOutboundInstances derives client instances per template "amneziawg" outbound.
|
||||
|
||||
Reference in New Issue
Block a user