mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-13 00:25:04 +03:00
fix: allow IPv4 and IPv6 inbounds to share a port (#6603)
* fix: distinguish IPv4 and IPv6 listen conflicts * fix(ports): let an IPv4 address share a port only with a v6only wildcard xray listens on tcp/udp, and Go opens every wildcard listen, 0.0.0.0 included, as one dual-stack socket unless sockopt.v6only is set. Treating :: and 0.0.0.0 as separate families let the panel save pairs the core then fails to bind, and it broke main's own TestListenOverlaps. listenOverlaps now takes the inbound's sockopt.v6only: a wildcard claims both families, or only IPv6 with v6only, so :: with v6only may share its port with an IPv4 address while a plain :: or 0.0.0.0 still may not. --------- Co-authored-by: MHSanaei <ho3ein.sanaei@gmail.com>
This commit is contained in:
@@ -66,7 +66,9 @@ func rawBindConflicts(cfg *xray.Config) []bindConflict {
|
||||
for j := i + 1; j < len(group); j++ {
|
||||
left, right := group[i], group[j]
|
||||
listenLeft, listenRight := configListen(left.Listen), configListen(right.Listen)
|
||||
if !listenOverlaps(listenLeft, listenRight) {
|
||||
bindLeft := bindAddr{listen: listenLeft, v6only: streamV6Only(string(left.StreamSettings))}
|
||||
bindRight := bindAddr{listen: listenRight, v6only: streamV6Only(string(right.StreamSettings))}
|
||||
if !listenOverlaps(bindLeft, bindRight) {
|
||||
continue
|
||||
}
|
||||
// One port carrying tcp on one inbound and udp on another is a
|
||||
|
||||
Reference in New Issue
Block a user