super-mario-maker/nex/server.go
2023-10-10 18:16:33 -04:00

34 lines
921 B
Go

package nex
import (
"fmt"
"os"
"github.com/PretendoNetwork/nex-go"
"github.com/PretendoNetwork/super-mario-maker-secure/globals"
)
func StartNEXServer() {
globals.NEXServer = nex.NewServer()
globals.NEXServer.SetPRUDPVersion(1)
globals.NEXServer.SetPRUDPProtocolMinorVersion(2)
globals.NEXServer.SetDefaultNEXVersion(nex.NewNEXVersion(3, 8, 3))
globals.NEXServer.SetKerberosPassword(os.Getenv("KERBEROS_PASSWORD"))
globals.NEXServer.SetAccessKey("9f2b4678")
globals.NEXServer.On("Data", func(packet *nex.PacketV1) {
request := packet.RMCRequest()
fmt.Println("==SMM1 - Secure==")
fmt.Printf("Protocol ID: %#v\n", request.ProtocolID())
fmt.Printf("Method ID: %#v\n", request.MethodID())
fmt.Println("===============")
})
// * Register the common handlers first so that they can be overridden if needed
registerCommonProtocols()
registerNEXProtocols()
globals.NEXServer.Listen(":60003")
}