|
1 | 1 | use axum::{ |
2 | | - extract::{rejection::ExtensionRejection, ConnectInfo, FromRequestParts}, |
| 2 | + Extension, |
| 3 | + extract::{ConnectInfo, FromRequestParts, rejection::ExtensionRejection}, |
3 | 4 | http::request::Parts, |
4 | 5 | response::{IntoResponse, Response}, |
5 | | - Extension, |
6 | 6 | }; |
7 | | -use hyper::{header::ToStrError, HeaderMap, StatusCode}; |
| 7 | +use hyper::{HeaderMap, StatusCode, header::ToStrError}; |
8 | 8 | use log::warn; |
9 | 9 | use std::{ |
10 | 10 | net::{AddrParseError, IpAddr, Ipv4Addr, SocketAddr}, |
|
47 | 47 | Extension::<ConnectInfo<SocketAddr>>::from_request_parts(parts, state) |
48 | 48 | .await |
49 | 49 | .map_err(IpAddressError::ConnectInfo) |
50 | | - .and_then(|value| try_socket_address(value.0 .0)) |
| 50 | + .and_then(|value| try_socket_address(value.0.0)) |
51 | 51 | .map(Self) |
52 | 52 | } |
53 | 53 | } |
@@ -122,7 +122,7 @@ impl IntoResponse for IpAddressError { |
122 | 122 | mod test { |
123 | 123 | use crate::config::Config; |
124 | 124 |
|
125 | | - use super::{extract_ip_header, IpAddress, IpAddressError, REAL_IP_HEADER}; |
| 125 | + use super::{IpAddress, IpAddressError, REAL_IP_HEADER, extract_ip_header}; |
126 | 126 | use axum::{ |
127 | 127 | extract::{ConnectInfo, FromRequestParts}, |
128 | 128 | http::HeaderValue, |
|
0 commit comments