tftp

package
v0.0.0-...-a6be157 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Mebibyte = 1048576

Variables

View Source
var TimeoutError = errors.New("timeout while waiting for file")

Functions

This section is empty.

Types

type SafeBuffer

type SafeBuffer struct {
	bytes.Buffer
	BytesWritten int
	Limit        int
}

func NewSafeBuffer

func NewSafeBuffer(sizeLimit int) *SafeBuffer

func (*SafeBuffer) Write

func (b *SafeBuffer) Write(p []byte) (n int, err error)

type Server

type Server struct {
	Server *tftp.Server

	ExternalIp net.IP
	// contains filtered or unexported fields
}

func NewServer

func NewServer(externalIp net.IP) *Server

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(addr string) error

ListenAndServe is a wrapper around tftp.ListenAndServe

func (*Server) WaitForFile

func (s *Server) WaitForFile(filename string, timeout time.Duration) (*SafeBuffer, error)

WaitForFile blocks until we receive a file with the given name via TFTP, or the time runs out

Jump to

Keyboard shortcuts

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