func LogLevel(lvl int)
LogLevel sets log level
Client UDP client
type Client struct { ID string IDBytes []byte ServerEndPoint string ClientKey string SID []byte SIDString string EncryptionKey []byte EncryptionIV []byte EncryptionMacKey []byte // contains filtered or unexported fields }
func New(rcvMaxSize int, interval int64) *Client
New Creates a new UDP Client
func (cli *Client) CatchOnReconnect(ver uint8, cmd uint16, callback func())
CatchOnReconnect registers a callback on reconnect or response w/ ver and cmd of your choice ONCE
func (cli *Client) Connect(addr string)
Connect connects UDP Client
func (cli *Client) Disconnect()
Disconnect disconnects the UDP Client
func (cli *Client) OnConnect(callback func())
OnConnect registers a callback on Connect
func (cli *Client) OnDisconnect(callback func())
OnDisconnect registers a callback on Disconnect
func (cli *Client) OnPush(callback func(uint8, uint16, []byte))
OnPush Registers a callback on push receive
func (cli *Client) OnReconnect(callback func())
OnReconnect registers a callack on Reconnect
func (cli *Client) OnResponse(callback func(uint8, uint16, uint8, []byte))
OnResponse Registers a callback on response receive
func (cli *Client) Ping()
Ping sends a ping packet over UDP
func (cli *Client) RSend(ver uint8, cmd uint16, payload []byte)
RSend Sends a Reliable UDP packet to server
func (cli *Client) Reconnect(addr string)
Reconnect restarts UDP Client
func (cli *Client) RemoveAll()
RemoveAll Removes all callbacks
func (cli *Client) RemoveAllOnPush()
RemoveAllOnPush Removes all callbacks of OnPush
func (cli *Client) RemoveAllOnResponse()
RemoveAllOnResponse Removes all callbacks of OnResponse
func (cli *Client) RemoveOnReconnect(callbackToRemove func())
RemoveOnReconnect removes a callback function on reconnect event
func (cli *Client) RemoveOnResponse(callbackToRemove func(uint8, uint16, uint8, []byte))
RemoveOnResponse removes a callback function on response event
func (cli *Client) Send(ver uint8, cmd uint16, payload []byte)
Send Sends a UDP packet to server
func (cli *Client) SetClientKey(clientKey string)
SetClientKey sets up client key
func (cli *Client) SetEncryptionKeys(sid []byte, key []byte, iv []byte, macKey []byte)
SetEncryptionKeys Sets up encryption keys
func (cli *Client) SetID(id string)
SetID sets ID