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
//! TLS codec — sans-IO encrypt/decrypt via rustls.
//!
//! Sits between the socket and protocol parsers:
//!
//! ```text
//! socket → TlsCodec (decrypt) → FrameReader / ResponseReader → Message
//! Request → TlsCodec (encrypt) → socket
//! ```
//!
//! # Quick Start
//!
//! ```ignore
//! use nexus_net::tls::TlsConfig;
//! use nexus_net::ws::Client;
//!
//! let tls = TlsConfig::new()?;
//! let mut ws = Client::builder()
//! .tls(&tls)
//! .connect("wss://exchange.com/ws/v1")?;
//!
//! while let Some(msg) = ws.recv()? {
//! process(msg);
//! }
//! ```
//!
//! # Codec primitives
//!
//! - [`TlsCodec::read_tls`] feeds buffered ciphertext one packet step
//! at a time (the canonical streaming path).
//! - [`TlsCodec::read_tls_from`] drives a sync [`Read`](std::io::Read)
//! source directly.
//! - [`TlsCodec::read_and_process_tls`] loops over a bounded buffer
//! (use for in-memory tests or custom adapters that pre-buffer
//! known-bounded ciphertext; no production callers in this crate).
//! - [`TlsCodec::read_plaintext`] / [`TlsCodec::drain_plaintext_into`]
//! drain decrypted plaintext (the latter feeds a [`ParserSink`]
//! directly, zero-copy).
//! - [`TlsCodec::encrypt`] / [`TlsCodec::write_tls_to`] handle the
//! outbound side.
pub use ;
pub use TlsCodec;
pub use ;
pub use TlsError;
pub use TlsStream;