mirror of
https://codeberg.org/slatian/service.echoip-slatecave.git
synced 2025-11-02 01:38:54 +01:00
Update axum-client-ip to 1.1.3
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use axum_client_ip::SecureClientIpSource;
|
||||
use axum_client_ip::ClientIpSource;
|
||||
use serde::Deserialize;
|
||||
|
||||
use std::net::SocketAddr;
|
||||
@@ -21,7 +21,7 @@ pub struct EchoIpServiceConfig {
|
||||
#[derive(Deserialize, Clone)]
|
||||
pub struct ServerConfig {
|
||||
pub listen_on: SocketAddr,
|
||||
pub ip_header: SecureClientIpSource,
|
||||
pub ip_header: ClientIpSource,
|
||||
|
||||
pub allow_private_ip_lookup: bool,
|
||||
}
|
||||
@@ -51,7 +51,7 @@ impl Default for ServerConfig {
|
||||
fn default() -> Self {
|
||||
ServerConfig {
|
||||
listen_on: "127.0.0.1:3000".parse().unwrap(),
|
||||
ip_header: SecureClientIpSource::ConnectInfo,
|
||||
ip_header: ClientIpSource::ConnectInfo,
|
||||
allow_private_ip_lookup: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ use axum::{
|
||||
Router,
|
||||
routing::get,
|
||||
};
|
||||
use axum_client_ip::SecureClientIp;
|
||||
use axum_client_ip::ClientIp;
|
||||
use axum_extra::headers;
|
||||
use axum_extra::TypedHeader;
|
||||
use clap::Parser;
|
||||
@@ -463,7 +463,7 @@ async fn handle_default_route(
|
||||
State(arc_state): State<Arc<ServiceSharedState>>,
|
||||
Extension(settings): Extension<QuerySettings>,
|
||||
user_agent_header: Option<TypedHeader<headers::UserAgent>>,
|
||||
SecureClientIp(client_ip): SecureClientIp
|
||||
ClientIp(client_ip): ClientIp
|
||||
) -> Response {
|
||||
|
||||
let state = Arc::clone(&arc_state);
|
||||
@@ -589,7 +589,7 @@ async fn handle_ip_route_with_path(
|
||||
Extension(settings): Extension<QuerySettings>,
|
||||
State(arc_state): State<Arc<ServiceSharedState>>,
|
||||
extract::Path(query): extract::Path<String>,
|
||||
SecureClientIp(client_ip): SecureClientIp
|
||||
ClientIp(client_ip): ClientIp
|
||||
) -> Response {
|
||||
if let Ok(address) = query.parse() {
|
||||
return handle_ip_request(address, settings, arc_state, &client_ip).await
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use axum_client_ip::SecureClientIp;
|
||||
use axum_client_ip::ClientIp;
|
||||
use axum::{
|
||||
body::Body,
|
||||
extract::Extension,
|
||||
@@ -43,7 +43,7 @@ pub fn build_rate_limiting_state(
|
||||
}
|
||||
|
||||
pub async fn rate_limit_middleware(
|
||||
SecureClientIp(address): SecureClientIp,
|
||||
ClientIp(address): ClientIp,
|
||||
Extension(arc_limiter): Extension<Arc<SimpleRateLimiter<IpAddr>>>,
|
||||
req: Request<Body>,
|
||||
next: Next
|
||||
|
||||
Reference in New Issue
Block a user