splatoon/nex/secure.go
Andrea Toska 238c85da9f
Some checks failed
Build and Publish Docker Image / build-publish (push) Has been cancelled
feat!: Implement Matchmaking Rewrite (#10)
* feat(secure): Mark Splatfest sessions as OpenParticipation

Bit of a hack but good enough to make things work for now

* feat(secure): Add stubbed Splatoon Ranking protocol

Fixes freezes related to Splatfest results upload

* feat: matchmaking rewrite implementation

* feat(secure): attempt to fix index bugs

* fix: merge issue

* fix(secure): forgot to change the import name

* fix(secure): remove old index ignore

* fix(secure): misspelling

* fix(secure): remove unused var

* fix(secure): revert previous fix

* fix(secure): using another function

* fix(secure): using another function

* working on it

* fix(secure): i hate these variable names

* fix(secure): misspelled again

* debug(secure): adding debugging

* fix(secure): hopefully fix the error (thanks dani)

* std(secure): standardize variable names

* fix(secure): fix string issue

* fix(secure): oops

* fix(secure): remove attribute 1

* fix(secure): final fixups

* fix(secure): final fixups

* feat(secure): try fixing fest rooms

* feat(secure): implement postgresql fix

* merge

* fix(secure): try once again to fix fests

* fix(secure): ignore first param

* fix: bump library versions and remove override

* chore: go fmt all files

* chore: Remove unused code

* chore: Explicitly ignore error in criteria cleanup

It's fine we just won't mm into this room

---------

Co-authored-by: Ash Logan <ash@heyquark.com>
2024-11-07 21:59:38 +11:00

48 lines
1.5 KiB
Go

package nex
import (
"fmt"
common_globals "github.com/PretendoNetwork/nex-protocols-common-go/v2/globals"
"os"
"strconv"
"github.com/PretendoNetwork/nex-go/v2"
"github.com/PretendoNetwork/splatoon/globals"
)
func StartSecureServer() {
globals.SecureServer = nex.NewPRUDPServer()
globals.SecureServer.ByteStreamSettings.UseStructureHeader = true
globals.SecureEndpoint = nex.NewPRUDPEndPoint(1)
globals.SecureEndpoint.IsSecureEndPoint = true
globals.SecureEndpoint.ServerAccount = globals.SecureServerAccount
globals.SecureEndpoint.AccountDetailsByPID = globals.AccountDetailsByPID
globals.SecureEndpoint.AccountDetailsByUsername = globals.AccountDetailsByUsername
globals.SecureServer.BindPRUDPEndPoint(globals.SecureEndpoint)
globals.SecureServer.LibraryVersions.SetDefault(nex.NewLibraryVersion(3, 8, 15))
globals.SecureServer.AccessKey = "6f599f81"
globals.SecureEndpoint.OnData(func(packet nex.PacketInterface) {
request := packet.RMCMessage()
fmt.Println("==Splatoon - Secure==")
fmt.Printf("Protocol ID: %d\n", request.ProtocolID)
fmt.Printf("Method ID: %d\n", request.MethodID)
fmt.Println("===============")
})
globals.SecureEndpoint.OnError(func(err *nex.Error) {
globals.Logger.Errorf("Secure: %v", err)
})
globals.MatchmakingManager = common_globals.NewMatchmakingManager(globals.SecureEndpoint, globals.Postgres)
registerCommonSecureServerProtocols()
port, _ := strconv.Atoi(os.Getenv("PN_SPLATOON_SECURE_SERVER_PORT"))
globals.SecureServer.Listen(port)
}