client

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZippedRequest    byte = 0x04 // ZippedRequest is a flag saying request is gzipped
	ZippedResponse        = 0x10 // ZippedResponse is a flag saying response can be gzipped
	EncryptSymmetric      = 0x08 // EncryptSymmetric is a flag saying message is encrypted by symmetric key (DES)
	EncryptPublic         = 0x40 // EncryptPublic is a flag saying message is encrypted by public key (RSA)
)

Variables

View Source
var HeaderOffsets = map[int]int{
	0: 0,
	1: 4,
	2: 8,
	3: 12,
	4: 44,
	5: 46,
	6: 47,
	7: 48,
	8: 52,
}

HeaderOffsets holds information about header offset lengths

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Logger logs.LogWriter
	// contains filtered or unexported fields
}

Channel wraps user connection.

func NewChannel

func NewChannel(sc *sirenaXML.Config, l logs.LogWriter) (*Channel, error)

func (*Channel) GetKeyData

func (c *Channel) GetKeyData() KeyData

func (*Channel) NewRequest

func (c *Channel) NewRequest(msg []byte) (*Packet, error)

func (*Channel) SendMsg

func (c *Channel) SendMsg(msg []byte) ([]byte, error)

func (*Channel) SetLogger

func (c *Channel) SetLogger(l logs.LogWriter)
type Header struct {
	CreatedAt        uint32
	MessageID        uint32
	MessageLength    uint32
	ClientID         uint16
	KeyID            uint32
	Flags            *HeaderFlags
	RequestNoHandled bool
}

func (*Header) ToBytes

func (h *Header) ToBytes() []byte

ToBytes converts header into bytes

type HeaderFlags

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

func NewHeaderFlags

func NewHeaderFlags(preset byte) *HeaderFlags

func (*HeaderFlags) Clear

func (hf *HeaderFlags) Clear(flag byte)

func (*HeaderFlags) Has

func (hf *HeaderFlags) Has(flag byte) bool

func (*HeaderFlags) Set

func (hf *HeaderFlags) Set(flag byte)

func (*HeaderFlags) ToByte

func (hf *HeaderFlags) ToByte() byte

func (*HeaderFlags) Toggle

func (hf *HeaderFlags) Toggle(flag byte)

type KeyData

type KeyData struct {
	ID  uint32 `json:"id"`
	Key []byte `json:"key"`
}

type MsgPool

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

func NewMsgPool

func NewMsgPool(rp *RespPool, size uint32) (*MsgPool, error)

func (*MsgPool) GetMsgID

func (p *MsgPool) GetMsgID() uint32

func (*MsgPool) GetPool

func (p *MsgPool) GetPool() chan uint32

func (*MsgPool) ReturnMsgIDToPool

func (p *MsgPool) ReturnMsgIDToPool(id uint32)

type Packet

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

Packet represents application level data.

func NewPacket

func NewPacket(cfg *sirenaXML.Config, key []byte, keyID uint32) (*Packet, error)

type RespPool

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

func NewRespPool

func NewRespPool() *RespPool

func (*RespPool) Add

func (rp *RespPool) Add(msgID uint32)

func (*RespPool) GetPacket

func (rp *RespPool) GetPacket(msgID uint32) *Packet

func (*RespPool) SavePacket

func (rp *RespPool) SavePacket(msgID uint32, p *Packet) error

Jump to

Keyboard shortcuts

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