Documentation ¶
Overview ¶
Package rudp implements the low-level Minetest protocol described at https://dev.minetest.net/Network_Protocol#Low-level_protocol.
Index ¶
- Constants
- Variables
- type Channel
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) Closed() <-chan struct{}
- func (c *Conn) ID() PeerID
- func (c *Conn) IsSrv() bool
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) Recv() (Pkt, error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) Send(pkt Pkt) (ack <-chan struct{}, err error)
- func (c *Conn) WhyClosed() error
- type Listener
- type PeerID
- type Pkt
- type PktInfo
- type TooBigChError
- type TrailingDataError
Constants ¶
const ( ConnTimeout = 30 * time.Second PingTimeout = 5 * time.Second )
const ( MaxRelPktSize = 32439825 MaxUnrelPktSize = 32636430 )
Variables ¶
var ErrOutOfPeerIDs = errors.New("out of peer ids")
var ErrPktTooBig = errors.New("can't send pkt: too big")
var ErrTimedOut = errors.New("timed out")
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel uint8
Reliable packets in a channel are be received in the order they are sent in. A Channel must be less than ChannelCount.
const ChannelCount Channel = 3
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
A Conn is a connection to a client or server. All Conn's methods are safe for concurrent use.
func (*Conn) Close ¶
Close closes the Conn. Any blocked Send or Recv calls will return net.ErrClosed.
func (*Conn) Closed ¶
func (c *Conn) Closed() <-chan struct{}
Closed returns a channel which is closed when the Conn is closed.
func (*Conn) RemoteAddr ¶
RemoteAddr returns the remote network address.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
All Listener's methods are safe for concurrent use.
func Listen ¶
func Listen(pc net.PacketConn) *Listener
Listen listens for connections on pc, pc is closed once the returned Listener and all Conns connected through it are closed.
type PeerID ¶
type PeerID uint16
PeerIDs aren't actually used to identify peers, IP addresses and ports are, these just exist for backward compatibility.
type TooBigChError ¶
type TooBigChError Channel
A TooBigChError reports a Channel greater than or equal to ChannelCount.
func (TooBigChError) Error ¶
func (e TooBigChError) Error() string
type TrailingDataError ¶
type TrailingDataError []byte
A TrailingDataError reports trailing data after a packet.
func (TrailingDataError) Error ¶
func (e TrailingDataError) Error() string