network

package
v0.0.0-...-0917785 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: Unlicense Imports: 16 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnswerUDP

func AnswerUDP(Packet *codec.Packet, writer func(*bytes.Buffer) error) error

Types

type Client

type Client struct {
	IsActive bool

	HashState *level.State
	IpAddr    net.Addr
	State     ClientState

	Options ClientOptions
	// contains filtered or unexported fields
}

func (*Client) Answer

func (client *Client) Answer(Packet *codec.Packet) error

func (*Client) Close

func (c *Client) Close()

func (*Client) FireClientClose

func (c *Client) FireClientClose(event ClientEvent) SocketEvent

func (*Client) FireClientCommand

func (c *Client) FireClientCommand(event ClientEvent) SocketEvent

func (*Client) FireClientData

func (c *Client) FireClientData(event ClientEvent) SocketEvent

func (*Client) FireClose

func (c *Client) FireClose() ClientEvent

func (*Client) FireError

func (c *Client) FireError(err error) ClientEvent

func (*Client) FireSomething

func (c *Client) FireSomething(event ClientEvent) SocketEvent

func (*Client) Key

func (c *Client) Key() ClientKey

func (*Client) SendPacket

func (client *Client) SendPacket(pkt []byte) error

type ClientEvent

type ClientEvent struct {
	Name string
	Data interface{}
}

ClientEvent is the generic struct for events

type ClientKey

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

func (*ClientKey) String

func (ck *ClientKey) String() string

type ClientOptions

type ClientOptions struct {
	FESL bool
}

type ClientState

type ClientState struct {
	ServerChallenge string
	ClientChallenge string
	ClientResponse  string
	Username        string
	PlyName         string
	PlyEmail        string
	PlyCountry      string
	PlyPid          int
	Sessionkey      int
	Confirmed       bool
	IpAddress       net.Addr
	HasLogin        bool
	ProfileSent     bool
	LoggedOut       bool
	HeartTicker     *time.Ticker
}

type Clients

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

func (*Clients) Add

func (cls *Clients) Add(cl *Client)

func (*Clients) Remove

func (cls *Clients) Remove(cl *Client)

type EvProcess

type EvProcess struct {
	Client  *Client
	Process *ProcessFESL // If TLS (theater then we ignore HEX - it is always 0x0)
}

type EventClientClose

type EventClientClose struct {
	Client *Client
}

type EventClientData

type EventClientData struct {
	Client *Client
	Data   string
}

type EventClientError

type EventClientError struct {
	Client *Client
	Error  error
}

type EventError

type EventError struct {
	Error error
}

type EventNewClient

type EventNewClient struct {
	Client *Client
}

type ProcessFESL

type ProcessFESL struct {
	Msg   map[string]string
	Query string
	HEX   uint32
}

type Socket

type Socket struct {
	Clients *Clients

	EventChan chan SocketEvent
	// contains filtered or unexported fields
}

Socket is a basic event-based TCP-Server

func NewSocketTCP

func NewSocketTCP(name, bind string, fesl bool) (*Socket, error)

New starts to listen on a new Socket

func NewSocketTLS

func NewSocketTLS(name, bind string) (*Socket, error)

func (*Socket) Close

func (socket *Socket) Close()

Close fires a close-event and closes the socket

func (*Socket) FireClose

func (s *Socket) FireClose() SocketEvent

func (*Socket) FireError

func (s *Socket) FireError(err error) SocketEvent

func (*Socket) FireNewClient

func (s *Socket) FireNewClient(client *Client) SocketEvent

type SocketEvent

type SocketEvent struct {
	Name string
	Data interface{}
}

type SocketUDP

type SocketUDP struct {
	Clients []*Client

	EventChan chan SocketUDPEvent
	// contains filtered or unexported fields
}

Socket is a basic event-based TCP-Server

func NewSocketUDP

func NewSocketUDP(name, bind string, fesl bool) (*SocketUDP, error)

New starts to listen on a new Socket

func (*SocketUDP) Answer

func (socket *SocketUDP) Answer(Packet *codec.Packet, addr *net.UDPAddr) error

func (*SocketUDP) Close

func (socket *SocketUDP) Close()

Close fires a close-event and closes the socket

func (*SocketUDP) WriteEncode

func (socket *SocketUDP) WriteEncode(Packet *codec.Packet, addr *net.UDPAddr) error

type SocketUDPEvent

type SocketUDPEvent struct {
	Name string
	Addr *net.UDPAddr
	Data interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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