ftp

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: BSD-3-Clause Imports: 7 Imported by: 0

README

tiny-ftp-go

Simple Go implementation of FTP client.

Limitation
  • Local file operations are unavailable
  • Only supported passive mode
Download

See Releases page.

Import as library
go get github.com/mikan/tiny-ftp-go
Usage
tiny-ftp -h <HOST> -u <USER> -p <PASS>

All parameters and default values:

Arg Default value Description
-h localhost server hostname or IP address
-P 21 server TCP port number
-u anonymous username
-p anonymous@example.com password
-d false print debug log

Some user-friendly commands are supported and automatically convert to actual FTP command. Supported commands:

User-friendly command FTP command
cd CWD
ls NLST
dir LIST
cat RETR
rm DELE
pwd PWD

License

BSD 3-Clause

Contact

Documentation

Index

Constants

View Source
const (
	StatusCommandOK              = 200
	StatusServiceReadyForNewUser = 220
	StatusEnteringPassiveMode    = 227
	StatusUserLoggedIn           = 230
	StatusNeedPassword           = 331
)

Status defines FTP status code.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents an FTP client.

func NewClient

func NewClient(host string, port int) (*Client, error)

NewClient constructs a new FTP client.

func (*Client) Close

func (c *Client) Close()

Close closes FTP control connection.

func (*Client) Cmd

func (c *Client) Cmd(text string) (code int, msg string, err error)

Cmd executes a FTP command.

func (*Client) DataCmd

func (c *Client) DataCmd(text string) (string, error)

DataCmd executes a FTP command using data connection.

func (*Client) Login

func (c *Client) Login(user, password string) error

Login logins to the FTP server.

func (*Client) SetLogger

func (c *Client) SetLogger(logger *log.Logger)

SetLogger updates logger. Default is discard.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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