ActiveConnectionsCheck defines the security requirements for active connectionsĪctiveConnectionsCheck DataConnectionRequirement TLSRequired TLSRequirement // defines the TLS modeĭisableLISTArgs bool // Disable ls like options (-a,-la etc.) for directory listingĭisableActiveMode bool // Disable Active FTPĮnableHASH bool // Enable support for calculating hash value of filesĭisableSTAT bool // Disable Server STATUS, STAT on files and directories will still workĭefaultTransferType TransferType // Transfer type to use if the client don't send the TYPE command IdleTimeout int // Maximum inactivity time before disconnecting (#58)ĬonnectionTimeout int // Maximum time to establish passive or active transfer connectionsĭisableMFMT bool // Disable MFMT support (modify file mtime)īanner string // Banner to use in server status response Random if not specifiedĪctiveTransferPortNon20 bool // Do not impose the port 20 for active data transfer (#88, RFC 1579) PassiveTransferPortRange *PortRange // (Optional) Port Range for data connections. PublicIPResolver PublicIPResolver // (Optional) To fetch a public IP lookup PublicHost string // Public IP to expose (only an IP address is accepted at this stage) Listener net.Listener // (Optional) To provide an already initialized listener Settings define all the server settings GetLastDataChannel returns the last data channel mode GetLastCommand returns the last received command HasTLSForTransfers returns true if the transfer connection is over TLS HasTLSForControl returns true if the control connection is over TLS Close closes the connection and disconnects the client. Debug returns the current debugging status of this connection commands SetDebug activates the debugging of this connection commands Path provides the path of the current connection ClientContext is implemented on the server side to provide some access to few data around the client ClientDriver is the base FS implementation that allows to manipulate files The certificate could frequently change if we use something like "let's encrypt" GetTLSConfig returns a TLS Certificate to use AuthUser authenticates the user and selects an handling driverĪuthUser(cc ClientContext, user, pass string) (ClientDriver, error) ClientDisconnected is called when the user disconnects, even if he never authenticated ClientConnected is called to send the very first welcome messageĬlientConnected(cc ClientContext) (string, error) GetSettings returns some general settings around the server setup MainDriver handles the authentication and ClientHandlingDriver selection The simplest way to get a good understanding of how the driver shall be implemented, you can have a look at the tests driver. The easiest way to test this library is to use ftpserver. MLSD - Directory listing for machine processing.MLST - Simple file listing for machine processing.fclairamb/go-log for logging through your existing libraries go-kit/log, log15, zap, zerolog, logrus.afero for generic file systems handling.Uses only the standard library except for:.Clean code: No sleep, no panic, no global sync (only around control/transfer connection per client).Active socket connections (PORT and EPRT commands).Passive socket connections (PASV and EPSV commands).File download/upload resume support (REST).File and directory deletion and renaming.If you're interested in a fully featured FTP server, you should use sftpgo (fully featured SFTP/FTP server) or ftpserver (basic FTP server). This library allows to easily build a simple and fully-featured FTP server using afero as the backend filesystem.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |