Struct socks::Socks5Datagram
source · [−]pub struct Socks5Datagram { /* private fields */ }
Expand description
A SOCKS5 UDP client.
Implementations
sourceimpl Socks5Datagram
impl Socks5Datagram
sourcepub fn bind<T, U>(proxy: T, addr: U) -> Result<Socks5Datagram> where
T: ToSocketAddrs,
U: ToSocketAddrs,
pub 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.
sourcepub fn bind_with_password<T, U>(
proxy: T,
addr: U,
username: &str,
password: &str
) -> Result<Socks5Datagram> where
T: ToSocketAddrs,
U: ToSocketAddrs,
pub fn bind_with_password<T, U>(
proxy: T,
addr: U,
username: &str,
password: &str
) -> 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. The given username and password is used to authenticate to the SOCKS proxy.
sourcepub fn send_to<A>(&self, buf: &[u8], addr: A) -> Result<usize> where
A: ToTargetAddr,
pub 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.
sourcepub fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, TargetAddr)>
pub fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, TargetAddr)>
Like UdpSocket::recv_from
.
sourcepub fn proxy_addr(&self) -> &TargetAddr
pub fn proxy_addr(&self) -> &TargetAddr
Returns the address of the proxy-side UDP socket through which all messages will be routed.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Socks5Datagram
impl Send for Socks5Datagram
impl Sync for Socks5Datagram
impl Unpin for Socks5Datagram
impl UnwindSafe for Socks5Datagram
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more