Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnToPacketConn ¶
func ConnToPacketConn(conn net.Conn) net.PacketConn
ConnToPacketConn wraps around a dialed UDP connection. Its only purpose is to wrap around WriteTo and make it call Write instead, because WriteTo is invalid on a dialed connection.
Types ¶
type DiscardHandler ¶
type DiscardHandler struct{}
DiscardHandler implements a slog.Handler that is always disabled. Each of its methods return immediately without any code running.
type ElasticChan ¶
type ElasticChan[T any] struct { // contains filtered or unexported fields }
ElasticChan is a channel that grows if its capacity is reached. ElasticChan is safe for concurrent use with multiple readers and 1 sender. Calling Send from multiple goroutines simultaneously is unsafe.
func (*ElasticChan[T]) Recv ¶
func (c *ElasticChan[T]) Recv(cancel <-chan struct{}) (val T, ok bool)
Recv attempts to read a value from the channel. If cancel is closed, Recv will return ok = false.
func (*ElasticChan[T]) Send ¶
func (c *ElasticChan[T]) Send(val T)
Send sends a value to the channel. Send never blocks, because if the maximum capacity of the underlying channel is reached, a larger one is created.