util

package
v0.0.0-...-edd4e79 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteToInt32

func ByteToInt32(b []byte) int32

func CpPublish

func CpPublish(src, des *packets.Publish)

func GeneratePacketID

func GeneratePacketID() uint16

func GenerateVariableData

func GenerateVariableData(str []byte) []byte

func HasWildcard

func HasWildcard(topic string) bool

func Int32ToByte

func Int32ToByte(i int32) []byte

func PacketIDToString

func PacketIDToString(id uint16) string

func ParseVariableData

func ParseVariableData(data []byte) ([]byte, error)

func ReadUint32

func ReadUint32(b *bytes.Buffer) (uint32, error)

func ReadUint64

func ReadUint64(b *bytes.Buffer) (uint64, error)

func SplitTopic

func SplitTopic(topic string) []string

func StringToPacketID

func StringToPacketID(id string) uint16

func WriteUint32

func WriteUint32(u uint32, b *bytes.Buffer) error

func WriteUint64

func WriteUint64(u uint64, b *bytes.Buffer) error

Types

type Bucket

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

func NewBucket

func NewBucket(num int) *Bucket

func (*Bucket) GetToken

func (b *Bucket) GetToken() <-chan struct{}

func (*Bucket) PutToken

func (b *Bucket) PutToken()

type PacketIDFactory

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

func NewPacketIDFactory

func NewPacketIDFactory() *PacketIDFactory

func (*PacketIDFactory) Generate

func (p *PacketIDFactory) Generate() uint16

func (*PacketIDFactory) ReadID

func (p *PacketIDFactory) ReadID() uint16

func (*PacketIDFactory) SetID

func (p *PacketIDFactory) SetID(id uint16)

Jump to

Keyboard shortcuts

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