mirror of
https://github.com/PretendoNetwork/minecraft-wiiu.git
synced 2026-04-22 00:27:35 -05:00
Port to the nex-protocols-common-go/matchmaking-rewrite staging branch. This has better notification behaviour, among other improvements.
50 lines
1.5 KiB
Go
50 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/minecraft-wiiu/globals"
|
|
"github.com/PretendoNetwork/nex-go/v2"
|
|
)
|
|
|
|
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, 10, 0))
|
|
globals.SecureServer.AccessKey = "f1b61c8e"
|
|
|
|
globals.Timeline = make(map[uint32][]uint8)
|
|
|
|
globals.SecureEndpoint.OnData(func(packet nex.PacketInterface) {
|
|
request := packet.RMCMessage()
|
|
|
|
fmt.Println("==Minecraft: Wii U Edition - 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_MINECRAFT_SECURE_SERVER_PORT"))
|
|
|
|
globals.SecureServer.Listen(port)
|
|
}
|