feat: swap station urls

This commit is contained in:
Maple Nebel 2026-07-31 14:58:31 +02:00
parent 26b651f2d5
commit fb3680d673

View File

@ -1,6 +1,9 @@
package nex
import (
"slices"
"github.com/PretendoNetwork/nex-go/v2"
"github.com/PretendoNetwork/nex-go/v2/types"
commonmatchmaking "github.com/PretendoNetwork/nex-protocols-common-go/v2/match-making"
commonmatchmakingext "github.com/PretendoNetwork/nex-protocols-common-go/v2/match-making-ext"
@ -28,11 +31,17 @@ func cleanupMatchmakeSessionSearchCriteriasHandler(searchCriterias types.List[ma
}
}
func adjustPublicStationFirst(packet nex.PacketInterface, urls types.List[types.StationURL], dataHolder types.DataHolder) {
connection := packet.Sender().(*nex.PRUDPConnection)
slices.Reverse(connection.StationURLs)
}
func registerCommonSecureServerProtocols() {
secureProtocol := secure.NewProtocol()
globals.SecureEndpoint.RegisterServiceProtocol(secureProtocol)
commonSecureProtocol := commonsecure.NewCommonProtocol(secureProtocol)
commonSecureProtocol.EnableInsecureRegister()
commonSecureProtocol.OnAfterRegisterEx = adjustPublicStationFirst
commonSecureProtocol.CreateReportDBRecord = CreateReportDBRecord
natTraversalProtocol := nattraversal.NewProtocol()