Documentation ¶
Index ¶
- Variables
- func SanitizeString(s string) string
- type Packet
- func (p *Packet) HasRemaining() bool
- func (p *Packet) Len() int
- func (p *Packet) ReadByte() (byte, error)
- func (p *Packet) ReadInt() (int, error)
- func (p *Packet) ReadString() (s string, err error)
- func (p *Packet) SubPacket(n int) (q *Packet, err error)
- func (p *Packet) SubPacketFromRemaining() (*Packet, error)
- func (p *Packet) WriteByte(b byte) error
- func (p *Packet) WriteInt(value int32)
- func (p *Packet) WriteString(s string)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrBufferTooShort = errors.New("cubecode: buffer too short")
Functions ¶
func SanitizeString ¶
SanitizeString returns the string, cleared of sauer color codes like \f3 for red.
Types ¶
type Packet ¶
type Packet struct {
// contains filtered or unexported fields
}
Packet represents a Sauerbraten UDP packet.
func (*Packet) HasRemaining ¶
HasRemaining returns true if there are bytes remaining to be read in the packet.
func (*Packet) ReadString ¶
ReadString returns a string of the next bytes up to 0x00.
func (*Packet) SubPacket ¶
SubPacket returns a part of the packet as new packet. It does not copy the underlying slice!
func (*Packet) SubPacketFromRemaining ¶
SubPacketFromRemaining returns a packet from the bytes remaining in p's buffer.
func (*Packet) WriteInt ¶
WriteInt writes an int32 to the packet buffer. It grows the packet as needed.
func (*Packet) WriteString ¶
Click to show internal directories.
Click to hide internal directories.