ftpx

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Jun 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

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,
	read []byte,
	written []byte,
	combined []byte,
	meta *Meta,
)

type Option

type Option func(*options)

func ListenerWrapper

func ListenerWrapper(f func(net.Listener) net.Listener) Option

func NotifyStartedFunc

func NotifyStartedFunc(f func()) Option

func TLSConfig

func TLSConfig(c *tls.Config) Option

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