pool

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSize = 16 * 0x400

Variables

View Source
var MaxSegmentSize = math.MaxUint16

Functions

func GetBuffer

func GetBuffer() *bytes.Buffer

func GetBytes

func GetBytes[T constraints.Integer](size T) []byte

func PutBuffer

func PutBuffer(b *bytes.Buffer)

func PutBytes

func PutBytes(b []byte)

Types

type Buffer added in v0.3.5

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

func GetBytesWriter added in v0.3.5

func GetBytesWriter[T constraints.Integer](size T) *Buffer

func NewBuffer added in v0.3.5

func NewBuffer(b []byte) *Buffer

func (*Buffer) Advance added in v0.3.5

func (b *Buffer) Advance(i int)

func (*Buffer) Bytes added in v0.3.5

func (b *Buffer) Bytes() []byte

func (*Buffer) Discard added in v0.3.5

func (b *Buffer) Discard(n int) []byte

func (*Buffer) Free added in v0.3.5

func (b *Buffer) Free()

func (*Buffer) Len added in v0.3.5

func (b *Buffer) Len() int

func (*Buffer) ReadFrom added in v0.3.5

func (b *Buffer) ReadFrom(c net.Conn) (int, error)

func (*Buffer) ReadFromPacket added in v0.3.5

func (b *Buffer) ReadFromPacket(pc net.PacketConn) (int, net.Addr, error)

func (*Buffer) String added in v0.3.5

func (b *Buffer) String() string

func (*Buffer) Truncate added in v0.3.5

func (b *Buffer) Truncate(n int)

func (*Buffer) Unwrap added in v0.3.5

func (b *Buffer) Unwrap() *Bytes

func (*Buffer) Write added in v0.3.5

func (b *Buffer) Write(bb []byte) (int, error)

func (*Buffer) WriteByte added in v0.3.5

func (b *Buffer) WriteByte(v byte) error

func (*Buffer) WriteLittleEndianUint16 added in v0.3.5

func (b *Buffer) WriteLittleEndianUint16(v uint16)

func (*Buffer) WriteLittleEndianUint32 added in v0.3.5

func (b *Buffer) WriteLittleEndianUint32(v uint32)

func (*Buffer) WriteLittleEndianUint64 added in v0.3.5

func (b *Buffer) WriteLittleEndianUint64(v uint64)

func (*Buffer) WriteString added in v0.3.5

func (b *Buffer) WriteString(s string)

func (*Buffer) WriteUint16 added in v0.3.5

func (b *Buffer) WriteUint16(v uint16)

func (*Buffer) WriteUint32 added in v0.3.5

func (b *Buffer) WriteUint32(v uint32)

func (*Buffer) WriteUint64 added in v0.3.5

func (b *Buffer) WriteUint64(v uint64)

type Bytes

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

func GetBytesBuffer added in v0.3.3

func GetBytesBuffer[T constraints.Integer](size T) *Bytes

func NewBytesBuffer added in v0.3.3

func NewBytesBuffer(b []byte) *Bytes

func (*Bytes) After

func (b *Bytes) After(index int) []byte

func (*Bytes) AsWriter added in v0.3.5

func (b *Bytes) AsWriter() *Buffer

func (*Bytes) Bytes

func (b *Bytes) Bytes() []byte

func (*Bytes) Copy added in v0.3.4

func (b *Bytes) Copy(byte []byte) *Bytes

func (*Bytes) Free added in v0.3.5

func (b *Bytes) Free()

func (*Bytes) Len added in v0.3.3

func (b *Bytes) Len() int

func (*Bytes) ReadFrom added in v0.3.5

func (b *Bytes) ReadFrom(c net.Conn) (int, error)

func (*Bytes) ReadFromPacket added in v0.3.5

func (b *Bytes) ReadFromPacket(pc net.PacketConn) (int, net.Addr, error)

func (*Bytes) Refactor added in v0.3.5

func (b *Bytes) Refactor(start, end int) *Bytes

func (*Bytes) String added in v0.3.5

func (b *Bytes) String() string

type MultipleBuffer added in v0.3.5

type MultipleBuffer []*Buffer

func (MultipleBuffer) Free added in v0.3.5

func (m MultipleBuffer) Free()

type MultipleBytes added in v0.3.3

type MultipleBytes []*Bytes

func (MultipleBytes) Free added in v0.3.5

func (m MultipleBytes) Free()

type Pool

type Pool interface {
	GetBytes(size int) []byte
	PutBytes(b []byte)

	GetBuffer() *bytes.Buffer
	PutBuffer(b *bytes.Buffer)
}
var DefaultPool Pool = &pool{}

type ReverseProxyBuffer

type ReverseProxyBuffer struct{}

func (ReverseProxyBuffer) Get

func (ReverseProxyBuffer) Get() []byte

func (ReverseProxyBuffer) Put

func (ReverseProxyBuffer) Put(b []byte)

Jump to

Keyboard shortcuts

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