binary

package
v0.0.0-...-b4be506 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2021 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendUUID

func AppendUUID(dst []byte, uuid []byte) []byte

func CalculateImageResourceId

func CalculateImageResourceId(md5 []byte) string

func GZipCompress

func GZipCompress(data []byte) []byte

func GZipUncompress

func GZipUncompress(src []byte) []byte

func GenUUID

func GenUUID(uuid []byte) []byte

func Get256KBytes

func Get256KBytes() *[]byte

Get256KBytes 获取一个128k大小 []byte

func NewWriterF

func NewWriterF(f func(writer *Writer)) []byte

func Put256KBytes

func Put256KBytes(b *[]byte)

Put256KBytes 放回一个128k大小 []byte

func PutWriter

func PutWriter(w *Writer)

PutWriter 将 Writer 放回池中

func ReleaseGzipWriter

func ReleaseGzipWriter(w *GzipWriter)

func ToBytes

func ToBytes(i interface{}) []byte

func ToChunkedBytesF

func ToChunkedBytesF(b []byte, size int, f func([]byte))

func ToIPV4Address

func ToIPV4Address(arr []byte) string

func UInt32ToIPV4Address

func UInt32ToIPV4Address(i uint32) string

func ZlibCompress

func ZlibCompress(data []byte) []byte

func ZlibUncompress

func ZlibUncompress(src []byte) []byte

Types

type DynamicProtoMessage

type DynamicProtoMessage map[uint64]interface{}

func (DynamicProtoMessage) Encode

func (msg DynamicProtoMessage) Encode() []byte

type GzipWriter

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

func AcquireGzipWriter

func AcquireGzipWriter() *GzipWriter

func (*GzipWriter) Bytes

func (w *GzipWriter) Bytes() []byte

func (*GzipWriter) Close

func (w *GzipWriter) Close() error

func (*GzipWriter) Write

func (w *GzipWriter) Write(p []byte) (int, error)

type NetworkReader

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

func NewNetworkReader

func NewNetworkReader(conn net.Conn) *NetworkReader

func (*NetworkReader) ReadByte

func (r *NetworkReader) ReadByte() (byte, error)

func (*NetworkReader) ReadBytes

func (r *NetworkReader) ReadBytes(len int) ([]byte, error)

func (*NetworkReader) ReadInt32

func (r *NetworkReader) ReadInt32() (int32, error)

type Reader

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

func NewReader

func NewReader(data []byte) *Reader

func (*Reader) Len

func (r *Reader) Len() int

func (*Reader) ReadAvailable

func (r *Reader) ReadAvailable() []byte

func (*Reader) ReadByte

func (r *Reader) ReadByte() byte

func (*Reader) ReadBytes

func (r *Reader) ReadBytes(len int) []byte

func (*Reader) ReadBytesShort

func (r *Reader) ReadBytesShort() []byte

func (*Reader) ReadInt32

func (r *Reader) ReadInt32() int32

func (*Reader) ReadInt64

func (r *Reader) ReadInt64() int64

func (*Reader) ReadString

func (r *Reader) ReadString() string

func (*Reader) ReadStringLimit

func (r *Reader) ReadStringLimit(limit int) string

func (*Reader) ReadStringShort

func (r *Reader) ReadStringShort() string

func (*Reader) ReadTlvMap

func (r *Reader) ReadTlvMap(tagSize int) (m TlvMap)

func (*Reader) ReadUInt16

func (r *Reader) ReadUInt16() uint16

type TEA

type TEA [4]uint32

func NewTeaCipher

func NewTeaCipher(key []byte) *TEA

func (*TEA) Decrypt

func (t *TEA) Decrypt(data []byte) []byte

func (*TEA) Encrypt

func (t *TEA) Encrypt(src []byte) (dst []byte)

Encrypt tea 加密 http://bbs.chinaunix.net/thread-583468-1-1.html 感谢xichen大佬对TEA的解释

type TlvMap

type TlvMap map[uint16][]byte

func (TlvMap) Exists

func (tlv TlvMap) Exists(key uint16) bool

type Writer

type Writer bytes.Buffer

Writer 写入

func NewWriter

func NewWriter() *Writer

NewWriter 从池中取出一个 Writer

func (*Writer) Bytes

func (w *Writer) Bytes() []byte

func (*Writer) Cap

func (w *Writer) Cap() int

func (*Writer) EncryptAndWrite

func (w *Writer) EncryptAndWrite(key []byte, data []byte)

func (*Writer) Grow

func (w *Writer) Grow(n int)

func (*Writer) Reset

func (w *Writer) Reset()

func (*Writer) Write

func (w *Writer) Write(b []byte)

func (*Writer) WriteBool

func (w *Writer) WriteBool(b bool)

func (*Writer) WriteByte

func (w *Writer) WriteByte(b byte)

func (*Writer) WriteBytesShort

func (w *Writer) WriteBytesShort(data []byte)

func (*Writer) WriteHex

func (w *Writer) WriteHex(h string)

func (*Writer) WriteIntLvPacket

func (w *Writer) WriteIntLvPacket(offset int, f func(writer *Writer))

func (*Writer) WriteString

func (w *Writer) WriteString(v string)

func (*Writer) WriteStringShort

func (w *Writer) WriteStringShort(v string)

func (*Writer) WriteTlvLimitedSize

func (w *Writer) WriteTlvLimitedSize(data []byte, limit int)

func (*Writer) WriteUInt16

func (w *Writer) WriteUInt16(v uint16)

func (*Writer) WriteUInt32

func (w *Writer) WriteUInt32(v uint32)

func (*Writer) WriteUInt64

func (w *Writer) WriteUInt64(v uint64)

func (*Writer) WriteUniPacket

func (w *Writer) WriteUniPacket(commandName string, sessionId, extraData, body []byte)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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