tftp

package
v0.0.0-...-a9a8c08 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2015 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package tftp provides a read-only TFTP server implementation.

ListenAndServe starts a TFTP server with a given address and handler.

log.Fatal(tftp.ListenAndServe("udp4", ":69", fooHandler))

Index

Constants

This section is empty.

Variables

View Source
var Debug = func(string, ...interface{}) {}

Debug is called with messages relevant to debugging or tracing the behavior of the TFTP server.

View Source
var Log = func(msg string, args ...interface{}) {
	log.Printf(msg, args)
}

Log is called with messages of general interest.

Functions

func ListenAndServe

func ListenAndServe(family, addr string, handler Handler) error

ListenAndServe listens on the given address/family and then calls Serve with handler to handle incoming requests.

func Serve

func Serve(l net.PacketConn, handler Handler)

Serve accepts incoming TFTP read requests on the listener l, creating a new service goroutine for each. The service goroutines use handler to get a byte stream and send it to the client.

Types

type Handler

type Handler func(path string, clientAddr net.Addr) (io.ReadCloser, error)

A Handler provides the bytes for a file.

func Blob

func Blob(b []byte) Handler

Blob returns a handler that serves b for all paths and clients.

Jump to

Keyboard shortcuts

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