Reusable implementations of NEX methods found in many servers
Find a file
2022-11-17 20:04:32 +00:00
authentication Added LoginEx handler to authentication protocol 2022-09-02 21:03:47 -04:00
matchmake_extension Current changes for Jon 2022-11-17 20:04:32 +00:00
matchmaking Current changes for Jon 2022-11-17 20:04:32 +00:00
nat-traversal Current changes for Jon 2022-11-17 20:04:32 +00:00
secure-connection Current changes for Jon 2022-11-17 20:04:32 +00:00
.gitignore Updated .gitignore 2022-08-29 18:13:11 -04:00
go.mod Updated go modules 2022-09-05 10:21:20 -04:00
go.sum Updated go modules 2022-09-05 10:21:20 -04:00
go.work.sum plogger->plogger-go, nex-go->v1.0.8, nex-protocols-go->v1.0.5 2022-08-29 18:17:05 -04:00
LICENSE Create LICENSE 2022-08-13 20:18:19 -04:00
README.md Updated README.md 2022-09-03 17:13:54 -04:00

NEX Protocols Common Go

NEX protocols used by many games with premade handlers and a high level API

GoDoc

Other NEX libraries

nex-go - Barebones NEX/PRUDP server implementation

nex-protocols-go - NEX protocol definitions

Install

go get github.com/PretendoNetwork/nex-protocols-common-go

Usage

nex-protocols-common-go provides a higher level API than the NEX Protocols Go module. This module handles many of the more common protcols and methods used shared by many servers. Instead of working directly with the NEX server, this module exposes an API for defining helper functions to provide the module with the data it needs to run

Example, friends (Wii U) authentication server

For a complete example, see the complete Friends Authentication Server, and other game servers

package main

import (
	"fmt"
	"os"

	"github.com/PretendoNetwork/nex-go"
	"github.com/PretendoNetwork/nex-protocols-common-go/authentication"
)

var nexServer *nex.Server

func main() {
	nexServer = nex.NewServer()
	nexServer.SetPrudpVersion(0)
	nexServer.SetKerberosKeySize(16)
	nexServer.SetKerberosPassword(os.Getenv("KERBEROS_PASSWORD"))
	nexServer.SetAccessKey("ridfebb9")

	nexServer.On("Data", func(packet *nex.PacketV0) {
		request := packet.RMCRequest()

		fmt.Println("==Friends - Auth==")
		fmt.Printf("Protocol ID: %#v\n", request.ProtocolID())
		fmt.Printf("Method ID: %#v\n", request.MethodID())
		fmt.Println("==================")
	})

	authenticationProtocol := authentication.NewCommonAuthenticationProtocol(nexServer)

	secureStationURL := nex.NewStationURL("")
	secureStationURL.SetScheme("prudps")
	secureStationURL.SetAddress(os.Getenv("SECURE_SERVER_LOCATION"))
	secureStationURL.SetPort(os.Getenv("SECURE_SERVER_PORT"))
	secureStationURL.SetCID("1")
	secureStationURL.SetPID("2")
	secureStationURL.SetSID("1")
	secureStationURL.SetStream("10")
	secureStationURL.SetType("2")

	authenticationProtocol.SetSecureStationURL(secureStationURL)
	authenticationProtocol.SetBuildName("Pretendo Friends Auth")
	authenticationProtocol.SetPasswordFromPIDFunction(passwordFromPID)

	nexServer.Listen(":60000")
}