decode

package
v0.0.0-...-9c27ac2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAGIC_NO_COMPRESS_START          = 0x03
	MAGIC_NO_COMPRESS_START1         = 0x06
	MAGIC_NO_COMPRESS_NO_CRYPT_START = 0x08
	MAGIC_COMPRESS_START             = 0x04
	MAGIC_COMPRESS_START1            = 0x05
	MAGIC_COMPRESS_START2            = 0x07
	MAGIC_COMPRESS_NO_CRYPT_START    = 0x09

	MAGIC_END = 0x00

	PRIV_KEY = "145aa7717bf9745b91e9569b80bbf1eedaa6cc6cd0e26317d810e35710f44cf8"
	PUB_KEY  = "" /* 128-byte string literal not displayed */
)

Variables

View Source
var (
	OP    int = 0xffffffff
	DELTA int = 0x9E3779B9
)

Functions

func BufGet

func BufGet() *bytes.Buffer

func BufPut

func BufPut(b *bytes.Buffer)

func Byte2Int

func Byte2Int(data []byte) int

func ByteGet

func ByteGet() (b []byte)

func BytePut

func BytePut(buf []byte)

func Decode

func Decode(src []byte) ([]byte, error)

func DecodeBuffer

func DecodeBuffer(src []byte, dest *bytes.Buffer, offset int) int

func EccSharedSecret

func EccSharedSecret(public_key []byte, private_key []byte) ([32]byte, error)

func GetLogStartPos

func GetLogStartPos(src []byte, count int) int

func Int2Byte

func Int2Byte(data int) (ret []byte)

func IsGoodLogBuffer

func IsGoodLogBuffer(src []byte, offset, count int) bool

Types

type LeakyBuf

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

func NewLeakyBuf

func NewLeakyBuf(n, bufSize int) *LeakyBuf

NewLeakyBuf creates a leaky buffer which can hold at most n buffer, each with bufSize bytes.

func (*LeakyBuf) Get

func (lb *LeakyBuf) Get() (b []byte)

Get returns a buffer from the leaky buffer or create a new buffer.

func (*LeakyBuf) Put

func (lb *LeakyBuf) Put(b []byte)

Put add the buffer into the free buffer pool for reuse. Panic if the buffer size is not the same with the leaky buffer's. This is intended to expose error usage of leaky buffer.

Jump to

Keyboard shortcuts

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