ftp

package
v0.0.0-...-cf2fa2e Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const IPResolveURL = "https://ipinfo.io/ip"

Variables

View Source
var (
	ErrNoTLS                 = errors.New("TLS is not configured")    // Error for missing TLS configuration
	ErrBadUserNameOrPassword = errors.New("bad username or password") // Error for failed authentication
)

Define custom error messages

Functions

func Serv

func Serv(drvr *ddrv.Driver, cfg *Config) error

Types

type Config

type Config struct {
	Addr       string `mapstructure:"addr"`
	Username   string `mapstructure:"username"`
	Password   string `mapstructure:"password"`
	PortRange  string `mapstructure:"port_range"`
	AsyncWrite bool   `mapstructure:"async_write"`
}

type Driver

type Driver struct {
	Fs       afero.Fs            // The file system to serve over FTP
	Debug    bool                // Debug mode flag
	Settings *ftpserver.Settings // The FTP server settings
	// contains filtered or unexported fields
}

Driver is the FTP server driver implementation.

func (*Driver) AuthUser

func (d *Driver) AuthUser(cc ftpserver.ClientContext, user, pass string) (ftpserver.ClientDriver, error)

AuthUser authenticates a user during the FTP server login process.

func (*Driver) ClientConnected

func (d *Driver) ClientConnected(cc ftpserver.ClientContext) (string, error)

ClientConnected is called when a client is connected to the FTP server.

func (*Driver) ClientDisconnected

func (d *Driver) ClientDisconnected(cc ftpserver.ClientContext)

ClientDisconnected is called when a client is disconnected from the FTP server.

func (*Driver) GetSettings

func (d *Driver) GetSettings() (*ftpserver.Settings, error)

GetSettings returns the FTP server settings.

func (*Driver) GetTLSConfig

func (d *Driver) GetTLSConfig() (*tls.Config, error)

GetTLSConfig returns the TLS configuration for the FTP server.

Jump to

Keyboard shortcuts

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