batchpc

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const MaxBatchSize = 64

MaxBatchSize is the maximum number of packets that can be read/written in a single batch.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchPacketConn

type BatchPacketConn interface {
	net.PacketConn
	ReadBatch(msgs []Message, flags int) (int, error)
	WriteBatch(msgs []Message, flags int) (int, error)
}

BatchPacketConn is a PacketConn with batched I/O using Messages.

func New

func New(network string, pc net.PacketConn) (BatchPacketConn, error)

New creates a pooled BatchPacketConn wrapping a UDP PacketConn. network must be one of: "udp", "udp4", "udp6" (empty treated as "udp"). If network == "udp", we infer from LocalAddr(); if ambiguous we prefer IPv6. Only *net.UDPConn is supported.

type Message

type Message struct {
	Buf  []byte
	Addr net.Addr
}

Message represents a single packet for batched I/O.

Jump to

Keyboard shortcuts

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