pub enum Address {
IPv4(SocketAddrV4),
IPv6(SocketAddrV6),
Domain(Domain, u16),
}Expand description
§Address
+------+----------+----------+
| ATYP | DST.ADDR | DST.PORT |
+------+----------+----------+
| 1 | Variable | 2 |
+------+----------+----------+§DST.ADDR BND.ADDR
In an address field (DST.ADDR, BND.ADDR), the ATYP field specifies the type of address contained within the field:
o ATYP: X’01’ the address is a version-4 IP address, with a length of 4 octets
o ATYP: X’03’ the address field contains a fully-qualified domain name. The first octet of the address field contains the number of octets of name that follow, there is no terminating NUL octet.
o ATYP: X’04’
the address is a version-6 IP address, with a length of 16 octets.
Variants§
Implementations§
Source§impl Address
impl Address
pub const PORT_LENGTH: usize = 2usize
pub const IPV4_ADDRESS_LENGTH: usize = 4usize
pub const IPV6_ADDRESS_LENGTH: usize = 16usize
pub const SOCKS5_ADDRESS_TYPE_IPV4: u8 = 1u8
pub const SOCKS5_ADDRESS_TYPE_DOMAIN_NAME: u8 = 3u8
pub const SOCKS5_ADDRESS_TYPE_IPV6: u8 = 4u8
Source§impl Address
impl Address
pub fn unspecified() -> &'static Self
pub async fn from_async_read<R: AsyncRead + Unpin>( reader: &mut R, ) -> Result<Self>
pub fn from_bytes<B: Buf>(buf: &mut B) -> Result<Self>
pub fn to_bytes(&self) -> Bytes
pub fn port(&self) -> u16
pub async fn to_socket_addr(self) -> Result<SocketAddr>
Trait Implementations§
Source§impl From<SocketAddr> for Address
impl From<SocketAddr> for Address
Source§fn from(value: SocketAddr) -> Self
fn from(value: SocketAddr) -> Self
Converts to this type from the input type.
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