pool

package
v1.19.34-clash.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: GPL-3.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// RelayBufferSize using for tcp
	// io.Copy default buffer size is 32 KiB
	RelayBufferSize = 32 * 1024

	// UDPBufferSize using for udp
	// Most UDPs are smaller than the MTU, and the TUN's MTU
	// set to 9000, so the UDP Buffer size set to 16Kib
	UDPBufferSize = 16 * 1024
)

Variables

View Source
var DefaultAllocator = NewAllocator()

Functions

func Get

func Get(size int) []byte

func GetBuffer

func GetBuffer() *bytes.Buffer

func Put

func Put(buf []byte) error

func PutBuffer

func PutBuffer(buf *bytes.Buffer)

Types

type Allocator

type Allocator interface {
	Get(size int) []byte
	Put(buf []byte) error
}

func NewAllocator

func NewAllocator() Allocator

NewAllocator initiates a []byte allocator for frames less than 65536 bytes, the waste(memory fragmentation) of space allocation is guaranteed to be no more than 50%.

Jump to

Keyboard shortcuts

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