pool

package
v5.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GetBuf     = _pool.Get
	ReleaseBuf = _pool.Release
)

Functions

func GetTimer

func GetTimer(t time.Duration) *time.Timer

func PackBuffer

func PackBuffer(m *dns.Msg) (*[]byte, error)

PackBuffer packs the dns msg m to wire format. Callers should release the buf by calling ReleaseBuf after they have done with the wire []byte.

func PackTCPBuffer added in v5.2.0

func PackTCPBuffer(m *dns.Msg) (*[]byte, error)

PackBuffer packs the dns msg m to wire format, with to bytes length header. Callers should release the buf by calling ReleaseBuf.

func ReleaseTimer

func ReleaseTimer(timer *time.Timer)

func ResetAndDrainTimer

func ResetAndDrainTimer(timer *time.Timer, d time.Duration)

Types

type BytesBufPool

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

func NewBytesBufPool

func NewBytesBufPool(initSize int) *BytesBufPool

func (*BytesBufPool) Get

func (p *BytesBufPool) Get() *bytes.Buffer

func (*BytesBufPool) Release

func (p *BytesBufPool) Release(b *bytes.Buffer)

Jump to

Keyboard shortcuts

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