mirror of
https://github.com/PretendoNetwork/pikmin-3.git
synced 2026-04-18 02:55:52 -05:00
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package nex
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strconv"
|
|
|
|
nex "github.com/PretendoNetwork/nex-go/v2"
|
|
"github.com/PretendoNetwork/pikmin-3/globals"
|
|
)
|
|
|
|
func StartSecureServer() {
|
|
globals.SecureServer = nex.NewPRUDPServer()
|
|
|
|
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, 3, 0))
|
|
globals.SecureServer.AccessKey = "f6accfc1"
|
|
|
|
globals.SecureEndpoint.OnData(func(packet nex.PacketInterface) {
|
|
request := packet.RMCMessage()
|
|
|
|
fmt.Println("==PIKMIN 3 - Secure==")
|
|
fmt.Printf("Protocol ID: %#v\n", request.ProtocolID)
|
|
fmt.Printf("Method ID: %#v\n", request.MethodID)
|
|
fmt.Println("===============")
|
|
})
|
|
|
|
registerCommonSecureServerProtocols()
|
|
|
|
port, _ := strconv.Atoi(os.Getenv("PN_PIKMIN3_SECURE_SERVER_PORT"))
|
|
|
|
globals.SecureServer.Listen(port)
|
|
}
|