Skip to main content

Crate wae_https

Crate wae_https 

Source
Expand description

§WAE HTTPS - HTTPS 服务核心模块

提供统一的 HTTP/HTTPS 服务抽象,支持中间件、路由、请求处理等核心功能。

深度融合 tokio 运行时,支持:

  • 异步请求处理
  • 中间件链式处理
  • 统一错误处理
  • 请求追踪与日志
  • TLS/HTTPS 支持
  • HTTP/2 支持(包括 h2c 和 TLS + HTTP/2)

HTTPS 模块 - 提供安全的 HTTP 客户端功能。

§主要功能

  • HTTPS 支持: 安全的 HTTP 请求
  • 证书验证: TLS/SSL 证书验证
  • 代理支持: HTTP/HTTPS 代理配置
  • 连接池: 复用连接提升性能

§技术栈

  • HTTP 客户端: hyper, hyper-tls
  • TLS: rustls
  • 异步运行时: Tokio

§使用示例

use wae_https::{HttpsServerBuilder, HttpsServer};
use axum::Router;

#[tokio::main]
async fn main() {
    let server = HttpsServerBuilder::new()
        .service_name("my-service")
        .router(Router::new())
        .build();
    
    server.serve().await.unwrap();
}

§HTTP/2 配置

use wae_https::{HttpsServerBuilder, Http2Config};
use axum::Router;

let server = HttpsServerBuilder::new()
    .http2_config(Http2Config::new().with_max_concurrent_streams(128))
    .router(Router::new())
    .build();

Re-exports§

pub use wae_session as session;

Modules§

error
HTTP 错误处理模块
extract
Extractor 模块
middleware
HTTP 中间件模块
response
HTTP 响应模块
router
HTTP 路由模块
template
模板渲染模块
tls
TLS 配置模块

Structs§

ApiErrorBody
API 错误响应结构
ApiResponse
API 响应结构
Http2Config
HTTP/2 配置
Http3Config
HTTP/3 QUIC 配置
HttpsServer
HTTPS 服务器
HttpsServerBuilder
HTTPS 服务器构建器
HttpsServerConfig
HTTPS 服务器配置
Router
自定义路由类型
TlsConfig
TLS 配置
WaeError
中心化错误类型

Enums§

HttpVersion
HTTP 版本配置

Functions§

empty_body
创建空的 Body
full_body
创建带内容的 Body
static_files_router
创建静态文件服务路由

Type Aliases§

Body
HTTP 响应体类型
HttpsError
HTTPS 错误类型
HttpsResult
HTTPS 操作结果类型
WaeResult
WAE 结果类型