pub enum ProxyV2Addr {
Ip {
src: SocketAddr,
dst: SocketAddr,
},
Unix {
src: SocketAddr,
dst: SocketAddr,
},
}Expand description
An address re-representation. Can be initialized using TryFrom
implementations.
TryFrom(“ip:port”, “ip:port”) TryFrom(IpAddr, u16, IpAddr, u16) TryFrom(net::SocketAddr, net::SocketAddr) TryFrom(SocketAddr, SocketAddr)
The type will be determined automatically.
Variants§
Implementations§
Source§impl ProxyV2Addr
impl ProxyV2Addr
Sourcepub fn get_len(&self) -> u16
pub fn get_len(&self) -> u16
Returns the length in bytes for the current address. It returns full size, but not the actual ocupied length (for unix addresses).
Sourcepub fn as_addr_family(&self) -> ProxyV2AddrType
pub fn as_addr_family(&self) -> ProxyV2AddrType
Returns the address type.
Sourcepub fn read(
addr_fam: ProxyV2AddrType,
cur: &mut Cursor<&[u8]>,
) -> HaProxRes<Option<Self>>
pub fn read( addr_fam: ProxyV2AddrType, cur: &mut Cursor<&[u8]>, ) -> HaProxRes<Option<Self>>
Reads the address section of the HaProxy. The address family should be
obtained from the same packet before. The cur must point to the beginning
of the address block.
§Returns
The Result is returned. The Option::None will be returned only if the
addr_fam is ProxyV2AddrType::AfUnspec.
Trait Implementations§
Source§impl Clone for ProxyV2Addr
impl Clone for ProxyV2Addr
Source§fn clone(&self) -> ProxyV2Addr
fn clone(&self) -> ProxyV2Addr
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProxyV2Addr
impl Debug for ProxyV2Addr
Source§impl Display for ProxyV2Addr
impl Display for ProxyV2Addr
Source§impl PartialEq for ProxyV2Addr
impl PartialEq for ProxyV2Addr
Source§impl TryFrom<(&str, &str)> for ProxyV2Addr
Attempts to convert tuple (source, destination) from str into ProxyV2Addr.
impl TryFrom<(&str, &str)> for ProxyV2Addr
Attempts to convert tuple (source, destination) from str into ProxyV2Addr.
Source§impl TryFrom<(IpAddr, u16, IpAddr, u16)> for ProxyV2Addr
impl TryFrom<(IpAddr, u16, IpAddr, u16)> for ProxyV2Addr
Source§impl TryFrom<(SocketAddr, SocketAddr)> for ProxyV2Addr
impl TryFrom<(SocketAddr, SocketAddr)> for ProxyV2Addr
Source§fn try_from(value: (SocketAddr, SocketAddr)) -> Result<Self, Self::Error>
fn try_from(value: (SocketAddr, SocketAddr)) -> Result<Self, Self::Error>
§Arguments
-
value.0- source address SocketAddr -
value.1- destination address SocketAddr
Source§impl TryFrom<(SocketAddr, SocketAddr)> for ProxyV2Addr
Attempts to convert from tuple (source, dst) from net::SocketAddr into ProxyV2Addr.
impl TryFrom<(SocketAddr, SocketAddr)> for ProxyV2Addr
Attempts to convert from tuple (source, dst) from net::SocketAddr into ProxyV2Addr.
Source§fn try_from(value: (SocketAddr, SocketAddr)) -> Result<Self, Self::Error>
fn try_from(value: (SocketAddr, SocketAddr)) -> Result<Self, Self::Error>
§Arguments
-
value.0- source address net::SocketAddr -
value.1- destination address net::SocketAddr