ftp

package
v0.0.0-...-c4986e2 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Conn net.Conn
	User string
	Path string
	Auth bool
	Clnt string
	Quit chan bool
	Text chan string
	Port string
}

Handler represents FTP commands handler for client connection.

func NewHandler

func NewHandler(conn net.Conn, path string) *Handler

NewHandler returns initialized FTP commands handler for client.

func (*Handler) HandleCWD

func (h *Handler) HandleCWD(args []string)

HandleCWD changes current working directory.

func (*Handler) HandleLIST

func (h *Handler) HandleLIST(args []string)

HandleLIST lists current working directory.

func (*Handler) HandlePASS

func (h *Handler) HandlePASS(args []string)

HandlePASS checks that password is valid for provided user.

func (*Handler) HandlePORT

func (h *Handler) HandlePORT(args []string)

HandlePORT parses provided remote address for connection.

func (*Handler) HandlePWD

func (h *Handler) HandlePWD(args []string)

HandlePWD provides current working directory.

func (*Handler) HandleQUIT

func (h *Handler) HandleQUIT(args []string)

HandleQUIT close user connection.

func (*Handler) HandleRETR

func (h *Handler) HandleRETR(args []string)

HandleRETR transfers file to client.

func (*Handler) HandleUSER

func (h *Handler) HandleUSER(args []string)

HandleUSER checks that use exists

func (*Handler) Serve

func (h *Handler) Serve()

Serve gets and executes client commands.

func (*Handler) WriteLine

func (h *Handler) WriteLine(text string)

WriteLine sends provided text terminated with CR+LF.

func (*Handler) WriteMessage

func (h *Handler) WriteMessage(code int, format string, args ...interface{})

WriteMessage creates FTP message with required code and text.

type Server

type Server struct {
	Addr string
	Path string
}

Server represents FTP server with method Run.

func NewServer

func NewServer(address, path string) *Server

NewServer returns an instance of Server.

func (*Server) Run

func (s *Server) Run()

Run starts server and awaits for clients.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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