1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! # Hayate (はやて)
//!
//! A completion-based I/O engine for direct, encrypted, and compressed LAN transfers.
//!
//! Driven by the `compio` thread-per-core asynchronous runtime, Hayate uses QUIC
//! (via `compio-quic` and `quinn-proto`) to saturate local network links while securing
//! data with ephemeral Diffie-Hellman key exchanges (Curve25519) and symmetric AEAD
//! encryption (ChaCha20-Poly1305 or AES-256-GCM).
//!
//! This crate can be used standalone to transfer files or directories programmatically
//! using the high-level builder runners in the [`runner`] module.
//!
//! ## Standalone Usage Examples
//!
//! ### Sender Example
//! ```no_run
//! use std::net::SocketAddr;
//! use hayate::runner::HayateSender;
//!
//! # async fn run() -> Result<(), hayate::EngineError> {
//! let target: SocketAddr = "192.168.1.50:50001".parse().unwrap();
//! let sender = HayateSender::new()
//! .target(target)
//! .compress(true);
//!
//! sender.send("my_photo.jpg", |bytes_sent| {
//! println!("Progress: {bytes_sent} bytes transferred");
//! }).await?;
//! # Ok(())
//! # }
//! ```
//!
//! ### Receiver Example
//! ```no_run
//! use std::net::SocketAddr;
//! use hayate::runner::HayateReceiver;
//!
//! # async fn run() -> Result<(), hayate::EngineError> {
//! let bind_addr: SocketAddr = "0.0.0.0:50001".parse().unwrap();
//! let receiver = HayateReceiver::new()
//! .bind(bind_addr)
//! .auto_accept(true);
//!
//! let (checksum, path) = receiver.receive("./downloads", |meta| {
//! println!("Receiving {}...", meta.filename);
//! true
//! }, |bytes_received| {
//! println!("Progress: {bytes_received} bytes received");
//! }).await?;
//! # Ok(())
//! # }
//! ```
pub use EngineError;
pub use ;