gn

package module
v0.0.0-...-26eb88b Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesFromData

func BytesFromData(data interface{}) ([]byte, error)

func DetermineType

func DetermineType(data interface{}) (int, error)

func Parse

func Parse(r io.Reader) (value interface{}, size int, err error)

Types

type Client

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

func (*Client) Connect

func (c *Client) Connect(addr string) error

func (Client) Disconnect

func (c Client) Disconnect() error

func (Client) Send

func (c Client) Send(p Packet) (err error)

type CloseHandler

type CloseHandler func(Server)

type ConnectHandler

type ConnectHandler func(Connection)

type Connection

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

func NewConnection

func NewConnection(conn net.Conn, serv Server) *Connection

func (Connection) Close

func (c Connection) Close() error

func (Connection) Write

func (c Connection) Write(p Packet) (err error)

type DisconnectHandler

type DisconnectHandler func(Connection)

type ErrorHandler

type ErrorHandler func(ServerError)

type Packet

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

func Load

func Load(b []byte) (*Packet, error)

func NewPacket

func NewPacket(netID uint16) *Packet

func (*Packet) Add

func (p *Packet) Add(data interface{})

func (Packet) Build

func (p Packet) Build() ([]byte, error)

func (Packet) Get

func (p Packet) Get(index int) interface{}

type PacketHandler

type PacketHandler func(Connection, Packet)

type ReadyHandler

type ReadyHandler func(Server)

type Server

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

func (Server) Broadcast

func (s Server) Broadcast(p Packet) error

func (Server) Close

func (s Server) Close()

func (*Server) Listen

func (s *Server) Listen(port string) error

func (*Server) OnClose

func (s *Server) OnClose(handler CloseHandler)

func (*Server) OnConnect

func (s *Server) OnConnect(handler ConnectHandler)

func (*Server) OnData

func (s *Server) OnData(handler PacketHandler)

func (*Server) OnDisconnect

func (s *Server) OnDisconnect(handler DisconnectHandler)

func (*Server) OnError

func (s *Server) OnError(handler ErrorHandler)

func (*Server) OnReady

func (s *Server) OnReady(handler ReadyHandler)

type ServerError

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

Jump to

Keyboard shortcuts

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