Skip to main content

Module connection

Module connection 

Source
Expand description

HTTP 连接管理器

提供连接池复用、Keep-Alive 管理、LRU 淘汰策略和重定向跟随等功能。

§示例

use aria2_core::http::connection::{HttpConnectionManager, HttpConfig};
use std::time::Duration;

#[tokio::main]
async fn main() {
    let config = HttpConfig {
        max_connections: 10,
        connect_timeout: Duration::from_secs(30),
        read_timeout: Duration::from_secs(60),
        write_timeout: Duration::from_secs(60),
        idle_timeout: Duration::from_secs(300),
    };

    let manager = HttpConnectionManager::new(&config);
    // 使用连接管理器...
}

Structs§

ActiveConnection
活动连接信息
HttpConfig
HTTP 连接配置
HttpConnectionManager
HTTP 连接管理器
HttpResponse

Enums§

ConnectionState
HTTP 连接状态