packets

package
v0.0.0-...-f7ddc24 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func BuildCode2DRequestPacket

func BuildCode2DRequestPacket(seq uint32, j uint64, cmd uint16, bodyFunc func(writer *binary.Writer)) []byte

Types

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(ecdhShareKey, random, sessionKey []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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