[][src]Crate libunftp

libunftp is an extensible, async, cloud orientated FTP(S) server library.

Because of its plug-able authentication (PAM, JSON File, Generic REST) and storage backends (e.g. local filesystem, Google Cloud Storage) it's more flexible than traditional FTP servers and a perfect match for the cloud.

It runs on top of the Tokio asynchronous run-time and tries to make use of Async IO as much as possible.

Quick Start

Add the libunftp and tokio crates to your project's dependencies in Cargo.toml

[dependencies]
libunftp = "0.14.0"
tokio = { version = "0.3", features = ["full"] }

Now you're ready to develop your server! Add the following to src/main.rs:

#[tokio::main]
pub async fn main() {
    let ftp_home = std::env::temp_dir();
    let server = libunftp::Server::with_fs(ftp_home)
        .greeting("Welcome to my FTP server")
        .passive_ports(50000..65535);

    server.listen("127.0.0.1:2121").await;
}

You can now run your server with cargo run and connect to localhost:2121 with your favourite FTP client e.g.:

lftp -p 2121 localhost

Modules

auth

Contains the Authenticator and UserDetails traits that are used by various implementations and also the Server to authenticate users.

options

Contains code pertaining to the setup options that can be given to the Server

storage

Contains the StorageBackend trait and its bundled implementations that can used by the Server.

Structs

Server

An instance of an FTP(S) server. It aggregates an Authenticator that will be used for authentication, and a StorageBackend that will be used as the virtual file system.

ServerError

Error returned by the Server.listen method