api0gameserver

package
v0.0.0-...-8e88d4a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package api0gameserver interacts with game servers using the original master server api.

Index

Constants

View Source
const VerifyText = "I am a northstar server!"

VerifyText is the expected server response for /verify.

Variables

View Source
var (
	ErrInvalidResponse = errors.New("invalid response")
	ErrAuthFailed      = errors.New("authentication failed")
)

Functions

func AuthenticateIncomingPlayer

func AuthenticateIncomingPlayer(ctx context.Context, auth netip.AddrPort, uid uint64, username, connToken, serverToken string, pdata []byte) error

AuthenticateIncomingPlayer checks if a player can connect to a game server, registers a one-time connection token, and sends the player's pdata. If the authentication request returns invalid JSON, err is ErrInvalidResponse. If the authentication response .success is false, err is ErrAuthFailed.

func Verify

func Verify(ctx context.Context, auth netip.AddrPort) error

Verify checks whether an address is a Northstar auth server. If the HTTP request succeeds but the response is incorrect, err is ErrInvalidResponse.

Types

type ConnectionRejectedError

type ConnectionRejectedError string

func (ConnectionRejectedError) Error

func (c ConnectionRejectedError) Error() string

func (ConnectionRejectedError) Reason

func (c ConnectionRejectedError) Reason() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL