tftp

package
v0.0.0-...-ff65996 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DatagramSize = 516              // the maximum supported datagram size
	BlockSize    = DatagramSize - 4 // the DatagramSize minus a 4-byte header
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Ack

type Ack uint16

func (Ack) MarshalBinary

func (a Ack) MarshalBinary() ([]byte, error)

func (*Ack) UnmarshalBinary

func (a *Ack) UnmarshalBinary(p []byte) error

type Data

type Data struct {
	Block   uint16
	Payload io.Reader
}

func (*Data) MarshalBinary

func (d *Data) MarshalBinary() ([]byte, error)

func (*Data) UnmarshalBinary

func (d *Data) UnmarshalBinary(p []byte) error

type Err

type Err struct {
	Error   ErrCode
	Message string
}

func (Err) MarshalBinary

func (e Err) MarshalBinary() ([]byte, error)

func (*Err) UnmarshalBinary

func (e *Err) UnmarshalBinary(p []byte) error

type ErrCode

type ErrCode uint16
const (
	ErrUnknown ErrCode = iota
	ErrNotFound
	ErrAccessViolation
	ErrDiskFull
	ErrIllegalOp
	ErrUnknownID
	ErrFileExists
	ErrNoUser
)

type OpCode

type OpCode uint16
const (
	OpRRQ OpCode = iota + 1

	OpData
	OpAck
	OpErr
)

type ReadReq

type ReadReq struct {
	Filename string
	Mode     string
}

func (ReadReq) MarshalBinary

func (q ReadReq) MarshalBinary() ([]byte, error)

func (*ReadReq) UnmarshalBinary

func (q *ReadReq) UnmarshalBinary(p []byte) error

type Server

type Server struct {
	Payload []byte        // the payload served for all read requests
	Retries uint8         // the number of times to retry a failed transmission
	Timeout time.Duration // the duration to wait for an acknowledgment
}

Server represents a read-only TFTP server that supports a subset of RFC 1350.

func (Server) ListenAndServe

func (s Server) ListenAndServe(addr string) error

func (*Server) Serve

func (s *Server) Serve(conn net.PacketConn) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL