pub struct Address {
pub origin_addr: IpAddr,
pub proxies: Vec<IpAddr>,
pub port: u16,
}Expand description
Represents a request’s address. Contains proxy data if applicable.
Fields§
§origin_addr: IpAddrOriginal address of the request behind any proxies.
proxies: Vec<IpAddr>The proxies that the request travelled through, from first to last.
port: u16The port of the request.
Implementations§
Source§impl Address
impl Address
Sourcepub fn new(addr: impl ToSocketAddrs) -> Result<Self, Box<dyn Error>>
pub fn new(addr: impl ToSocketAddrs) -> Result<Self, Box<dyn Error>>
Create a new Address object from the socket address.
Sourcepub fn from_headers(
headers: &Headers,
addr: impl ToSocketAddrs,
) -> Result<Self, Box<dyn Error>>
pub fn from_headers( headers: &Headers, addr: impl ToSocketAddrs, ) -> Result<Self, Box<dyn Error>>
Create a new Address object from a request’s headers and the socket address.
This looks for the X-Forwarded-For header, used by proxies and CDNs, to find the origin address.
Trait Implementations§
impl Eq for Address
impl StructuralPartialEq for Address
Auto Trait Implementations§
impl Freeze for Address
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnwindSafe for Address
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more