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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//! WebTransport protocol implementation in *pure* Rust, *async-friendly*, and *API-simple*.
//!
//! For a quick start with this library, refer to [`Endpoint`].
//!
//! ## About WebTransport
//! WebTransport is a modern protocol built on [QUIC](https://en.wikipedia.org/wiki/QUIC)
//! and [HTTP/3](https://en.wikipedia.org/wiki/HTTP/3), providing an alternative to
//! HTTP and WebSocket.
//!
//! It's designed for efficient client-server communication with *low latency* and
//! bi-directional *multistream* data exchange capabilities, making it suitable for a wide range of
//! applications.
//!
//! WebTransport guarantees *secure* and *reliable* communication by leveraging encryption
//! and authentication to protect your data during transmission.
//!
//! WebTransport offers two key communication channels: *streams* and *datagrams*.
//!
//! ### Streams
//! WebTransport streams are communication channels that provide *ordered* and
//! *reliable* data transfer.
//!
//! WebTransport streams allow sending multiple sets of data at once within a single session.
//! Each stream operates independently, ensuring that the order and reliability
//! of one stream do not affect the others.
//!
//! Streams can be: *uni-directional* or *bi-directional*.
//!
//! *Order Preserved, Guaranteed Delivery, Flow-Controlled, Secure (All Traffic Encrypted),
//! and Multiple Independent Streams*.
//!
//! ## Datagrams
//! WebTransport datagrams are lightweight and *unordered* communication channels,
//! prioritizing quick data exchange without guarantees of reliability or sequence.
//!
//! *Unordered, No Guaranteed Delivery, No Flow-Controlled, Secure (All Traffic Encrypted),
//! Independent Messages*.
//!
//!
//! # Examples
//! Explore operational server and client examples below. The elegantly simple yet potent
//! API empowers you to get started with minimal code.
//!
//! ## Server
//! ```no_run
//! # use anyhow::Result;
//! use wtransport::Endpoint;
//! use wtransport::Identity;
//! use wtransport::ServerConfig;
//!
//! #[tokio::main]
//! async fn main() -> Result<()> {
//! let config = ServerConfig::builder()
//! .with_bind_default(4433)
//! .with_identity(Identity::load_pemfiles("cert.pem", "key.pem").await?)
//! .build();
//!
//! let server = Endpoint::server(config)?;
//!
//! loop {
//! let incoming_session = server.accept().await;
//! let incoming_request = incoming_session.await?;
//! let connection = incoming_request.accept().await?;
//! // ...
//! }
//! }
//! ```
//! See [repository server example](https://github.com/BiagioFesta/wtransport/blob/master/wtransport/examples/server.rs)
//! for the complete code.
//!
//! ## Client
//! ```no_run
//! # use anyhow::Result;
//! use wtransport::ClientConfig;
//! use wtransport::Endpoint;
//!
//! #[tokio::main]
//! async fn main() -> Result<()> {
//! let connection = Endpoint::client(ClientConfig::default())?
//! .connect("https://localhost:4433")
//! .await?;
//! // ...
//! # Ok(())
//! }
//! ```
//! See [repository client example](https://github.com/BiagioFesta/wtransport/blob/master/wtransport/examples/client.rs)
//! for the complete code.
/// Client and server configurations.
/// WebTransport connection.
/// Endpoint module.
/// Errors definitions module.
/// Interfaces for sending and receiving data.
/// TLS specific configurations.
/// Datagrams module.
pub use ClientConfig;
pub use ServerConfig;
pub use Identity;
pub use Endpoint;
pub use Connection;
pub use RecvStream;
pub use SendStream;
pub use VarInt;
pub use StreamId;
pub use SessionId;
pub use wtransport_proto as proto;
pub use quinn;