Skip to main content

Crate axum_bootstrap

Crate axum_bootstrap 

Source
Expand description

§Axum Bootstrap 服务器核心模块

这个模块提供了基于 Axum 和 Hyper 的高性能 HTTP/HTTPS 服务器实现。 主要特性包括:

  • 支持 HTTP 和 HTTPS (TLS)
  • 请求拦截机制
  • 优雅关闭 (Graceful Shutdown)
  • IPv4/IPv6 双栈支持
  • 连接超时控制
  • TLS 证书动态更新

§示例

use axum::Router;
use axum_bootstrap::{new_server, generate_shutdown_receiver};

#[tokio::main]
async fn main() {
    let router = Router::new();
    let shutdown_rx = generate_shutdown_receiver();
    let server = new_server(8080, router, shutdown_rx);
    server.run().await.unwrap();
}

Modules§

error
错误处理模块
init_log
日志初始化模块
util
工具函数模块

Structs§

DummyInterceptor
空实现的请求拦截器
Server
HTTP/HTTPS 服务器核心结构
TlsParam
TLS 配置参数

Enums§

InterceptResult
请求拦截结果

Traits§

ReqInterceptor
请求拦截器 trait

Functions§

generate_shutdown_receiver
生成关闭信号接收器
new_server
创建默认服务器实例
subscribe_shutdown_sender
订阅关闭信号发送器

Type Aliases§

DefaultServer
默认服务器类型 (使用 DummyInterceptor)