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 fn unspecified() -> &'static Self
pub fn from_socket_addr(addr: SocketAddr) -> 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 fn format_as_string(&self) -> Result<String>
Trait Implementations§
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