34 releases (17 breaking)

0.18.0 Jul 13, 2021
0.17.2 Apr 25, 2021
0.17.0 Mar 26, 2021
0.14.1 Dec 12, 2020
0.5.0 Nov 15, 2019

#37 in Network programming

Download history 47/week @ 2021-05-29 85/week @ 2021-06-05 46/week @ 2021-06-12 26/week @ 2021-06-19 42/week @ 2021-06-26 48/week @ 2021-07-03 66/week @ 2021-07-10 75/week @ 2021-07-17 48/week @ 2021-07-24 173/week @ 2021-07-31 103/week @ 2021-08-07 79/week @ 2021-08-14 43/week @ 2021-08-21 18/week @ 2021-08-28 42/week @ 2021-09-04 84/week @ 2021-09-11

265 downloads per month
Used in less than 10 crates

Apache-2.0

285KB
6K SLoC

libunftp

Crate Version API Docs Build Status Crate License Follow on Telegram

When you need to FTP, but don't want to.

logo

The libunftp library drives unFTP. It's an extensible, async, cloud orientated FTP(S) server implementation in Rust brought to you by the bol.com techlab.

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.

Feature highlights:

  • 39 Supported FTP commands (see commands directory) and growing
  • Ability to implement own storage back-ends
  • Ability to implement own authentication back-ends
  • Explicit FTPS (TLS)
  • Mutual TLS (Client certificates)
  • TLS session resumption
  • Prometheus integration
  • Structured Logging
  • Proxy Protocol support
  • Automatic session timeouts
  • Per user IP allow lists

Known storage back-ends:

Known authentication back-ends:

Prerequisites

You'll need Rust 1.41 or higher to build libunftp.

Getting started

If you've got Rust and cargo installed, create your project with

cargo new myftp

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.17.4"
unftp-sbe-fs = "0.1"
tokio = { version = "1", features = ["full"] }

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

use unftp_sbe_fs::ServerExt;

#[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

For more help refer to:

Getting help and staying informed

Support is given on a best effort basis. You are welcome to engage us on the discussions page or create a Github issue.

You can also follow news and talk to us on Telegram

Contributing

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 develop your own storage or authentication back-end? Then head over to our contribution guide (CONTRIBUTING.md).

License

You're free to use, modify and distribute this software under the terms of the Apache License v2.0.

Dependencies

~19MB
~415K SLoC