async_tftp/
lib.rs

1//! Executor agnostic async TFTP implementation, written with [smol]
2//! building blocks. Currently it implements only server side.
3//!
4//! The following RFCs are implemented:
5//!
6//! * [RFC 1350] - The TFTP Protocol (Revision 2).
7//! * [RFC 2347] - TFTP Option Extension.
8//! * [RFC 2348] - TFTP Blocksize Option.
9//! * [RFC 2349] - TFTP Timeout Interval and Transfer Size Options.
10//!
11//! Features:
12//!
13//! * Async implementation.
14//! * Works with any runtime/executor.
15//! * Serve read (RRQ) and write (WRQ) requests.
16//! * Unlimited transfer file size (block number roll-over).
17//! * You can set non-standard reply [`timeout`]. This is useful for faster
18//!   file transfer in unstable environments.
19//! * You can set [block size limit]. This is useful if you are accessing
20//!   client through a VPN.
21//! * You can implement your own [`Handler`] for more advance cases than
22//!   just serving a directory. Check [`tftpd-targz.rs`] for an example.
23//!
24//! # Example
25//!
26//! ```ignore
27//! use async_tftp::server::TftpServerBuilder;
28//! use async_tftp::Result;
29//!
30//! fn main() -> Result<()> {
31//!     smol::block_on(async { // or any other runtime/executor
32//!         let tftpd = TftpServerBuilder::with_dir_ro(".")?.build().await?;
33//!         tftpd.serve().await?;
34//!         Ok(())
35//!     })
36//! }
37//! ```
38//!
39//! Add in `Cargo.toml`:
40//!
41//! ```toml
42//! [dependencies]
43//! smol = "1" # or any other runtime/executor
44//! async-tftp = "0.3"
45//! ```
46//!
47//! [smol]: https://docs.rs/smol
48//!
49//! [`timeout`]: server::TftpServerBuilder::timeout
50//! [block size limit]: server::TftpServerBuilder::block_size_limit
51//! [`Handler`]: server::Handler
52//! [`tftpd-targz.rs`]: https://github.com/oblique/async-tftp-rs/blob/master/examples/tftpd-targz.rs
53//!
54//! [RFC 1350]: https://tools.ietf.org/html/rfc1350
55//! [RFC 2347]: https://tools.ietf.org/html/rfc2347
56//! [RFC 2348]: https://tools.ietf.org/html/rfc2348
57//! [RFC 2349]: https://tools.ietf.org/html/rfc2349
58
59pub mod server;
60
61/// Packet definitions that are needed in public API.
62pub mod packet;
63
64mod error;
65mod parse;
66mod tests;
67mod utils;
68
69pub use crate::error::*;
70
71/// Re-export of `async_trait:async_trait`.
72pub use async_trait::async_trait;