Documentation ¶
Index ¶
Constants ¶
const ( // Version is version of go-raknet library Version = "1.0.0" // NetworkProtocol is a version of Raknet protocol NetworkProtocol = 9 // MaxMTU is the maximum size of MTU MaxMTU = 1492 // MinMTU is the minimum size of MTU MinMTU = 400 // MaxChannel is the maximum size of order channel MaxChannels = 32 // DefaultChannel is default channel DefaultChannel = 0 // MaxSplitCount is the maximum size that can split MaxSplitCount = 128 // MaxSplitsPerQueue is the maximum size of Queue MaxSplitsPerQueue = 4 )
const MaxMetadataValues = 0xff
Variables ¶
var ( // SendInterval SendInterval time.Duration = 50 * time.Millisecond RecoverySendInterval = SendInterval PingSendInterval = 2500 * time.Millisecond DetectionSendInterval = PingSendInterval * 2 SessionTimeout = DetectionSendInterval * 5 MaxPacketsPerSecondBlock = 1000 * 300 * time.Millisecond )
var ConnctionTypeMagic = []byte{0x03, 0x08, 0x05, 0x0b, 0x43, 0x54, 0x49}
ConnectionTypeMagic is the magic for ConnectionType.
var ConnectionGoRaknet = &ConnectionType{
UUID: uuid.FromStringOrNil("495248b9-d485-4389-acd0-175fdb2233cf"),
Name: "GoRaknet",
Lang: "Go",
Version: "1.0.0",
}
ConnectionGoRaknet is a connection from go-raknet.
var ConnectionVanilla = &ConnectionType{ Name: "Vanilla", IsVanilla: true, }
ConnectionVanilla is a connection from a vanilla client or an unknown implementation
var Magic = []byte{0x00, 0xff, 0xff, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0xfd, 0xfd, 0xfd, 0xfd, 0x12, 0x34, 0x56, 0x78}
Magic is Raknet offline message data id using offline connection in Raknet
var MaxPacketsPerSecond = 500
MaxPacketsPerSecond is the maximum size that can send per second
Functions ¶
This section is empty.
Types ¶
type ConnectionType ¶
type ConnectionType struct { UUID uuid.UUID Name string Lang string Version string Metadata Metadata IsVanilla bool }
ConnectionType used to signify which implementation of the Raknet protocol
type Latency ¶
type Latency struct { // totalLatency is the total latency time TotalLatency time.Duration // latency is the average latency time Latency time.Duration // lastLatency is the last latency time LastLatency time.Duration // lowestLatency is the lowest latency time LowestLatency time.Duration // highestLatency is the highest latency time HighestLatency time.Duration // contains filtered or unexported fields }
type Logger ¶
type Logger interface { Info(msg ...interface{}) Warn(msg ...interface{}) Fatal(msg ...interface{}) Debug(msg ...interface{}) }
Logger is a logger interface supported
type Packet ¶
type Packet interface { // ID returns a packet id ID() byte // Encode encodes the packet Encode() error // Decode decodes the packet Decode() error // Bytes returns encoded bytes Bytes() []byte // SetBytes sets bytes to decode SetBytes([]byte) // New returns new packet New() Packet }
Packet is a basic packet interface
type Protocol ¶
type Protocol interface { // RegisterPackets registers packets // It's called in starting the server RegisterPackets() // Packet returns a packet with id Packet(id byte) Packet //Packets returns all registered packets Packets() []Packet }
Protocol is Raknet protocol's packets manager
type Record ¶
Record is ack numbers container for acknowledge packet
type Reliability ¶
type Reliability int
Reliability decides reliable and ordered of packet when sending Thanks: http://www.jenkinssoftware.com/raknet/manual/Doxygen/PacketPriority_8h.html#e41fa01235e99dced384d137fa874a7e
const ( // Unreliable is normal UDP packet. Unreliable Reliability = iota // UnreliableSequenced is the same as Unreliable. but it has Sequenced. UnreliableSequenced Reliable ReliableOrdered ReliableSequenced UnreliableWithACKReceipt ReliableWithACKReceipt ReliableOrderedWithACKReceipt )
func ReliabilityBinary ¶
func ReliabilityBinary(b byte) Reliability
ReliabilityBinary returns Reliability from binary
func (Reliability) IsNeededACK ¶
func (r Reliability) IsNeededACK() bool
IsNeededACK returns whether reliability need ack
func (Reliability) IsOrdered ¶
func (r Reliability) IsOrdered() bool
IsOrdered returns whether reliability has ordered
func (Reliability) IsReliable ¶
func (r Reliability) IsReliable() bool
IsReliable returns whether reliability has reliable
func (Reliability) IsSequenced ¶
func (r Reliability) IsSequenced() bool
IsSequenced returns whether reliability has sequenced
func (Reliability) ToBinary ¶
func (r Reliability) ToBinary() byte
ToBinary encode reliability to bytes
type SystemAddress ¶
SystemAddress is internal address for Raknet
func NewSystemAddress ¶
func NewSystemAddress(addr string, port uint16) *SystemAddress
NewSystemAddress returns a new SystemAddress from string
func NewSystemAddressBytes ¶
func NewSystemAddressBytes(addr []byte, port uint16) *SystemAddress
NewSystemAddress returns a new SystemAddress from bytes
func (*SystemAddress) Equal ¶
func (addr *SystemAddress) Equal(sub *SystemAddress) bool
Equal returns whether sub is the same address
func (*SystemAddress) IsLoopback ¶
func (addr *SystemAddress) IsLoopback() bool
IsLoopback returns whether this is loopback address
func (*SystemAddress) SetLoopback ¶
func (addr *SystemAddress) SetLoopback()
SetLoopback sets loopback address
func (*SystemAddress) String ¶
func (addr *SystemAddress) String() string
String returns as string Format: 192.168.11.1:8080, [fc00::]:8080
func (*SystemAddress) Version ¶
func (addr *SystemAddress) Version() int
Version returns the ip address version (4 or 6)