| Crates.io | headers-client-ip |
| lib.rs | headers-client-ip |
| version | 0.1.0 |
| created_at | 2022-06-27 17:26:07.103683+00 |
| updated_at | 2022-06-27 17:26:07.103683+00 |
| description | A header for X-Real-IP compatible with headers crate |
| homepage | |
| repository | https://github.com/dimitrmo/headers-client-ip |
| max_upload_size | |
| id | 614239 |
| size | 5,640 |
let app = Router::new().route("/ws", get(ws_handler));
async fn ws_handler(
ws: WebSocketUpgrade,
ip: Option<TypedHeader<XRealIP>>,
) -> impl IntoResponse {
if let Some(TypedHeader(user_ip)) = ip {
println!("`{}` connected", user_ip);
}
ws.on_upgrade(handle_socket)
}
async fn handle_socket(mut socket: WebSocket) {
//
}