server

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 18 Imported by: 32

Documentation

Overview

Package server contains the core FTP server code

Index

Constants

This section is empty.

Variables

View Source
var ErrNotEnabled = errors.New("not enabled")

ErrNotEnabled is returned when a feature hasn't been enabled

View Source
var ErrTimeout = errors.New("timeout")

ErrTimeout is returned when an operation timeouts

Functions

This section is empty.

Types

type ClientDriver added in v0.7.0

type ClientDriver struct {
	afero.Fs
}

The ClientDriver is the internal structure used for handling the client. At this stage it's limited to the afero.Fs

func (d *ClientDriver) Symlink(oldname, newname string) error

Symlink creates a symbolic link. It implements ftpserverlib's ClientDriverExtensionSymlink interface (the "SITE SYMLINK" command), delegating to the underlying filesystem when it supports symlinks (the local OS backend does). Backends that can't create symlinks return an *os.LinkError wrapping afero.ErrNoSymlink. See #980.

type Server added in v0.7.0

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

Server structure

func NewServer added in v0.7.0

func NewServer(config *config.Config, logger *slog.Logger) (*Server, error)

NewServer creates a server instance

func (*Server) AuthUser added in v0.7.0

func (s *Server) AuthUser(cc serverlib.ClientContext, user, pass string) (serverlib.ClientDriver, error)

AuthUser authenticates the user and selects an handling driver

func (*Server) ClientConnected added in v0.7.0

func (s *Server) ClientConnected(cc serverlib.ClientContext) (string, error)

ClientConnected is called to send the very first welcome message

func (*Server) ClientDisconnected added in v0.7.0

func (s *Server) ClientDisconnected(cc serverlib.ClientContext)

ClientDisconnected is called when the user disconnects, even if he never authenticated

func (*Server) GetSettings added in v0.7.0

func (s *Server) GetSettings() (*serverlib.Settings, error)

GetSettings returns some general settings around the server setup

func (*Server) GetTLSConfig added in v0.7.0

func (s *Server) GetTLSConfig() (*tls.Config, error)

GetTLSConfig returns a TLS Certificate to use The certificate could frequently change if we use something like "let's encrypt"

func (*Server) ReloadConfig added in v0.15.0

func (s *Server) ReloadConfig() error

func (*Server) Stop added in v0.7.0

func (s *Server) Stop()

Stop will trigger a graceful stop of the server. All currently connected clients won't be disconnected instantly.

func (*Server) WaitGracefully added in v0.7.0

func (s *Server) WaitGracefully(timeout time.Duration) error

WaitGracefully allows to gracefully wait for all currently connected clients before disconnecting

Jump to

Keyboard shortcuts

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