Documentation ¶
Index ¶
- type Channel
- func (channel *Channel) GetMessages() []IMessage
- func (channel *Channel) HandleSplitPacket(recvdata *bitbuf.Reader) int
- func (channel *Channel) ProcessPacket(msg IMessage) bool
- func (channel *Channel) ReadHeader(msg IMessage) (flags int32, headerSize int32)
- func (channel *Channel) WaitingOnFragments() bool
- func (channel *Channel) WriteHeader(msg IMessage, subchans bool) IMessage
- type Client
- type Connection
- type DataFragment
- type IListener
- type IMessage
- type SplitPacket
- type SubChannel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel is is responsible for processing received packets into appropriate formats.
func (*Channel) GetMessages ¶
GetMessages returns all received complete messages (ie packets that are not waiting for fragments)
func (*Channel) HandleSplitPacket ¶
HandleSplitPacket process a packet that contains multiple entries @TODO Implement me
func (*Channel) ProcessPacket ¶
ProcessPacket Reads received packet header and determines if the packet is ready to be inspected outside on the netcode. Any packet not deemed ready (e.g. split packet) will be queued until it is ready
func (*Channel) ReadHeader ¶
ReadHeader parses the received packet header. Returned data is header flags value.
func (*Channel) WaitingOnFragments ¶
WaitingOnFragments tests if the channel is expecting more fragments for a packet
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Source Engine multiplayer client
func (*Client) AddListener ¶
AddListener adds a callback handler for packet data
func (*Client) Disconnect ¶
Disconnect ends the socket connection. This must not be confused with sending the disconnect packet to a server. Failure to send a disconnect packet before calling Disconnect() will result in the server waiting for client packets until it times out.
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection is A UDP Connection for sending and receiving messages to a Source Engine server
func Connect ¶
func Connect(host string, port string) (*Connection, error)
Connect Establishes a connection with a server. Only ensures target ip:port is reachable.
func (*Connection) Receive ¶
func (conn *Connection) Receive() IMessage
Receive waits for a message from connected server
type DataFragment ¶
type DataFragment struct { Filename string Buffer []byte SizeInBytes uint32 SizeInBits uint32 TransferID uint32 // Used only for files IsCompressed bool // Is bzip compressed SizeUncompressed uint32 AsTCP bool // Send as TCP stream NumFragments int32 AcknowledgedFragments int32 // Fragments sent and acknowledges PendingFragments int32 // Fragments sent, but not (yet) acknowledged FragmentOffsets []int32 }
DataFragment is used for receiving files from the server. Since files are almost certainly
type IMessage ¶
type IMessage interface { Connectionless() bool // Is this message a connectionless message Data() []byte // Get message contents }
IMessage interface for any message type we should either send or receive
type SplitPacket ¶
type SplitPacket struct {
// contains filtered or unexported fields
}
SplitPacket is a case when a message can contain multiple packet types
type SubChannel ¶
type SubChannel struct { // FirstFragment is the first fragments FirstFragment [maxStreams]int32 // NumFragments is the number of fragments that make up NumFragments [maxStreams]int32 // SendSequenceCounter SendSequenceCounter int32 // State 0=free, 1=scheduled to read, 2=send & waiting, 3=dirty State int32 // Index into containing channels subchannel array Index int32 }
SubChannel is primarily used for splitting packet types up in the primary channel