docserver/src/defs/app_connect_info.rs

19 lines
463 B
Rust

use std::net::SocketAddr;
use hyper::server::conn::AddrStream;
use axum::extract::connect_info::Connected;
#[derive(Clone, Debug)]
pub struct AppConnectInfo {
pub remote_addr: SocketAddr,
pub local_addr: SocketAddr,
}
impl Connected<&AddrStream> for AppConnectInfo {
fn connect_info(target: &AddrStream) -> Self {
AppConnectInfo {
remote_addr: target.remote_addr(),
local_addr: target.local_addr(),
}
}
}