-
Notifications
You must be signed in to change notification settings - Fork 8
/
secure.go
33 lines (26 loc) · 1011 Bytes
/
secure.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package nex
import (
"fmt"
"os"
"github.com/PretendoNetwork/nex-go"
"github.com/PretendoNetwork/super-mario-maker-secure/globals"
)
func StartSecureServer() {
globals.SecureServer = nex.NewServer()
globals.SecureServer.SetPRUDPVersion(1)
globals.SecureServer.SetPRUDPProtocolMinorVersion(2)
globals.SecureServer.SetDefaultNEXVersion(nex.NewPatchedNEXVersion(3, 8, 3, "AMAJ"))
globals.SecureServer.SetKerberosPassword(globals.KerberosPassword)
globals.SecureServer.SetAccessKey("9f2b4678")
globals.SecureServer.On("Data", func(packet *nex.PacketV1) {
request := packet.RMCRequest()
fmt.Println("==SMM1 - Secure==")
fmt.Printf("Protocol ID: %d\n", request.ProtocolID())
fmt.Printf("Method ID: %d\n", request.MethodID())
fmt.Println("===============")
})
// * Register the common handlers first so that they can be overridden if needed
registerCommonSecureProtocols()
registerNEXProtocols()
globals.SecureServer.Listen(fmt.Sprintf(":%s", os.Getenv("PN_SMM_SECURE_SERVER_PORT")))
}