The libunftp library is a safe, fast and extensible FTP server implementation in Rust brought to you by the bol.com techlab.
Because of its plugable authentication 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 so tries to make use of Async IO as much as possible.
libunftp is currently under heavy development and not yet recommended for production use. The API MAY BREAK
You'll need Rust 1.31 or higher to build libunftp. There are no runtime dependencies besides the OS and libc.
If you've got Rust and cargo installed, create your project with
sh
cargo new my_project
Then add the libunftp, tokio & futures crates to your project's dependencies in Cargo.toml
:
toml
[dependencies]
libunftp = "0.2"
tokio = "0.1"
futures = "0.1"
Now you're ready to develop your server!
Add the following to src/main.rs
:
```rust use futures::future::Future; use tokio::runtime::Runtime;
fn main() { let ftphome = std::env::tempdir(); let server = libunftp::Server::withroot(ftphome) .greeting("Welcome to my FTP server") .passive_ports(50000..65535);
let bind_addr = "127.0.0.1:2121";
let mut runtime = Runtime::new().unwrap();
runtime.spawn(server.listener(&bind_addr));
runtime.shutdown_on_idle().wait().unwrap();
} ```
You can now run your server with cargo run
and connect to localhost:2121
with your favourite FTP client e.g.:
sh
lftp -p 2121 localhost
For more help refer to:
First of all, thank you for your interest in contributing to libunftp! Please feel free to create a github issue if you encounter any problems, want to submit a feature request, or just feel like it :)
Run make help
in the root of this repository to see the available make commands.
You're free to use, modify and distribute this software under the terms of the Apache-2.0 license.