pub struct TlsConfig {
pub cert_path: PathBuf,
pub key_path: PathBuf,
pub alpn: Vec<Vec<u8>>,
}Expand description
TLS 配置
Fields§
§cert_path: PathBuf证书文件路径(PEM 格式)
key_path: PathBuf私钥文件路径(PEM 格式)
alpn: Vec<Vec<u8>>ALPN 协议列表(默认 h2 + http/1.1)
Implementations§
Source§impl TlsConfig
impl TlsConfig
Sourcepub fn http1_only(self) -> Self
pub fn http1_only(self) -> Self
仅 HTTP/1.1
Sourcepub async fn build_acceptor(&self) -> Result<TlsAcceptor, TlsError>
pub async fn build_acceptor(&self) -> Result<TlsAcceptor, TlsError>
构建 TlsAcceptor
异步读取证书和私钥文件(遵循 tokio::fs 铁律)。
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TlsConfig
impl RefUnwindSafe for TlsConfig
impl Send for TlsConfig
impl Sync for TlsConfig
impl Unpin for TlsConfig
impl UnsafeUnpin for TlsConfig
impl UnwindSafe for TlsConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more