14 releases

0.4.2 Dec 2, 2025
0.4.1 Oct 26, 2025
0.3.6 Dec 16, 2022
0.3.5 Jan 28, 2021
0.1.3 Nov 20, 2019

#392 in Network programming

Download history 907/week @ 2025-09-16 860/week @ 2025-09-23 1177/week @ 2025-09-30 766/week @ 2025-10-07 999/week @ 2025-10-14 904/week @ 2025-10-21 812/week @ 2025-10-28 1262/week @ 2025-11-04 1345/week @ 2025-11-11 1006/week @ 2025-11-18 860/week @ 2025-11-25 1612/week @ 2025-12-02 1160/week @ 2025-12-09 1256/week @ 2025-12-16 574/week @ 2025-12-23 574/week @ 2025-12-30

3,674 downloads per month
Used in 2 crates

MIT license

75KB
2K SLoC

async-tftp

license crates.io docs

Executor agnostic async TFTP implementation, written with smol building blocks. Currently it implements only server side.

The following RFCs are implemented:

  • RFC 1350 - The TFTP Protocol (Revision 2).
  • RFC 2347 - TFTP Option Extension.
  • RFC 2348 - TFTP Blocksize Option.
  • RFC 2349 - TFTP Timeout Interval and Transfer Size Options.
  • RFC 7440 - TFTP Windowsize Option.

Features:

  • Async implementation.
  • Works with any runtime/executor.
  • Serve read (RRQ) and write (WRQ) requests.
  • Unlimited transfer file size (block number roll-over).
  • You can set non-standard reply timeout. This is useful for faster file transfer in unstable environments.
  • You can set block size limit. This is useful if you are accessing client through a VPN.
  • You can implement your own Handler for more advance cases than just serving a directory. Check tftpd-targz.rs for an example.

Example

use async_tftp::server::TftpServerBuilder;
use async_tftp::Result;

#[tokio::main] // or any other runtime/executor
async fn main() -> Result<()> {
    let tftpd = TftpServerBuilder::with_dir_ro(".")?.build().await?;
    tftpd.serve().await?;
    Ok(())
}

Add in Cargo.toml:

[dependencies]
async-tftp = "0.4"
# or any other runtime/executor
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }

Running examples with cargo

There are some examples included with this crate. You can run them from a source checkout with cargo:

$ cargo run --example tftpd-dir
TFTP directory: ...
Listening on: 0.0.0.0:6969
^C

$ cargo run --example tftpd-targz <archive-path>
Listening on: 0.0.0.0:6969
^C

License

MIT

Dependencies

~3.5–8.5MB
~178K SLoC