func LogLevel(lvl int)
LogLevel sets log level
Client TCP 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, hbInterval int64) *Client
New Creates a new TCP 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 Starts TCP Client
func (cli *Client) Disconnect()
Disconnect Stops TCP 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 response reveive
func (cli *Client) OnReconnect(callback func())
OnReconnect registers a callback on reconnect
func (cli *Client) OnResponse(callback func(uint8, uint16, uint8, []byte))
OnResponse Registers a callback on response reveive
func (cli *Client) PauseHeartbeat()
PauseHeartbeat Stops sending heartbeat command to the server
func (cli *Client) Reconnect(addr string)
Reconnect restarts TCP Client
func (cli *Client) RemoveAll()
RemoveAll Removes all callbacks on OnResponse and OnPush
func (cli *Client) RemoveAllOnPush()
RemoveAllOnPush Removes all callbacks on OnPush
func (cli *Client) RemoveAllOnResponse()
RemoveAllOnResponse Removes all callbacks on 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) ResumeHeartbeat()
ResumeHeartbeat Resumes sending heartbeat command to the server
func (cli *Client) Send(ver uint8, cmd uint16, payload []byte)
Send Sends a TCP 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