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//! * [RFC 7440] - TFTP Windowsize Option.
11//!
12//! Features:
13//!
14//! * Async implementation.
15//! * Works with any runtime/executor.
16//! * Serve read (RRQ) and write (WRQ) requests.
17//! * Unlimited transfer file size (block number roll-over).
18//! * You can set non-standard reply [`timeout`]. This is useful for faster
19//!   file transfer in unstable environments.
20//! * You can set [block size limit]. This is useful if you are accessing
21//!   client through a VPN.
22//! * You can implement your own [`Handler`] for more advance cases than
23//!   just serving a directory. Check [`tftpd-targz.rs`] for an example.
24//!
25//! # Example
26//!
27//! ```ignore
28//! use async_tftp::server::TftpServerBuilder;
29//! use async_tftp::Result;
30//!
31//! #[tokio::main] // or any other runtime/executor
32//! async fn main() -> Result<()> {
33//!     let tftpd = TftpServerBuilder::with_dir_ro(".")?.build().await?;
34//!     tftpd.serve().await?;
35//!     Ok(())
36//! }
37//! ```
38//!
39//! Add in `Cargo.toml`:
40//!
41//! ```toml
42//! [dependencies]
43//! async-tftp = "0.4"
44//! # or any other runtime/executor
45//! tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
46//! ```
47//!
48//! [smol]: https://docs.rs/smol
49//!
50//! [`timeout`]: server::TftpServerBuilder::timeout
51//! [block size limit]: server::TftpServerBuilder::block_size_limit
52//! [`Handler`]: server::Handler
53//! [`tftpd-targz.rs`]: https://github.com/oblique/async-tftp-rs/blob/master/examples/tftpd-targz.rs
54//!
55//! [RFC 1350]: https://tools.ietf.org/html/rfc1350
56//! [RFC 2347]: https://tools.ietf.org/html/rfc2347
57//! [RFC 2348]: https://tools.ietf.org/html/rfc2348
58//! [RFC 2349]: https://tools.ietf.org/html/rfc2349
59//! [RFC 7440]: https://tools.ietf.org/html/rfc7440
60
61pub mod server;
62
63/// Packet definitions that are needed in public API.
64pub mod packet;
65
66mod error;
67mod parse;
68mod tests;
69mod utils;
70
71pub use crate::error::*;