server

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 13 Imported by: 0

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

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

type Server

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

Server structure

func NewServer

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

NewServer creates a server instance

func (*Server) AuthUser

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

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

ClientConnected is called to send the very first welcome message

func (*Server) ClientDisconnected

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

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

func (*Server) GetSettings

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

GetSettings returns some general settings around the server setup

func (*Server) GetTLSConfig

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) Stop

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

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