Documentation
¶
Overview ¶
Package tftp2 implements the Trivial File Transfer Protocol as defined in RFC 1350.
Package tftp2 implements the Trivial File Transfer Protocol as defined in RFC 1350.
Package tftp2 implements the Trivial File Transfer Protocol as defined in RFC 1350.
Package tftp2 implements the Trivial File Transfer Protocol as defined in RFC 1350.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrServerClosed = errors.New("tftp: Server closed")
ErrServerClosed is returned by the Server's serve and ListenAndServe methods after a call to Shutdown or Close.
var ( // ServerContextKey is a context key. It can be used in TFTP // handlers with context.WithValue to access the server that // started the handler. The associated value will be of // type *Server. TODO: Design - What is my equivalent of an srv.Handler? ServerContextKey = &contextKey{"tftp-server"} )
Functions ¶
func ListenAndServe ¶
ListenAndServe listens on the UDP network at address ":tftp" and then serves requests on incoming connections from the path at root.
ListenAndServe always returns a non-nil error.
Types ¶
type Server ¶
type Server struct { Addr string // Addr is the UDP address to listen on, ":tftp" if empty. Root string // Root is the path to the directory in the Operating System which holds the files to be served. // IdleTimeout is the maximum amount of time to wait for the // next packet from a client connection. The connection's // deadline is reset after sending a packet to the client. // The default value is 5 seconds. IdleTimeout time.Duration // Go 1.8 // ErrorLog specifies an optional logger for errors accepting // connections, unexpected behavior from handlers, and // underlying FileSystem errors. // If nil, logging is done via the log package's standard logger. ErrorLog *log.Logger // Go 1.3 // contains filtered or unexported fields }
Server defines parameters for running a TFTP server. The zero value for Server is a valid configuration.
func (*Server) ListenAndServe ¶
ListenAndServe listens on the UDP network address srv.Addr and then calls Serve to handle requests on incoming connections.
If srv.Addr is blank, ":tftp" is used.
ListenAndServe always returns a non-nil error. After Shutdown or Close, the returned error is ErrServerClosed.