Help us shape the future of Go! Take the 2026 Go Developer Survey

ftpx

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClose = errors.New("connection closed")
)

Functions

func SessionHandler

func SessionHandler(msg Msg, log *slog.Logger, onClose OnCloseFunc) netx.Handler

SessionHandler handles an FTP session; it must be wrapped with netx.LoggingHandler.

Types

type Data

type Data struct {
	User string `structs:"user"`
	Pass string `structs:"pass"`

	Type string `structs:"type"`

	Pasv string `structs:"pasv"`
	Epsv string `structs:"epsv"`

	Port string `structs:"port"`
	Eprt string `structs:"eprt"`

	Retr string `structs:"retr"`
}

Data stores args passed to the corresponding FTP commands.

type Meta

type Meta struct {
	Session Data `json:"session"`
}

Meta contains FTP-specific event metadata.

type Msg

type Msg struct {
	// Greet is server greet message.
	Greet string
}

Msg is used to store provided command responses.

type OnCloseFunc

type OnCloseFunc func(
	ctx context.Context,
	remoteAddr net.Addr,
	receivedAt *time.Time,
	secure bool,
	data [][]byte,
	match []byte,
	meta *Meta,
)

type Option

type Option func(*options)

func WithNotifyStarted added in v1.26.0

func WithNotifyStarted(f func()) Option

WithNotifyStarted sets a function called once the server is listening.

func WithTLSConfig added in v1.26.0

func WithTLSConfig(c *tls.Config) Option

WithTLSConfig makes the server accept TLS connections.

type Server

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

func New

func New(addr string, handler netx.Handler, opts ...Option) *Server

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

Jump to

Keyboard shortcuts

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