listener

package
v0.0.0-...-298beda Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: Unlicense Imports: 6 Imported by: 0

README

Listener

Collections of common behaviour across source games. Listeners may:

  • Expect a message type(s)
  • Optionally send messages back in response to receiving a message

Examples here include a authentication/connection struct

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector struct {
	// contains filtered or unexported fields
}

Connector is a standard mechanism for connecting to source engine servers Many games implement the same communication, particularly early games. It will handle connectionless back-and-forth with a server, until we get a successfully connected message back from the server.

func NewConnector

func NewConnector(playerName string, password string, gameVersion string, clientChallenge int32) *Connector

NewConnector returns a new connector object.

func (*Connector) InitialMessage

func (listener *Connector) InitialMessage() sourcenet.IMessage

InitialMessage Get the first message to initialize server authentication before connection.

func (*Connector) Receive

func (listener *Connector) Receive(msg sourcenet.IMessage, msgType int)

Receive is a callback that receives a message that the client received from the connected server.

func (*Connector) Register

func (listener *Connector) Register(client *sourcenet.Client)

Register provides a mechanism for a listener to respond back to the client. This allows for encapsulation of certain back-and-forth logic for authentication.

Jump to

Keyboard shortcuts

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