Documentation
¶
Index ¶
- Variables
- func ExecuteOp(input []string, clientcfg *ClientCfg, stdout io.Writer) (bool, error)
- func RunInteractive(f Flags, ipPort []string, stdin io.Reader, stdout io.Writer) error
- func ValidateMode(mode string) (tftp.TransferMode, error)
- type Client
- type ClientCfg
- type ClientIf
- type Flags
- type RealResponse
- type Response
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidTransferMode = errors.New("invalid transfer mode")
ErrInvalidTransferMode is returned by ValidateMode in case the provided mode string has no matching tftp.TransferMode.
Functions ¶
func ExecuteOp ¶
ExecuteOp executes a given command on input[0] with args in input[1:]. Depending on the command, clientcfg is manipulated or used to create a new client for get and put command.
func RunInteractive ¶
RunInteractive starts the internal interactive command loop, where the user provides input to control the application.
func ValidateMode ¶
func ValidateMode(mode string) (tftp.TransferMode, error)
ValidateMode takes a the modes string 'ascii' or 'binary' and returns the valid tftp.TransferMode or error.
Types ¶
type Client ¶
Client implements the ClientIf and uses the tftp.Client as member to interact with the real library.
type ClientCfg ¶
type ClientCfg struct {
Host string
Port string
Client ClientIf
Mode tftp.TransferMode
Rexmt tftp.ClientOpt
Timeout tftp.ClientOpt
}
ClientCfg holds all configuration values of a client.
type ClientIf ¶
ClientIf serves as interface which allows mocking of tftp.Client for testing and usage of the real implementation, depending on the use-case.
type Flags ¶
Flags provides the flags used in ./cmds/core/tftp. For more details, see the main-function in ./cmds/core/tftp/main.go.
type RealResponse ¶
RealResponse implements the Response interface and uses the tftp.Response as member to interact with the real library.
func (*RealResponse) Read ¶
func (r *RealResponse) Read(b []byte) (int, error)
Read provides the Read function of tftp.Response.
func (*RealResponse) Size ¶
func (r *RealResponse) Size() (int64, error)
Size provides the Size function of tftp.Response.