Documentation ¶
Index ¶
Constants ¶
View Source
const ( ServerPort = 33340 // tftp server port ClientPort = 33341 // tftp client port )
Variables ¶
View Source
var ErrShouldWait = fmt.Errorf("target is busy")
ErrShouldWait indicates that the target is busy.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { Read(ctx context.Context, filename string) (*bytes.Reader, error) Write(ctx context.Context, filename string, reader io.ReaderAt, size int64) error RemoteAddr() *net.UDPAddr }
Client is used to Read or Write files to/from a TFTP remote.
type ClientImpl ¶
type ClientImpl struct {
// contains filtered or unexported fields
}
ClientImpl implements the Client interface; it is exported for testing.
func NewClient ¶
func NewClient(addr *net.UDPAddr, blockSize, windowSize uint16) (*ClientImpl, error)
NewClient returns a Client which can be used to Read or Write files to/from a TFTP remote. A blockSize and windowSize of 0 will use the default values defined in tftp.go.
func (*ClientImpl) Read ¶
Read requests to read a file from the TFTP remote, if the request is successful, the contents of the remote file are returned as a bytes.Reader, if the request is unsuccessful an error is returned, if the error is ErrShouldWait, the request can be retried at some point in the future.
func (*ClientImpl) RemoteAddr ¶
func (c *ClientImpl) RemoteAddr() *net.UDPAddr
Click to show internal directories.
Click to hide internal directories.