gameproxy

package
v0.0.0-...-d0596f5 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GameProxy

type GameProxy struct {
	PlayerConn network.Connection
	GameConn   network.Connection
	// contains filtered or unexported fields
}

func NewGameProxy

func NewGameProxy(playerConn network.Connection, inst *gameinstance.GameInstance, onClose func(string)) (*GameProxy, error)

NewGameProxy creates and starts a new instance of a game proxy. The onClose callback should be used to perform any cleanup that would be done after a Close() call by the caller, and it must be provided. Its first argument is the player's address.

func (*GameProxy) Close

func (p *GameProxy) Close() error

func (*GameProxy) DeserializeSelf

func (p *GameProxy) DeserializeSelf(data []byte) error

func (*GameProxy) HydrateDeserialized

func (p *GameProxy) HydrateDeserialized(gatewayServer *net.UDPConn, onClose func(string)) error

HydrateDeserialized hyhdrates and starts an instance of a game proxy. The onClose callback should be used to perform any cleanup that would be done after a Close() call by the caller, and it must be provided. Its first argument is the player's address.

func (*GameProxy) SendToGame

func (u *GameProxy) SendToGame(data []byte) error

func (*GameProxy) SerializeSelf

func (p *GameProxy) SerializeSelf() ([]byte, error)

type GameProxyCached

type GameProxyCached struct {
	PlayerAddr *net.UDPAddr
	GameAddr   *net.UDPAddr
	ProxyPort  int
}

GameProxyCached represents the data needed to reconstruct a game proxy from serialized data.

type GameProxyManager

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

func NewGameProxyManager

func NewGameProxyManager() *GameProxyManager

NewProxyManager returns a new game proxy manager.

func (*GameProxyManager) CreateProxy

func (m *GameProxyManager) CreateProxy(playerConn network.Connection, inst *gameinstance.GameInstance) (*GameProxy, error)

CreateProxy creates a proxy from the provided player connection to the specified instance.

func (*GameProxyManager) DeserializeSelf

func (m *GameProxyManager) DeserializeSelf(data []byte) error

func (*GameProxyManager) GetProxy

func (m *GameProxyManager) GetProxy(addr string) (*GameProxy, error)

func (*GameProxyManager) HydrateDeserialized

func (m *GameProxyManager) HydrateDeserialized(gatewayServer *net.UDPConn) error

func (*GameProxyManager) RemoveConnectionsTo

func (m *GameProxyManager) RemoveConnectionsTo(addr string, cb func(network.Connection)) error

RemoveConnectionsTo removes all connections to the provided address. A callback may be provided that will be called for each stopped proxy.

func (*GameProxyManager) SerializeSelf

func (m *GameProxyManager) SerializeSelf() ([]byte, error)

type GameProxyManagerCached

type GameProxyManagerCached struct {
	Clients map[string]string
}

Jump to

Keyboard shortcuts

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