mirror of
https://github.com/PretendoNetwork/splatoon.git
synced 2026-08-02 16:13:42 -05:00
71 lines
3.5 KiB
Go
71 lines
3.5 KiB
Go
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"
|
|
commonmatchmakeextension "github.com/PretendoNetwork/nex-protocols-common-go/v2/matchmake-extension"
|
|
commonnattraversal "github.com/PretendoNetwork/nex-protocols-common-go/v2/nat-traversal"
|
|
commonranking "github.com/PretendoNetwork/nex-protocols-common-go/v2/ranking"
|
|
commonsecure "github.com/PretendoNetwork/nex-protocols-common-go/v2/secure-connection"
|
|
matchmaking "github.com/PretendoNetwork/nex-protocols-go/v2/match-making"
|
|
matchmakingext "github.com/PretendoNetwork/nex-protocols-go/v2/match-making-ext"
|
|
match_making_types "github.com/PretendoNetwork/nex-protocols-go/v2/match-making/types"
|
|
matchmakeextension "github.com/PretendoNetwork/nex-protocols-go/v2/matchmake-extension"
|
|
nattraversal "github.com/PretendoNetwork/nex-protocols-go/v2/nat-traversal"
|
|
ranking "github.com/PretendoNetwork/nex-protocols-go/v2/ranking/splatoon"
|
|
secure "github.com/PretendoNetwork/nex-protocols-go/v2/secure-connection"
|
|
"github.com/PretendoNetwork/splatoon/globals"
|
|
)
|
|
|
|
func CreateReportDBRecord(_ types.PID, _ types.UInt32, _ types.QBuffer) error {
|
|
return nil
|
|
}
|
|
|
|
func cleanupMatchmakeSessionSearchCriteriasHandler(searchCriterias types.List[match_making_types.MatchmakeSessionSearchCriteria]) {
|
|
for _, searchCriteria := range searchCriterias {
|
|
searchCriteria.Attribs[4] = types.NewString("")
|
|
}
|
|
}
|
|
|
|
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()
|
|
globals.SecureEndpoint.RegisterServiceProtocol(natTraversalProtocol)
|
|
commonnattraversal.NewCommonProtocol(natTraversalProtocol)
|
|
|
|
matchMakingProtocol := matchmaking.NewProtocol()
|
|
globals.SecureEndpoint.RegisterServiceProtocol(matchMakingProtocol)
|
|
commonMatchMakingProtocol := commonmatchmaking.NewCommonProtocol(matchMakingProtocol)
|
|
commonMatchMakingProtocol.SetManager(globals.MatchmakingManager)
|
|
|
|
matchMakingExtProtocol := matchmakingext.NewProtocol()
|
|
globals.SecureEndpoint.RegisterServiceProtocol(matchMakingExtProtocol)
|
|
commonMatchMakingExtProtocol := commonmatchmakingext.NewCommonProtocol(matchMakingExtProtocol)
|
|
commonMatchMakingExtProtocol.SetManager(globals.MatchmakingManager)
|
|
|
|
matchmakeExtensionProtocol := matchmakeextension.NewProtocol()
|
|
globals.SecureEndpoint.RegisterServiceProtocol(matchmakeExtensionProtocol)
|
|
commonMatchmakeExtensionProtocol := commonmatchmakeextension.NewCommonProtocol(matchmakeExtensionProtocol)
|
|
commonMatchmakeExtensionProtocol.CleanupMatchmakeSessionSearchCriterias = cleanupMatchmakeSessionSearchCriteriasHandler
|
|
commonMatchmakeExtensionProtocol.SetManager(globals.MatchmakingManager)
|
|
|
|
rankingProtocol := ranking.NewProtocol(globals.SecureEndpoint)
|
|
globals.SecureEndpoint.RegisterServiceProtocol(rankingProtocol)
|
|
commonranking.NewCommonProtocol(rankingProtocol)
|
|
}
|