mirror of
https://codeberg.org/slatian/service.echoip-slatecave.git
synced 2025-11-20 10:31:17 +01:00
Update axum-client-ip to 1.1.3
This commit is contained in:
79
Cargo.lock
generated
79
Cargo.lock
generated
@@ -150,12 +150,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "axum-client-ip"
|
name = "axum-client-ip"
|
||||||
version = "0.7.0"
|
version = "1.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dff8ee1869817523c8f91c20bf17fd932707f66c2e7e0b0f811b29a227289562"
|
checksum = "3f08a543641554404b42acd0d2494df12ca2be034d7b8ee4dbbf7446f940a2ef"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"forwarded-header-value",
|
"client-ip",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -372,6 +372,16 @@ version = "0.7.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
|
checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "client-ip"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "31211fc26899744f5b22521fdc971e5f3875991d8880537537470685a0e9552d"
|
||||||
|
dependencies = [
|
||||||
|
"forwarded-header-value",
|
||||||
|
"http",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "colorchoice"
|
name = "colorchoice"
|
||||||
version = "1.0.4"
|
version = "1.0.4"
|
||||||
@@ -554,7 +564,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"tera",
|
"tera",
|
||||||
"tokio",
|
"tokio",
|
||||||
"toml 0.8.23",
|
"toml",
|
||||||
"tower",
|
"tower",
|
||||||
"tower-http",
|
"tower-http",
|
||||||
]
|
]
|
||||||
@@ -1286,7 +1296,7 @@ dependencies = [
|
|||||||
"mime",
|
"mime",
|
||||||
"serde",
|
"serde",
|
||||||
"tera",
|
"tera",
|
||||||
"toml 0.9.8",
|
"toml",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1297,7 +1307,7 @@ checksum = "ad6270e962ff2af18516dc70519a18af0c772d9f3956eafd3618629560e55312"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"toml 0.9.8",
|
"toml",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2081,15 +2091,6 @@ dependencies = [
|
|||||||
"serde_core",
|
"serde_core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_spanned"
|
|
||||||
version = "0.6.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_spanned"
|
name = "serde_spanned"
|
||||||
version = "1.0.3"
|
version = "1.0.3"
|
||||||
@@ -2428,18 +2429,6 @@ dependencies = [
|
|||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml"
|
|
||||||
version = "0.8.23"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
"serde_spanned 0.6.9",
|
|
||||||
"toml_datetime 0.6.11",
|
|
||||||
"toml_edit",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml"
|
name = "toml"
|
||||||
version = "0.9.8"
|
version = "0.9.8"
|
||||||
@@ -2448,22 +2437,13 @@ checksum = "f0dc8b1fb61449e27716ec0e1bdf0f6b8f3e8f6b05391e8497b8b6d7804ea6d8"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"serde_core",
|
"serde_core",
|
||||||
"serde_spanned 1.0.3",
|
"serde_spanned",
|
||||||
"toml_datetime 0.7.3",
|
"toml_datetime",
|
||||||
"toml_parser",
|
"toml_parser",
|
||||||
"toml_writer",
|
"toml_writer",
|
||||||
"winnow",
|
"winnow",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml_datetime"
|
|
||||||
version = "0.6.11"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_datetime"
|
name = "toml_datetime"
|
||||||
version = "0.7.3"
|
version = "0.7.3"
|
||||||
@@ -2473,20 +2453,6 @@ dependencies = [
|
|||||||
"serde_core",
|
"serde_core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml_edit"
|
|
||||||
version = "0.22.27"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
|
|
||||||
dependencies = [
|
|
||||||
"indexmap",
|
|
||||||
"serde",
|
|
||||||
"serde_spanned 0.6.9",
|
|
||||||
"toml_datetime 0.6.11",
|
|
||||||
"toml_write",
|
|
||||||
"winnow",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_parser"
|
name = "toml_parser"
|
||||||
version = "1.0.4"
|
version = "1.0.4"
|
||||||
@@ -2496,12 +2462,6 @@ dependencies = [
|
|||||||
"winnow",
|
"winnow",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml_write"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_writer"
|
name = "toml_writer"
|
||||||
version = "1.0.4"
|
version = "1.0.4"
|
||||||
@@ -3232,9 +3192,6 @@ name = "winnow"
|
|||||||
version = "0.7.13"
|
version = "0.7.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf"
|
checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf"
|
||||||
dependencies = [
|
|
||||||
"memchr",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winreg"
|
name = "winreg"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ authors = ["Slatian <baschdel@disroot.org>"]
|
|||||||
lib-humus = { version="0.4", features=["axum-view+cookie"] }
|
lib-humus = { version="0.4", features=["axum-view+cookie"] }
|
||||||
lib-humus-configuration = { version = "0.1.0", featres=["toml"] }
|
lib-humus-configuration = { version = "0.1.0", featres=["toml"] }
|
||||||
|
|
||||||
axum-client-ip = "0.7"
|
axum-client-ip = { version = "1.1.3", features = ["serde", "forwarded-header"] }
|
||||||
axum-extra = { version = "0.10", features = ["cookie", "typed-header"] }
|
axum-extra = { version = "0.10", features = ["cookie", "typed-header"] }
|
||||||
axum = { version = "0.8", features = ["macros"] }
|
axum = { version = "0.8", features = ["macros"] }
|
||||||
clap = { version = "4.5", features = ["derive"] }
|
clap = { version = "4.5", features = ["derive"] }
|
||||||
@@ -28,6 +28,6 @@ regex = "1.11"
|
|||||||
serde = { version = "1", features = ["derive","rc"] }
|
serde = { version = "1", features = ["derive","rc"] }
|
||||||
tera = "1"
|
tera = "1"
|
||||||
tokio = { version = "1", features = ["macros","signal"] }
|
tokio = { version = "1", features = ["macros","signal"] }
|
||||||
toml = "0.8"
|
toml = "0.9"
|
||||||
tower = "0.5"
|
tower = "0.5"
|
||||||
tower-http = { version = "0.6", features = ["fs"] }
|
tower-http = { version = "0.6", features = ["fs"] }
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ This option can be overridden by the `-l <ip-address>:<port>` option on the comm
|
|||||||
|
|
||||||
Configures which http header that contains the real client IP-Address or tells the service to use the IP-Address used to connect to it when in use without a proxy server.
|
Configures which http header that contains the real client IP-Address or tells the service to use the IP-Address used to connect to it when in use without a proxy server.
|
||||||
|
|
||||||
Possible values are best covered by the [documentation for the underlying datatype](https://docs.rs/axum-client-ip/latest/axum_client_ip/enum.SecureClientIpSource.html).
|
Possible values are best covered by the [documentation for the underlying datatype](https://docs.rs/axum-client-ip/latest/axum_client_ip/enum.ClientIpSource.html).
|
||||||
|
Note: The possible values stayed compatible even though there was a [major release of the ip address extration library](https://github.com/imbolc/axum-client-ip/releases/tag/v1.0.0).
|
||||||
|
|
||||||
When using a reverse Proxy `RightmostXForwardedFor` is usually what you want.
|
When using a reverse Proxy `RightmostXForwardedFor` is usually what you want.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use axum_client_ip::SecureClientIpSource;
|
use axum_client_ip::ClientIpSource;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
@@ -21,7 +21,7 @@ pub struct EchoIpServiceConfig {
|
|||||||
#[derive(Deserialize, Clone)]
|
#[derive(Deserialize, Clone)]
|
||||||
pub struct ServerConfig {
|
pub struct ServerConfig {
|
||||||
pub listen_on: SocketAddr,
|
pub listen_on: SocketAddr,
|
||||||
pub ip_header: SecureClientIpSource,
|
pub ip_header: ClientIpSource,
|
||||||
|
|
||||||
pub allow_private_ip_lookup: bool,
|
pub allow_private_ip_lookup: bool,
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ impl Default for ServerConfig {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
ServerConfig {
|
ServerConfig {
|
||||||
listen_on: "127.0.0.1:3000".parse().unwrap(),
|
listen_on: "127.0.0.1:3000".parse().unwrap(),
|
||||||
ip_header: SecureClientIpSource::ConnectInfo,
|
ip_header: ClientIpSource::ConnectInfo,
|
||||||
allow_private_ip_lookup: false,
|
allow_private_ip_lookup: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ use axum::{
|
|||||||
Router,
|
Router,
|
||||||
routing::get,
|
routing::get,
|
||||||
};
|
};
|
||||||
use axum_client_ip::SecureClientIp;
|
use axum_client_ip::ClientIp;
|
||||||
use axum_extra::headers;
|
use axum_extra::headers;
|
||||||
use axum_extra::TypedHeader;
|
use axum_extra::TypedHeader;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
@@ -463,7 +463,7 @@ async fn handle_default_route(
|
|||||||
State(arc_state): State<Arc<ServiceSharedState>>,
|
State(arc_state): State<Arc<ServiceSharedState>>,
|
||||||
Extension(settings): Extension<QuerySettings>,
|
Extension(settings): Extension<QuerySettings>,
|
||||||
user_agent_header: Option<TypedHeader<headers::UserAgent>>,
|
user_agent_header: Option<TypedHeader<headers::UserAgent>>,
|
||||||
SecureClientIp(client_ip): SecureClientIp
|
ClientIp(client_ip): ClientIp
|
||||||
) -> Response {
|
) -> Response {
|
||||||
|
|
||||||
let state = Arc::clone(&arc_state);
|
let state = Arc::clone(&arc_state);
|
||||||
@@ -589,7 +589,7 @@ async fn handle_ip_route_with_path(
|
|||||||
Extension(settings): Extension<QuerySettings>,
|
Extension(settings): Extension<QuerySettings>,
|
||||||
State(arc_state): State<Arc<ServiceSharedState>>,
|
State(arc_state): State<Arc<ServiceSharedState>>,
|
||||||
extract::Path(query): extract::Path<String>,
|
extract::Path(query): extract::Path<String>,
|
||||||
SecureClientIp(client_ip): SecureClientIp
|
ClientIp(client_ip): ClientIp
|
||||||
) -> Response {
|
) -> Response {
|
||||||
if let Ok(address) = query.parse() {
|
if let Ok(address) = query.parse() {
|
||||||
return handle_ip_request(address, settings, arc_state, &client_ip).await
|
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::{
|
use axum::{
|
||||||
body::Body,
|
body::Body,
|
||||||
extract::Extension,
|
extract::Extension,
|
||||||
@@ -43,7 +43,7 @@ pub fn build_rate_limiting_state(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn rate_limit_middleware(
|
pub async fn rate_limit_middleware(
|
||||||
SecureClientIp(address): SecureClientIp,
|
ClientIp(address): ClientIp,
|
||||||
Extension(arc_limiter): Extension<Arc<SimpleRateLimiter<IpAddr>>>,
|
Extension(arc_limiter): Extension<Arc<SimpleRateLimiter<IpAddr>>>,
|
||||||
req: Request<Body>,
|
req: Request<Body>,
|
||||||
next: Next
|
next: Next
|
||||||
|
|||||||
Reference in New Issue
Block a user