packets

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDecryptFailed = errors.New("decrypt failed")
View Source
var ErrInvalidPayload = errors.New("invalid payload")
View Source
var ErrPacketDropped = errors.New("packet dropped")
View Source
var ErrSessionExpired = errors.New("session expired")
View Source
var ErrUnknownFlag = errors.New("unknown flag")

Functions

func BuildLoginPacket

func BuildLoginPacket(uin int64, bodyType byte, key, body, extraData []byte) []byte

func BuildOicqRequestPacket

func BuildOicqRequestPacket(uin int64, commandId uint16, encrypt IEncryptMethod, key []byte, bodyFunc func(writer *binary.Writer)) []byte

func BuildSsoPacket

func BuildSsoPacket(seq uint16, appId uint32, commandName, imei string, extData, outPacketSessionId, body, ksid []byte) []byte

func BuildUniPacket

func BuildUniPacket(uin int64, seq uint16, commandName string, encryptType byte, sessionId, extraData, key, body []byte) []byte

Types

type IEncryptMethod

type IEncryptMethod interface {
	DoEncrypt([]byte, []byte) []byte
	Id() byte
}

type ISendingPacket

type ISendingPacket interface {
	CommandId() uint16
	Writer() *binary.Writer
}

type IncomingPacket

type IncomingPacket struct {
	SequenceId  uint16
	Flag2       byte
	CommandName string
	SessionId   []byte
	Payload     []byte
}

func ParseIncomingPacket

func ParseIncomingPacket(payload, d2key []byte) (*IncomingPacket, error)

func (*IncomingPacket) DecryptPayload

func (pkt *IncomingPacket) DecryptPayload(random, sessionKey []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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