Realm finalmask: Fix client punch peers (#6213)

Fixes https://github.com/XTLS/Xray-core/pull/6137
This commit is contained in:
LjhAUMEM
2026-05-30 17:30:23 +08:00
committed by GitHub
parent d43a808ea5
commit ba538619eb
2 changed files with 4 additions and 8 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ func (c *realmConnClient) getpeer() (net.PacketConn, error) {
}
start = time.Now()
peer, err := c.punch(meta, peers)
peer, err := c.punch(meta, expandedPeers)
if err != nil {
return nil, errors.New("punch fail").Base(err)
}
+3 -7
View File
@@ -167,7 +167,9 @@ func expandSymmetricNATCandidates(candidates []netip.AddrPort, seen map[netip.Ad
added++
}
}
sortAddrPorts(candidates)
slices.SortFunc(candidates, func(a, b netip.AddrPort) int {
return strings.Compare(a.String(), b.String())
})
return candidates
}
@@ -197,12 +199,6 @@ func predictablePortGroup(ports []uint16) bool {
return true
}
func sortAddrPorts(addrs []netip.AddrPort) {
slices.SortFunc(addrs, func(a, b netip.AddrPort) int {
return strings.Compare(a.String(), b.String())
})
}
func addrPortStrings(addrs []netip.AddrPort) []string {
out := make([]string, 0, len(addrs))
for _, addr := range addrs {