package packetio
Import Path
github.com/pion/transport/v2/packetio (on go.dev)
Dependency Relation
imports 5 packages, and imported by one package
Package-Level Type Names (total 2)
Buffer allows writing packets to an intermediate buffer, which can then be read form.
This is verify similar to bytes.Buffer but avoids combining multiple writes into a single read.
Close the buffer, unblocking any pending reads.
Data in the buffer can still be read, Read will return io.EOF only when empty.
Count returns the number of packets in the buffer.
Read populates the given byte slice, returning the number of bytes read.
Blocks until data is available or the buffer is closed.
Returns io.ErrShortBuffer is the packet is too small to copy the Write.
Returns io.EOF if the buffer is closed.
SetLimitCount controls the maximum number of packets that can be buffered.
Causes Write to return ErrFull when this limit is reached.
A zero value will disable this limit.
SetLimitSize controls the maximum number of bytes that can be buffered.
Causes Write to return ErrFull when this limit is reached.
A zero value means 4MB since v0.11.0.
User can set packetioSizeHardLimit build tag to enable 4MB hard limit.
When packetioSizeHardLimit build tag is set, SetLimitSize exceeding
the hard limit will be silently discarded.
SetReadDeadline sets the deadline for the Read operation.
Setting to zero means no deadline.
Size returns the total byte size of packets in the buffer, including
a small amount of administrative overhead.
Write appends a copy of the packet data to the buffer.
Returns ErrFull if the packet doesn't fit.
Note that the packet size is limited to 65536 bytes since v0.11.0 due to the internal data structure.
*Buffer : github.com/pion/datachannel.ReadDeadliner
*Buffer : github.com/pion/stun.Connection
*Buffer : github.com/pion/stun/v3.Connection
*Buffer : github.com/gogo/protobuf/proto.Sizer
*Buffer : github.com/miekg/dns.Writer
*Buffer : github.com/prometheus/common/expfmt.Closer
*Buffer : internal/bisect.Writer
*Buffer : io.Closer
*Buffer : io.ReadCloser
*Buffer : io.Reader
*Buffer : io.ReadWriteCloser
*Buffer : io.ReadWriter
*Buffer : io.WriteCloser
*Buffer : io.Writer
func NewBuffer() *Buffer
BufferPacketType allow the Buffer to know which packet protocol is writing.
const RTCPBufferPacket
const RTPBufferPacket
Package-Level Functions (only one)
NewBuffer creates a new Buffer.
Package-Level Variables (total 2)
ErrFull is returned when the buffer has hit the configured limits.
ErrTimeout is returned when a deadline has expired
Package-Level Constants (total 2)
RTCPBufferPacket indicates the Buffer that is handling RTCP packets
RTPBufferPacket indicates the Buffer that is handling RTP packets
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |