mirror of
https://github.com/PretendoNetwork/pikmin-3.git
synced 2026-04-17 18:45:48 -05:00
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
package nex
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strconv"
|
|
|
|
nex "github.com/PretendoNetwork/nex-go/v2"
|
|
"github.com/PretendoNetwork/pikmin-3/globals"
|
|
)
|
|
|
|
var serverBuildString string
|
|
|
|
func StartAuthenticationServer() {
|
|
globals.AuthenticationServer = nex.NewPRUDPServer()
|
|
|
|
globals.AuthenticationEndpoint = nex.NewPRUDPEndPoint(1)
|
|
globals.AuthenticationEndpoint.ServerAccount = globals.AuthenticationServerAccount
|
|
globals.AuthenticationEndpoint.AccountDetailsByPID = globals.AccountDetailsByPID
|
|
globals.AuthenticationEndpoint.AccountDetailsByUsername = globals.AccountDetailsByUsername
|
|
globals.AuthenticationServer.BindPRUDPEndPoint(globals.AuthenticationEndpoint)
|
|
|
|
globals.AuthenticationServer.LibraryVersions.SetDefault(nex.NewLibraryVersion(3, 3, 0))
|
|
globals.AuthenticationServer.AccessKey = "f6accfc1"
|
|
|
|
globals.AuthenticationEndpoint.OnData(func(packet nex.PacketInterface) {
|
|
request := packet.RMCMessage()
|
|
|
|
fmt.Println("==PIKMIN 3 - Auth==")
|
|
fmt.Printf("Protocol ID: %#v\n", request.ProtocolID)
|
|
fmt.Printf("Method ID: %#v\n", request.MethodID)
|
|
fmt.Println("===============")
|
|
})
|
|
|
|
registerCommonAuthenticationServerProtocols()
|
|
|
|
port, _ := strconv.Atoi(os.Getenv("PN_PIKMIN3_AUTHENTICATION_SERVER_PORT"))
|
|
|
|
globals.AuthenticationServer.Listen(port)
|
|
}
|