tcp

package
v0.0.0-...-2f1cb99 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	types.Service
	Addr        string
	Port        int
	Listener    *net.TCPListener
	Connections map[string]TCPConnection
}

func Service

func Service() *Server

func (*Server) Listen

func (s *Server) Listen()

func (*Server) Start

func (s *Server) Start() (types.Status, error)

func (*Server) Stop

func (s *Server) Stop() (types.Status, error)

type TCPConnection

type TCPConnection struct {
	logs.Logger
	Address string       // Connection address
	Conn    net.Conn     // Connection
	Parent  *Server      // Parent server
	State   types.State  // Connection state
	Player  types.Player // Player
	// contains filtered or unexported fields
}

func NewTCPConnection

func NewTCPConnection(conn net.Conn, addr string, parent *Server) TCPConnection

func (*TCPConnection) Authenticate

func (c *TCPConnection) Authenticate()

func (*TCPConnection) Close

func (c *TCPConnection) Close()

func (*TCPConnection) GameplayParser

func (c *TCPConnection) GameplayParser(Packet types.TcpPacket)

func (*TCPConnection) HandlePassword

func (c *TCPConnection) HandlePassword() bool

HandlePassword handles the password authentication TODO: Add password authentication support when that is better understood

func (*TCPConnection) Identify

func (c *TCPConnection) Identify()

func (*TCPConnection) Kick

func (c *TCPConnection) Kick(msg string)

Kick a connection with a given message

func (*TCPConnection) Listen

func (c *TCPConnection) Listen()

func (*TCPConnection) RuntimeLoop

func (c *TCPConnection) RuntimeLoop() bool

Main gamemplay loop for the connection

func (*TCPConnection) SetState

func (c *TCPConnection) SetState(state types.State)

func (*TCPConnection) SyncModData

func (c *TCPConnection) SyncModData()

func (*TCPConnection) Write

func (c *TCPConnection) Write(data types.TcpPacket)

Jump to

Keyboard shortcuts

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