Documentation ¶
Index ¶
Constants ¶
View Source
const ( // io.Copy default buffer size is 32 KiB // but the maximum packet size of vmess/shadowsocks is about 16 KiB // so define a buffer of 20 KiB to reduce the memory of each TCP relay RelayBufferSize = 20 * 1024 // RelayBufferSize uses 20KiB, but due to the allocator it will actually // request 32Kib. 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 ¶
This section is empty.
Functions ¶
Types ¶
type Allocator ¶
type Allocator struct {
// contains filtered or unexported fields
}
Allocator for incoming frames, optimized to prevent overwriting after zeroing
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%.
Click to show internal directories.
Click to hide internal directories.