package udp

Import Path
	github.com/pion/transport/v2/udp (on go.dev)

Dependency Relation
	imports 13 packages, and imported by one package

Involved Source Files batchconn.go Package udp provides a connection-oriented listener over a UDP PacketConn
Package-Level Type Names (total 7)
/* sort by: | */
BatchConn uses ipv4/v6.NewPacketConn to wrap a net.PacketConn to write/read messages in batch, only available in linux. In other platform, it will use single Write/Read as same as net.Conn. PacketConn net.PacketConn Close batchConn and the underlying PacketConn LocalAddr returns the local network address, if known. ReadBatch reads messages in batch, return length of message readed and error. ReadFrom reads a packet from the connection, copying the payload into p. It returns the number of bytes copied into p and the return address that was on the packet. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. Callers should always process the n > 0 bytes returned before considering the error err. ReadFrom can be made to time out and return an error after a fixed time limit; see SetDeadline and SetReadDeadline. SetDeadline sets the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline. A deadline is an absolute time after which I/O operations fail instead of blocking. The deadline applies to all future and pending I/O, not just the immediately following call to Read or Write. After a deadline has been exceeded, the connection can be refreshed by setting a deadline in the future. If the deadline is exceeded a call to Read or Write or to other I/O methods will return an error that wraps os.ErrDeadlineExceeded. This can be tested using errors.Is(err, os.ErrDeadlineExceeded). The error's Timeout method will return true, but note that there are other possible errors for which the Timeout method will return true even if the deadline has not been exceeded. An idle timeout can be implemented by repeatedly extending the deadline after successful ReadFrom or WriteTo calls. A zero value for t means I/O operations will not time out. SetReadDeadline sets the deadline for future ReadFrom calls and any currently-blocked ReadFrom call. A zero value for t means ReadFrom will not time out. SetWriteDeadline sets the deadline for future WriteTo calls and any currently-blocked WriteTo call. Even if write times out, it may return n > 0, indicating that some of the data was successfully written. A zero value for t means WriteTo will not time out. WriteTo write message to an UDPAddr, addr should be nil if it is a connected socket. *BatchConn : BatchReader BatchConn : github.com/pion/datachannel.ReadDeadliner BatchConn : github.com/pion/datachannel.WriteDeadliner *BatchConn : github.com/prometheus/common/expfmt.Closer *BatchConn : io.Closer *BatchConn : net.PacketConn func NewBatchConn(conn net.PacketConn, batchWriteSize int, batchWriteInterval time.Duration) *BatchConn
BatchIOConfig indicates config to batch read/write packets, it will use ReadBatch/WriteBatch to improve throughput for UDP. Enable bool ReadBatchSize indicates the maximum number of packets to be read in one batch, a batch size less than 2 means disable read batch. WriteBatchInterval indicates the maximum interval to wait before writing packets in one batch small interval will reduce latency/jitter, but increase the io count. WriteBatchSize indicates the maximum number of packets to be written in one batch
BatchPacketConn represents conn can read/write messages in batch ( BatchPacketConn) Close() error ( BatchPacketConn) ReadBatch(msg []ipv4.Message, flags int) (int, error) ( BatchPacketConn) WriteBatch(ms []ipv4.Message, flags int) (int, error) *golang.org/x/net/ipv4.PacketConn *golang.org/x/net/ipv4.RawConn *golang.org/x/net/ipv6.PacketConn BatchPacketConn : BatchReader BatchPacketConn : BatchWriter BatchPacketConn : github.com/prometheus/common/expfmt.Closer BatchPacketConn : io.Closer
BatchReader represents conn can read messages in batch ( BatchReader) ReadBatch(msg []ipv4.Message, flags int) (int, error) *BatchConn BatchPacketConn (interface) *golang.org/x/net/ipv4.PacketConn *golang.org/x/net/ipv4.RawConn *golang.org/x/net/ipv6.PacketConn
BatchWriter represents conn can write messages in batch ( BatchWriter) WriteBatch(ms []ipv4.Message, flags int) (int, error) BatchPacketConn (interface) *golang.org/x/net/ipv4.PacketConn *golang.org/x/net/ipv4.RawConn *golang.org/x/net/ipv6.PacketConn
Conn augments a connection-oriented connection over a UDP PacketConn Close closes the conn and releases any Read calls LocalAddr implements net.Conn.LocalAddr Read reads from c into p RemoteAddr implements net.Conn.RemoteAddr SetDeadline implements net.Conn.SetDeadline SetReadDeadline implements net.Conn.SetDeadline SetWriteDeadline implements net.Conn.SetDeadline Write writes len(p) bytes from p to the DTLS connection *Conn : github.com/pion/datachannel.ReadDeadliner *Conn : github.com/pion/datachannel.WriteDeadliner *Conn : github.com/pion/stun.Connection *Conn : github.com/pion/stun/v3.Connection *Conn : github.com/miekg/dns.Writer *Conn : github.com/prometheus/common/expfmt.Closer *Conn : internal/bisect.Writer *Conn : io.Closer *Conn : io.ReadCloser *Conn : io.Reader *Conn : io.ReadWriteCloser *Conn : io.ReadWriter *Conn : io.WriteCloser *Conn : io.Writer *Conn : net.Conn
ListenConfig stores options for listening to an address. AcceptFilter determines whether the new conn should be made for the incoming packet. If not set, any packet creates new conn. Backlog defines the maximum length of the queue of pending connections. It is equivalent of the backlog argument of POSIX listen function. If a connection request arrives when the queue is full, the request will be silently discarded, unlike TCP. Set zero to use default value 128 which is same as Linux default. Batch BatchIOConfig LoggerFactory logging.LoggerFactory ReadBufferSize sets the size of the operating system's receive buffer associated with the listener. WriteBufferSize sets the size of the operating system's send buffer associated with the connection. Listen creates a new listener based on the ListenConfig.
Package-Level Functions (total 2)
Listen creates a new listener using default ListenConfig.
NewBatchConn creates a *BatchConn from net.PacketConn with batch configs.
Package-Level Variables (total 3)
Typed errors
Typed errors
Typed errors