utp_file

package
v0.0.0-...-b6b3a0d Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MaxOutgoingQueueSize = 32

MaxOutgoingQueueSize is the maximum size of the outgoing queue.

Variables

View Source
var ErrNotAcceptingConnections = errors.New("not accepting connections")

ErrNotAcceptingConnections indicates that a socket is not accepting connections.

Functions

func MakeSocket

func MakeSocket(addr string) (*net.UDPConn, error)

MakeSocket creates a new UDP socket.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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