pub fn socks5_read_udp_header(buf: &[u8]) -> Result<(Address, usize)>Available on crate feature
socks5 only.Expand description
Reads and parses the SOCKS5 UDP header information and destination address from a UDP packet buffer.
Per RFC 1928 Section 7, SOCKS5 UDP requests/responses contain a header in the following format:
+----+------+------+----------+----------+----------+
|RSV | FRAG | ATYP | DST.ADDR | DST.PORT | DATA |
+----+------+------+----------+----------+----------+
| 2 | 1 | 1 | Variable | 2 | Variable |
+----+------+------+----------+----------+----------+RSV: Reserved field, must be 0 FRAG: Fragment number (currently unused, set to 0) ATYP/DST.ADDR/DST.PORT: Destination address encoded in the same format as SOCKS5 requests
§Arguments
buf- A buffer slice containing the UDP packet
§Returns
Result<(Address, usize)>- On success, returns the parsed destination address and the total header length in bytes, or an IO error on failure