Documentation
¶
Overview ¶
Package bufpool holds buffers shared by networking helpers.
Index ¶
Constants ¶
View Source
const ( // SmallSize fits common datagrams, such as the queued datagrams of a // connection, which take the room of several when larger. SmallSize = 2 << 10 // StreamSize is the buffer a stream is copied through. StreamSize = 32 << 10 // MaxDatagram is the largest UDP datagram. MaxDatagram = 65535 // LargeSize fits the largest UDP datagram with room for a 2-byte length // ahead of it, as a frame header takes. LargeSize = 2 + MaxDatagram )
Variables ¶
View Source
var ( Small = &Pool{pool: sync.Pool{New: func() any { return NewBuf(SmallSize) }}, size: SmallSize} Stream = &Pool{pool: sync.Pool{New: func() any { return NewBuf(StreamSize) }}, size: StreamSize} Large = &Pool{pool: sync.Pool{New: func() any { return NewBuf(LargeSize) }}, size: LargeSize} )
The shared pools, initialised statically, so that a program that links this package without using them runs no initialisation for them.
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.