oxitls_core/config.rs
1//! Generic TLS configuration introspection trait.
2
3use crate::{CipherSuite, TlsVersion};
4
5/// A trait for generic introspection of TLS configuration.
6///
7/// Adapter crates implement this trait on their configuration structs to
8/// allow higher-level crates (e.g. `oxitls`, `oxitls-h2`) to read
9/// the effective parameters without depending on adapter-specific types.
10pub trait TlsConfig {
11 /// The TLS protocol versions enabled by this configuration.
12 fn protocol_versions(&self) -> &[TlsVersion];
13
14 /// The ALPN protocol identifiers advertised by this configuration, in
15 /// preference order. Each entry is a raw byte string, e.g. `b"h2"`.
16 fn alpn_protocols(&self) -> &[Vec<u8>];
17
18 /// The SNI server name, if any, used for this configuration.
19 fn sni_name(&self) -> Option<&str>;
20
21 /// The cipher suites enabled by this configuration.
22 ///
23 /// Returns an empty slice when the implementation does not constrain
24 /// cipher selection (i.e. the provider default is used).
25 fn cipher_suites(&self) -> &[CipherSuite] {
26 &[]
27 }
28}