package module
v0.0.0-...-98f8d24 Latest Latest

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

Go to latest
Published: Sep 23, 2020 License: Apache-2.0 Imports: 15 Imported by: 0



Full-feature FTP/FTP over TLS server in pure Go (work in progress)




View Source
const (
	DataASCII = iota
	DataEBCDIC // Not supported

Data transfer types

View Source
const (
	DataStream     = iota
	DataBlock      // Not supported
	DataCompressed // Not supported
View Source
const (
	DataConnActive = iota // Not supported


View Source
var Features = []byte(" UTF8\r\n MDTM\r\n SIZE\r\n TVFS\r\n MLST type;size;modify;\r\n")
View Source
var ReplyCodes = map[int][]byte{
	200: []byte("Command okay."),
	500: []byte("Syntax error, command unrecognized."),
	501: []byte("Syntax error in parameters or arguments."),
	202: []byte("Command not implemented, superfluous at this site."),
	502: []byte("Command not implemented."),
	503: []byte("Bad sequence of commands."),
	504: []byte("Command not implemented for that parameter."),

	110: []byte("%s = %s"),
	211: []byte("%s"),
	212: []byte("%s"),
	213: []byte("%s"),
	214: []byte("(Sorry, no help available)"),
	215: []byte("%s"),

	120: []byte("Service ready in %d minutes."),
	220: []byte("Service ready."),
	221: []byte("Service closing control connection."),
	421: []byte("Service not available, closing control connection."),

	125: []byte("Data connection already open; transfer starting."),
	225: []byte("Data connection open; no transfer in progress."),
	425: []byte("Can't open data connection."),
	226: []byte("Closing data connection."),
	426: []byte("Connection closed; transfer aborted."),

	227: []byte("Entering Passive Mode (%s)."),

	230: []byte("User logged in, proceed."),
	530: []byte("Not logged in."),
	331: []byte("User name okay, need password."),
	332: []byte("Need account for login."),
	532: []byte("Need account for storing files."),

	150: []byte("File status okay; about to open data connection."),
	250: []byte("Requested file action okay, completed."),
	257: []byte("\"%s\" created."),
	350: []byte("Requested file action pending further information."),
	450: []byte("Requested file action not taken."),
	550: []byte("Requested action not taken."),
	451: []byte("Requested action aborted. Local error in processing."),
	551: []byte("Requested action aborted. Page type unknown."),
	452: []byte("Requested action not taken."),
	552: []byte("Requested file action aborted."),
	553: []byte("Requested action not taken."),


func ScanCRLF

func ScanCRLF(data []byte, atEOF bool) (advance int, token []byte, err error)

ScanCRLF is a bufio.ScanFunc that stops at any CRLF line feed ("\r\n").


type Server

type Server struct {
	// Port is the (control) listening port, defaults to 21.
	Port int
	// Listen address for control connections, defaults to "" which listens on
	// all IPv4/IPv6 addresses.
	Address string

	// Minimum and maximum data listening port for passive mode.
	// Defaults to 63700-63899.
	MinDataPort, MaxDataPort int
	// Listen address for data connections in passive mode, defaults to "".
	DataAddress string

	// Root filesystem node. Should not be changed after server start.
	Node mount.Node

	// Simple authenticator. If nil, it defaults to auth.Anonymous.
	Auth auth.Auth

	// Timeout for a passive data connection to wait for. If nil, it defaults
	// to 3s.
	DataConnTimeout time.Duration
	// contains filtered or unexported fields

Server is a FTP Protocol server.

func (*Server) Start

func (s *Server) Start() error

Start starts a FTP server.

func (*Server) Stop

func (s *Server) Stop()


Path Synopsis
Package auth provides basic system-wide authentication for ftpd.
Package auth provides basic system-wide authentication for ftpd.

Jump to

Keyboard shortcuts

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