rama_tls_rustls/lib.rs
1//! TLS implementations for Rama using rustls.
2//!
3//! # Rama
4//!
5//! Crate used by the end-user `rama` crate and `rama` crate authors alike.
6//!
7//! Learn more about `rama`:
8//!
9//! - Github: <https://github.com/plabayo/rama>
10//! - Book: <https://ramaproxy.org/book/>
11
12#![doc(
13 html_favicon_url = "https://raw.githubusercontent.com/plabayo/rama/main/docs/img/old_logo.png"
14)]
15#![doc(html_logo_url = "https://raw.githubusercontent.com/plabayo/rama/main/docs/img/old_logo.png")]
16#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg))]
17#![cfg_attr(test, allow(clippy::float_cmp))]
18#![cfg_attr(not(test), warn(clippy::print_stdout, clippy::dbg_macro))]
19
20pub mod client;
21pub mod server;
22pub mod verify;
23
24pub mod key_log;
25
26mod type_conversion;
27
28use rama_utils::macros::enums::rama_from_into_traits;
29rama_from_into_traits!();
30
31pub mod types {
32 //! common tls types
33 #[doc(inline)]
34 pub use ::rama_net::tls::{
35 ApplicationProtocol, CipherSuite, CompressionAlgorithm, ECPointFormat, ExtensionId,
36 ProtocolVersion, SecureTransport, SignatureScheme, SupportedGroup, TlsTunnel, client,
37 };
38}
39
40pub mod dep {
41 //! Dependencies for rama rustls modules.
42 //!
43 //! Exported for your convenience.
44
45 pub mod pki_types {
46 //! Re-export of the [`pki-types`] crate.
47 //!
48 //! [`pki-types`]: https://docs.rs/rustls-pki-types
49
50 #[doc(inline)]
51 pub use rustls_pki_types::*;
52 }
53
54 pub mod pemfile {
55 //! Re-export of the [`rustls-pemfile`] crate.
56 //!
57 //! A basic parser for .pem files containing cryptographic keys and certificates.
58 //!
59 //! [`rustls-pemfile`]: https://docs.rs/rustls-pemfile
60 #[doc(inline)]
61 pub use rustls_pemfile::*;
62 }
63
64 pub mod native_certs {
65 //! Re-export of the [`rustls-native-certs`] crate.
66 //!
67 //! rustls-native-certs allows rustls to use the platform's native certificate
68 //! store when operating as a TLS client.
69 //!
70 //! [`rustls-native-certs`]: https://docs.rs/rustls-native-certs
71 #[doc(inline)]
72 pub use rustls_native_certs::*;
73 }
74
75 pub mod rcgen {
76 //! Re-export of the [`rcgen`] crate.
77 //!
78 //! [`rcgen`]: https://docs.rs/rcgen
79
80 #[doc(inline)]
81 pub use rcgen::*;
82 }
83
84 pub mod rustls {
85 //! Re-export of the [`rustls`] and [`tokio-rustls`] crates.
86 //!
87 //! To facilitate the use of `rustls` types in API's such as [`TlsAcceptorLayer`].
88 //!
89 //! [`rustls`]: https://docs.rs/rustls
90 //! [`tokio-rustls`]: https://docs.rs/tokio-rustls
91 //! [`TlsAcceptorLayer`]: crate::rustls::server::TlsAcceptorLayer
92
93 #[doc(inline)]
94 pub use rustls::*;
95
96 pub mod client {
97 //! Re-export of client module of the [`rustls`] and [`tokio-rustls`] crates.
98 //!
99 //! [`rustls`]: https://docs.rs/rustls
100 //! [`tokio-rustls`]: https://docs.rs/tokio-rustls
101
102 #[doc(inline)]
103 pub use rustls::client::*;
104 #[doc(inline)]
105 pub use tokio_rustls::client::TlsStream;
106 }
107
108 pub mod server {
109 //! Re-export of server module of the [`rustls`] and [`tokio-rustls`] crates.
110 //!
111 //! [`rustls`]: https://docs.rs/rustls
112 //! [`tokio-rustls`]: https://docs.rs/tokio-rustls
113
114 #[doc(inline)]
115 pub use rustls::server::*;
116 #[doc(inline)]
117 pub use tokio_rustls::server::TlsStream;
118 }
119 }
120
121 pub mod tokio_rustls {
122 //! Full Re-export of the [`tokio-rustls`] crate.
123 //!
124 //! [`tokio-rustls`]: https://docs.rs/tokio-rustls
125 #[doc(inline)]
126 pub use tokio_rustls::*;
127 }
128
129 pub mod webpki_roots {
130 //! Re-export of the [`webpki-roots`] provides.
131 //!
132 //! This module provides a function to load the Mozilla root CA store.
133 //!
134 //! This module is inspired by <certifi.io> and uses the data provided by
135 //! [the Common CA Database (CCADB)](https://www.ccadb.org/). The underlying data is used via
136 //! [the CCADB Data Usage Terms](https://www.ccadb.org/rootstores/usage#ccadb-data-usage-terms).
137 //!
138 //! The data in this crate is a derived work of the CCADB data. See copy of LICENSE at
139 //! <https://github.com/plabayo/rama/blob/main/docs/thirdparty/licenses/rustls-webpki-roots>.
140 //!
141 //! [`webpki-roots`]: https://docs.rs/webpki-roots
142 #[doc(inline)]
143 pub use webpki_roots::*;
144 }
145}