Documentation
¶
Index ¶
Constants ¶
View Source
const ( OpRRQ uint16 = 1 OpWRQ = 2 OpData = 3 OpAck = 4 OpError = 5 )
View Source
const MaxPacketSize = 2048
larger than a typical mtu (1500), and largest DATA packet (516). may limit the length of filenames in RRQ/WRQs -- RFC1350 doesn't offer a bound for these.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Packet ¶
type Packet interface {
// Parse parses a packet from its wire representation
Parse([]byte) error
// Serialize serializes a packet to its wire representation
Serialize() []byte
}
packet is the interface met by all packet structs
func ParsePacket ¶
ParsePacket parses a packet from its wire representation.
type PacketAck ¶
type PacketAck struct {
BlockNum uint16
}
PacketAck acknowledges receipt of a data packet
type PacketData ¶
PacketData carries a block of data in a file transmission.
func (*PacketData) Parse ¶
func (p *PacketData) Parse(buf []byte) (err error)
func (*PacketData) Serialize ¶
func (p *PacketData) Serialize() []byte
type PacketError ¶
PacketError is sent by a peer who has encountered an error condition
func (*PacketError) Parse ¶
func (p *PacketError) Parse(buf []byte) (err error)
func (*PacketError) Serialize ¶
func (p *PacketError) Serialize() []byte
type PacketRequest ¶
PacketRequest represents a request to read or rite a file.
func (*PacketRequest) Parse ¶
func (p *PacketRequest) Parse(buf []byte) (err error)
func (*PacketRequest) Serialize ¶
func (p *PacketRequest) Serialize() []byte
Click to show internal directories.
Click to hide internal directories.