Documentation ¶
Index ¶
- func PacketTypeName(pt PacketType) string
- type Ack2Packet
- type AckPacket
- type CongestionPacket
- type ControlPacket
- type DataPacket
- func (dp *DataPacket) GetMessageData() (MessageBoundary, bool, uint32)
- func (dp *DataPacket) PacketType() PacketType
- func (dp *DataPacket) SendTime() (ts uint32)
- func (dp *DataPacket) SetHeader(destSockID uint32, ts uint32)
- func (dp *DataPacket) SetMessageData(boundary MessageBoundary, order bool, msg uint32)
- func (dp *DataPacket) SocketID() (sockID uint32)
- func (dp *DataPacket) WriteTo(buf []byte) (uint, error)
- type ErrPacket
- type HandshakePacket
- type HandshakeReqType
- type KeepAlivePacket
- type LightAckPacket
- type MessageBoundary
- type MsgDropReqPacket
- type NakPacket
- type Packet
- type PacketID
- type PacketType
- type ShutdownPacket
- type SocketType
- type UserDefControlPacket
- func (p *UserDefControlPacket) PacketType() PacketType
- func (h *UserDefControlPacket) SendTime() (ts uint32)
- func (h *UserDefControlPacket) SetHeader(destSockID uint32, ts uint32)
- func (h *UserDefControlPacket) SocketID() (sockID uint32)
- func (p *UserDefControlPacket) WriteTo(buf []byte) (uint, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PacketTypeName ¶
func PacketTypeName(pt PacketType) string
PacketTypeName returns a name describing the specified packet type
Types ¶
type Ack2Packet ¶
type Ack2Packet struct { AckSeqNo uint32 // ACK sequence number // contains filtered or unexported fields }
Ack2Packet is a UDT packet acknowledging receipt of an ACK packet
func (*Ack2Packet) PacketType ¶
func (p *Ack2Packet) PacketType() PacketType
PacketType returns the packetType associated with this packet
type AckPacket ¶
type AckPacket struct { AckSeqNo uint32 // ACK sequence number PktSeqHi PacketID // The packet sequence number to which all the previous packets have been received (excluding) Rtt uint32 // RTT (in microseconds) RttVar uint32 // RTT variance BuffAvail uint32 // Available buffer size (in bytes) // the following data is optional (not sent more than SYN) IncludeLink bool PktRecvRate uint32 // Packets receiving rate (in number of packets per second) EstLinkCap uint32 // Estimated link capacity (in number of packets per second) // contains filtered or unexported fields }
AckPacket is a UDT packet acknowledging previously-received data packets and describing the state of the link
func (*AckPacket) PacketType ¶
func (p *AckPacket) PacketType() PacketType
PacketType returns the packetType associated with this packet
type CongestionPacket ¶
type CongestionPacket struct {
// contains filtered or unexported fields
}
CongestionPacket is a (deprecated) UDT packet notifying the peer of increased congestion
func (*CongestionPacket) PacketType ¶
func (p *CongestionPacket) PacketType() PacketType
PacketType returns the packetType associated with this packet
type ControlPacket ¶
type ControlPacket interface { // socketId retrieves the socket id of a packet SocketID() (sockID uint32) // SendTime retrieves the timesamp of the packet SendTime() (ts uint32) WriteTo(buf []byte) (uint, error) SetHeader(destSockID uint32, ts uint32) PacketType() PacketType // contains filtered or unexported methods }
ControlPacket represents a UDT control packet.
type DataPacket ¶
type DataPacket struct { Seq PacketID // packet sequence number (top bit = 0) DstSockID uint32 // destination socket Data []byte // payload // contains filtered or unexported fields }
DataPacket is a UDT packet containing message data
func (*DataPacket) GetMessageData ¶
func (dp *DataPacket) GetMessageData() (MessageBoundary, bool, uint32)
GetMessageData returns the message field for this data packet
func (*DataPacket) PacketType ¶
func (dp *DataPacket) PacketType() PacketType
PacketType returns the packetType associated with this packet
func (*DataPacket) SendTime ¶
func (dp *DataPacket) SendTime() (ts uint32)
SendTime sets the timestamp field for this data packet
func (*DataPacket) SetHeader ¶
func (dp *DataPacket) SetHeader(destSockID uint32, ts uint32)
SetHeader sets the fields common to UDT data packets
func (*DataPacket) SetMessageData ¶
func (dp *DataPacket) SetMessageData(boundary MessageBoundary, order bool, msg uint32)
SetMessageData sets the message field for this data packet
func (*DataPacket) SocketID ¶
func (dp *DataPacket) SocketID() (sockID uint32)
SocketID sets the Socket ID for this data packet
type ErrPacket ¶
type ErrPacket struct { Errno uint32 // error code // contains filtered or unexported fields }
ErrPacket is a (undocumented) UDT packet describing an out-of-band error code
func (*ErrPacket) PacketType ¶
func (p *ErrPacket) PacketType() PacketType
PacketType returns the packetType associated with this packet
type HandshakePacket ¶
type HandshakePacket struct { UdtVer uint32 // UDT version SockType SocketType // Socket Type (1 = STREAM or 2 = DGRAM) InitPktSeq PacketID // initial packet sequence number MaxPktSize uint32 // maximum packet size (including UDP/IP headers) MaxFlowWinSize uint32 // maximum flow window size ReqType HandshakeReqType // connection type (regular(1), rendezvous(0), -1/-2 response) SockID uint32 // socket ID SynCookie uint32 // SYN cookie SockAddr net.IP // the IP address of the UDP socket to which this packet is being sent // contains filtered or unexported fields }
HandshakePacket is a UDT packet used to negotiate a new connection
func (*HandshakePacket) PacketType ¶
func (p *HandshakePacket) PacketType() PacketType
PacketType returns the packetType associated with this packet
type HandshakeReqType ¶
type HandshakeReqType int32
HandshakeReqType describes the type of handshake packet
const ( // HsRequest represents an attempt to establish a new connection HsRequest HandshakeReqType = 1 //HsRendezvous represents an attempt to establish a new connection using mutual rendezvous packets HsRendezvous HandshakeReqType = 0 //HsResponse is a response to a handshake request HsResponse HandshakeReqType = -1 //HsResponse2 is an acknowledgement that a HsResponse was received HsResponse2 HandshakeReqType = -2 //HsRefused notifies the peer of a connection refusal HsRefused HandshakeReqType = 1002 )
type KeepAlivePacket ¶
type KeepAlivePacket struct {
// contains filtered or unexported fields
}
KeepAlivePacket is a UDT packet used to keep a connection alive when no data is being sent
func (*KeepAlivePacket) PacketType ¶
func (p *KeepAlivePacket) PacketType() PacketType
PacketType returns the packetType associated with this packet
type LightAckPacket ¶
type LightAckPacket struct { PktSeqHi PacketID // The packet sequence number to which all the previous packets have been received (excluding) // contains filtered or unexported fields }
LightAckPacket is a UDT variant of the ACK packet for acknowledging received data with minimal information
func (*LightAckPacket) PacketType ¶
func (p *LightAckPacket) PacketType() PacketType
PacketType returns the packetType associated with this packet
type MessageBoundary ¶
type MessageBoundary uint8
MessageBoundary flags for where this packet falls within a message
const ( // MbFirst is the first packet in a multi-packet message MbFirst MessageBoundary = 2 // MbLast is the last packet in a multi-packet message MbLast MessageBoundary = 1 // MbOnly is the only packet in this message MbOnly MessageBoundary = 3 // MbMiddle is neither the first nor last packet in a multi-packet message MbMiddle MessageBoundary = 0 )
type MsgDropReqPacket ¶
type MsgDropReqPacket struct { MsgID uint32 // Message ID FirstSeq PacketID // First sequence number in the message LastSeq PacketID // Last sequence number in the message // contains filtered or unexported fields }
MsgDropReqPacket is a UDT packet notifying the peer of expired packets not worth trying to send
func (*MsgDropReqPacket) PacketType ¶
func (p *MsgDropReqPacket) PacketType() PacketType
PacketType returns the packetType associated with this packet
type NakPacket ¶
type NakPacket struct { CmpLossInfo []uint32 // integer array of compressed loss information // contains filtered or unexported fields }
NakPacket is a UDT packet notifying the peer of lost packets
func (*NakPacket) PacketType ¶
func (p *NakPacket) PacketType() PacketType
PacketType returns the packetType associated with this packet
type Packet ¶
type Packet interface { // socketId retrieves the socket id of a packet SocketID() (sockID uint32) // SendTime retrieves the timesamp of the packet SendTime() (ts uint32) // WriteTo writes this packet to the provided buffer, returning the length of the packet WriteTo(buf []byte) (uint, error) SetHeader(destSockID uint32, ts uint32) PacketType() PacketType // contains filtered or unexported methods }
Packet represents a UDT packet
func ReadPacketFrom ¶
ReadPacketFrom takes the contents of a UDP packet and decodes it into a UDT packet
type PacketID ¶
type PacketID struct {
Seq uint32
}
PacketID represents a UDT packet ID sequence
type PacketType ¶
type PacketType uint16
PacketType describes the type of UDP packet we're dealing with
type ShutdownPacket ¶
type ShutdownPacket struct {
// contains filtered or unexported fields
}
ShutdownPacket is a UDT packet notifying the peer of connection shutdown
func (*ShutdownPacket) PacketType ¶
func (p *ShutdownPacket) PacketType() PacketType
PacketType returns the packetType associated with this packet
type SocketType ¶
type SocketType uint16
SocketType describes the kind of socket this is (i.e. streaming vs message)
const ( // TypeSTREAM describes a reliable streaming protocol (e.g. TCP) TypeSTREAM SocketType = 1 // TypeDGRAM describes a partially-reliable messaging protocol TypeDGRAM SocketType = 2 )
type UserDefControlPacket ¶
type UserDefControlPacket struct {
// contains filtered or unexported fields
}
UserDefControlPacket is a UDT user-defined packet
func (*UserDefControlPacket) PacketType ¶
func (p *UserDefControlPacket) PacketType() PacketType
PacketType returns the packetType associated with this packet