Documentation ¶
Index ¶
Constants ¶
const ( ModeNETASCII = "netascii" ModeOctet = "octet" )
Variables ¶
var ( ErrInputNotNETASCII = errors.New("input is not valid NETASCII") ErrInvalidBlockNumber = errors.New("block number is not valid") ErrTooMuchData = errors.New("data packet contains more than 512 bytes") ErrMismatchingOpcode = errors.New("attempting to unmarshal a packet with mismatching opcode") )
Functions ¶
This section is empty.
Types ¶
type ACKPacket ¶
type ACKPacket struct { // Acknowledged block number. For RRQs, this will be the requested block number and will be acknowledged by the // corresponding block being sent in a DATA packet; for WRQs this will be 0 BlockNumber uint16 }
ACKPacket represents an Acknowledge packet. ACK packets are acknowledged by DATA or ERROR packets.
type DATAPacket ¶
type DATAPacket struct { // Block number, starting from 1 BlockNumber uint16 // Data being transferred within this packet, with a maximum length of 512. // If the length of this field is between 0 and 511, the transfer is considered complete Data []byte }
DATAPacket represents a data packet
type ERRORPacket ¶
ERRORPacket represents an Error packet. ERROR packets are sent when to acknowledge any kind of packet which results in an unsuccessful outcome.
type ErrorCode ¶
type ErrorCode uint16
ErrorCode represents an error code, as defined in the TFTP standard
type IOError ¶
type IOError struct { Msg string // High-level description of the error Err error // Original error }
IOError type encapsulates I/O errors when marshalling or unmarshalling binary packets
func NewIOError ¶
type Opcode ¶
type Opcode uint16
Opcode type represents a TFTP opcode
const ACK Opcode = 4
ACK is the opcode for the ACK (Acknowledgement) packet
const DATA Opcode = 3
DATA is the opcode for the DATA (Data) packet
const ERROR Opcode = 5
ERROR is the opcode for the ERROR (Error) packet
const RRQ Opcode = 1
RRQ is the opcode for the RRQ (Read Request) packet
const WRQ Opcode = 2
WRQ is the opcode for the WRQ (Write Request) packet
type RRQPacket ¶
type RRQPacket struct { // Destination filename. This should only contain NETASCII characters Filename string // File mode Mode Mode }
RRQPacket represents a Read Request packet