Documentation ¶
Index ¶
Constants ¶
const MaxOutgoingQueueSize = 32
MaxOutgoingQueueSize is the maximum size of the outgoing queue.
Variables ¶
var ErrNotAcceptingConnections = errors.New("not accepting connections")
ErrNotAcceptingConnections indicates that a socket is not accepting connections.
Functions ¶
Types ¶
type UDPOutgoing ¶
type UDPOutgoing struct {
// contains filtered or unexported fields
}
UDPOutgoing represents an outgoing message, with contents and a destination address.
type UDPSocketManager ¶
type UDPSocketManager struct { *libutp.SocketMultiplexer Logger *zap.Logger OnIncomingConnection func(*libutp.Socket) error // contains filtered or unexported fields }
UDPSocketManager keeps track of a UDP socket.
func NewUDPSocketManager ¶
func NewUDPSocketManager(logger *zap.Logger) *UDPSocketManager
NewUDPSocketManager creates a new UDPSocketManager.
func (*UDPSocketManager) Close ¶
func (usm *UDPSocketManager) Close() error
Close closes the UDP socket.
func (*UDPSocketManager) Flush ¶
func (usm *UDPSocketManager) Flush()
Flush writes any pending outgoing messages to the UDP socket until an error is encountered or until there are no more pending outgoing messages.
func (*UDPSocketManager) Select ¶
func (usm *UDPSocketManager) Select(blockTime time.Duration) error
Select blocks until data can be read from the UDP socket, or until blockTime has elapsed. Any available data is passed on to the µTP mechanism.
func (*UDPSocketManager) Send ¶
func (usm *UDPSocketManager) Send(p []byte, addr *net.UDPAddr)
Send arranges for data to be sent over µTP on the UDP socket.
func (*UDPSocketManager) SetSocket ¶
func (usm *UDPSocketManager) SetSocket(sock *net.UDPConn)
SetSocket sets the socket to be associated with a UDPSocketManager.