Documentation ¶
Index ¶
- func DialUDT(network string, laddr string, raddr *net.UDPAddr, isStream bool) (net.Conn, error)
- func DialUDTContext(ctx context.Context, network string, laddr string, raddr *net.UDPAddr, ...) (net.Conn, error)
- func ListenUDT(network string, addr string) (net.Listener, error)
- func ListenUDTContext(ctx context.Context, network string, addr string) (net.Listener, error)
- func RendezvousUDT(network string, laddr string, raddr *net.UDPAddr, isStream bool) (net.Conn, error)
- func RendezvousUDTContext(ctx context.Context, network string, laddr string, raddr *net.UDPAddr, ...) (net.Conn, error)
- type Config
- func (c *Config) Dial(ctx context.Context, network string, laddr string, raddr *net.UDPAddr, ...) (net.Conn, error)
- func (c *Config) Listen(ctx context.Context, network string, addr string) (net.Listener, error)
- func (c *Config) Rendezvous(ctx context.Context, network string, laddr string, raddr *net.UDPAddr, ...) (net.Conn, error)
- type CongestionControl
- type CongestionControlParms
- type NativeCongestionControl
- func (ncc NativeCongestionControl) Close(parms CongestionControlParms)
- func (ncc NativeCongestionControl) Init(parms CongestionControlParms)
- func (ncc NativeCongestionControl) OnACK(parms CongestionControlParms, ack packet.PacketID)
- func (ncc NativeCongestionControl) OnCustomMsg(parms CongestionControlParms, pkt packet.UserDefControlPacket)
- func (ncc NativeCongestionControl) OnNAK(parms CongestionControlParms, losslist []packet.PacketID)
- func (ncc NativeCongestionControl) OnPktRecv(parms CongestionControlParms, pkt packet.DataPacket)
- func (ncc NativeCongestionControl) OnPktSent(parms CongestionControlParms, pkt packet.Packet)
- func (ncc NativeCongestionControl) OnTimeout(parms CongestionControlParms)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DialUDT ¶
DialUDT establishes an outbound UDT connection using the supplied net, laddr and raddr. See function net.DialUDP for a description of net, laddr and raddr.
func DialUDTContext ¶
func DialUDTContext(ctx context.Context, network string, laddr string, raddr *net.UDPAddr, isStream bool) (net.Conn, error)
DialUDTContext establishes an outbound UDT connection using the supplied net, laddr and raddr. See function net.DialUDP for a description of net, laddr and raddr.
func ListenUDT ¶
ListenUDT listens for incoming UDT connections addressed to the local address laddr. See function net.ListenUDP for a description of net and laddr.
func ListenUDTContext ¶
ListenUDTContext listens for incoming UDT connections addressed to the local address laddr. See function net.ListenUDP for a description of net and laddr.
func RendezvousUDT ¶
func RendezvousUDT(network string, laddr string, raddr *net.UDPAddr, isStream bool) (net.Conn, error)
RendezvousUDT establishes an outbound UDT connection using the supplied net, laddr and raddr. See function net.DialUDP for a description of net, laddr and raddr.
func RendezvousUDTContext ¶
func RendezvousUDTContext(ctx context.Context, network string, laddr string, raddr *net.UDPAddr, isStream bool) (net.Conn, error)
RendezvousUDTContext establishes an outbound UDT connection using the supplied net, laddr and raddr. See function net.DialUDP for a description of net, laddr and raddr.
Types ¶
type Config ¶
type Config struct { CanAcceptDgram bool // can this listener accept datagrams? CanAcceptStream bool // can this listener accept streams? ListenReplayWindow time.Duration // length of time to wait for repeated incoming connections MaxPacketSize uint // Upper limit on maximum packet size (0 = unlimited) MaxBandwidth uint64 // Maximum bandwidth to take with this connection (in bytes/sec, 0 = unlimited) LingerTime time.Duration // time to wait for retransmit requests after connection shutdown MaxFlowWinSize uint // maximum number of unacknowledged packets to permit (minimum 32) CanAccept func(hsPacket *packet.HandshakePacket, from *net.UDPAddr) error // can this listener accept this connection? CongestionForSocket func(sock *udtSocket) CongestionControl // create or otherwise return the CongestionControl for this socket }
Config controls behavior of sockets created with it
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig constructs a Config with default values
func (*Config) Dial ¶
func (c *Config) Dial(ctx context.Context, network string, laddr string, raddr *net.UDPAddr, isStream bool) (net.Conn, error)
Dial establishes an outbound UDT connection using the supplied net, laddr and raddr. See function net.DialUDP for a description of net, laddr and raddr.
func (*Config) Listen ¶
Listen listens for incoming UDT connections addressed to the local address laddr. See function net.ListenUDP for a description of net and laddr.
func (*Config) Rendezvous ¶
func (c *Config) Rendezvous(ctx context.Context, network string, laddr string, raddr *net.UDPAddr, isStream bool) (net.Conn, error)
Rendezvous establishes an outbound UDT connection using the supplied net, laddr and raddr. See function net.DialUDP for a description of net, laddr and raddr.
type CongestionControl ¶
type CongestionControl interface { // Init to be called (only) at the start of a UDT connection. Init(CongestionControlParms) // Close to be called when a UDT connection is closed. Close(CongestionControlParms) // OnACK to be called when an ACK packet is received OnACK(CongestionControlParms, packet.PacketID) // OnNAK to be called when a loss report is received OnNAK(CongestionControlParms, []packet.PacketID) // OnTimeout to be called when a timeout event occurs OnTimeout(CongestionControlParms) // OnPktSent to be called when data is sent OnPktSent(CongestionControlParms, packet.Packet) // OnPktRecv to be called when data is received OnPktRecv(CongestionControlParms, packet.DataPacket) // OnCustomMsg to process a user-defined packet OnCustomMsg(CongestionControlParms, packet.UserDefControlPacket) }
CongestionControl controls how timing is handled and UDT connections tuned
type CongestionControlParms ¶
type CongestionControlParms interface { // GetSndCurrSeqNo is the most recently sent packet ID GetSndCurrSeqNo() packet.PacketID // SetCongestionWindowSize sets the size of the congestion window (in packets) SetCongestionWindowSize(uint) // GetCongestionWindowSize gets the size of the congestion window (in packets) GetCongestionWindowSize() uint // GetPacketSendPeriod gets the current delay between sending packets GetPacketSendPeriod() time.Duration // SetPacketSendPeriod sets the current delay between sending packets SetPacketSendPeriod(time.Duration) // GetMaxFlowWindow is the largest number of unacknowledged packets we can receive (in packets) GetMaxFlowWindow() uint // GetReceiveRates is the current calculated receive rate and bandwidth (in packets/sec) GetReceiveRates() (recvSpeed, bandwidth uint) // GetRTT is the current calculated roundtrip time between peers GetRTT() time.Duration // GetMSS is the largest packet size we can currently send (in bytes) GetMSS() uint // SetACKPerid sets the time between ACKs sent to the peer SetACKPeriod(time.Duration) // SetACKInterval sets the number of packets sent to the peer before sending an ACK SetACKInterval(uint) // SetRTOPeriod overrides the default EXP timeout calculations waiting for data from the peer SetRTOPeriod(time.Duration) }
CongestionControlParms permits a CongestionControl implementation to interface with the UDT socket
type NativeCongestionControl ¶
type NativeCongestionControl struct {
// contains filtered or unexported fields
}
NativeCongestionControl implements the default congestion control logic for UDP
func (NativeCongestionControl) Close ¶
func (ncc NativeCongestionControl) Close(parms CongestionControlParms)
Close to be called when a UDT connection is closed.
func (NativeCongestionControl) Init ¶
func (ncc NativeCongestionControl) Init(parms CongestionControlParms)
Init to be called (only) at the start of a UDT connection.
func (NativeCongestionControl) OnACK ¶
func (ncc NativeCongestionControl) OnACK(parms CongestionControlParms, ack packet.PacketID)
OnACK to be called when an ACK packet is received
func (NativeCongestionControl) OnCustomMsg ¶
func (ncc NativeCongestionControl) OnCustomMsg(parms CongestionControlParms, pkt packet.UserDefControlPacket)
OnCustomMsg to process a user-defined packet
func (NativeCongestionControl) OnNAK ¶
func (ncc NativeCongestionControl) OnNAK(parms CongestionControlParms, losslist []packet.PacketID)
OnNAK to be called when a loss report is received
func (NativeCongestionControl) OnPktRecv ¶
func (ncc NativeCongestionControl) OnPktRecv(parms CongestionControlParms, pkt packet.DataPacket)
OnPktRecv to be called when a data is received
func (NativeCongestionControl) OnPktSent ¶
func (ncc NativeCongestionControl) OnPktSent(parms CongestionControlParms, pkt packet.Packet)
OnPktSent to be called when data is sent
func (NativeCongestionControl) OnTimeout ¶
func (ncc NativeCongestionControl) OnTimeout(parms CongestionControlParms)
OnTimeout to be called when a timeout event occurs
Source Files ¶
- acceptsock_heap.go
- ack_history_heap.go
- atomic_duration.go
- atomic_uint32.go
- config.go
- congestion.go
- congestion_native.go
- datapacket_heap.go
- duration_array.go
- listener.go
- multiplexer.go
- packetid_heap.go
- recvloss_heap.go
- sendpacket_heap.go
- udt.go
- udtsocket.go
- udtsocket_cc.go
- udtsocket_recv.go
- udtsocket_send.go