Expand description
libunftp is an extensible, async, cloud orientated FTP(S) server library.
Because of its plug-able authentication (e.g. 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. Then also choose a storage back-end implementation to add. Here we choose the file system back-end:
[dependencies]
libunftp = "0.23.0"
unftp-sbe-fs = "0.4.0"
tokio = { version = "1", features = ["full"] }Now you’re ready to develop your server! Add the following to src/main.rs:
use libunftp::ServerBuilder;
use unftp_sbe_fs::Filesystem;
#[tokio::main]
pub async fn main() {
let ftp_home = std::env::temp_dir();
let server = ServerBuilder::new(Box::new(move || Filesystem::new(ftp_home.clone()).unwrap()))
.greeting("Welcome to my FTP server")
.passive_ports(50000..=65535)
.build()
.unwrap();
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 localhostModules§
- auth
- Authentication helpers and built-in implementations.
- notification
- Allows users to listen to events emitted by libunftp.
- options
- Contains code pertaining to the setup options that can be given to the
ServerBuilder - storage
- Re-exports storage traits/types from unftp-core.
Structs§
- Server
- An instance of an FTP(S) server. It aggregates an
Authenticatorimplementation that will be used for authentication, and aStorageBackendimplementation that will be used as the virtual file system. - Server
Builder - Used to create
Servers. - Server
Error - Error returned by the
Server.listenmethod