Struct socks::Socks5Datagram
[−]
[src]
pub struct Socks5Datagram { // some fields omitted }
A SOCKS5 UDP client.
Methods
impl Socks5Datagram
[src]
fn bind<T, U>(proxy: T, addr: U) -> Result<Socks5Datagram> where T: ToSocketAddrs, U: ToSocketAddrs
Creates a UDP socket bound to the specified address which will have its traffic routed through the specified proxy.
fn send_to<A>(&self, buf: &[u8], addr: A) -> Result<usize> where A: ToTargetAddr
Like UdpSocket::send_to
.
Note
The SOCKS protocol inserts a header at the beginning of the message. The header will be 10 bytes for an IPv4 address, 22 bytes for an IPv6 address, and 7 bytes plus the length of the domain for a domain address.
fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>
Like UdpSocket::recv_from
.
fn proxy_addr(&self) -> SocketAddr
Returns the address of the proxy-side UDP socket through which all messages will be routed.
fn get_ref(&self) -> &UdpSocket
Returns a shared reference to the inner socket.
fn get_mut(&mut self) -> &mut UdpSocket
Returns a mutable reference to the inner socket.