Struct socks::Socks4Stream [] [src]

pub struct Socks4Stream {
    // some fields omitted
}

A SOCKS4 client.

Methods

impl Socks4Stream

fn connect<T, U>(proxy: T, target: U, userid: &str) -> Result<Socks4Stream> where T: ToSocketAddrs, U: ToTargetAddr

Connects to a target server through a SOCKS4 proxy.

Note

If target is a TargetAddr::Domain, the domain name will be forwarded to the proxy server using the SOCKS4A protocol extension. If the proxy server does not support SOCKS4A, consider performing the DNS lookup locally and passing a TargetAddr::Ip.

fn proxy_addr(&self) -> SocketAddrV4

Returns the proxy-side address of the connection between the proxy and target server.

fn get_ref(&self) -> &TcpStream

Returns a shared reference to the inner TcpStream.

fn get_mut(&mut self) -> &mut TcpStream

Returns a mutable reference to the inner TcpStream.

fn into_inner(self) -> TcpStream

Consumes the Socks4Stream, returning the inner TcpStream.

Trait Implementations

impl Read for Socks4Stream

fn read(&mut self, buf: &mut [u8]) -> Result<usize>

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>

fn by_ref(&mut self) -> &mut Self

fn bytes(self) -> Bytes<Self>

fn chars(self) -> Chars<Self>

fn chain<R>(self, next: R) -> Chain<Self, R> where R: Read

fn take(self, limit: u64) -> Take<Self>

fn tee<W>(self, out: W) -> Tee<Self, W> where W: Write

impl<'a> Read for &'a Socks4Stream

fn read(&mut self, buf: &mut [u8]) -> Result<usize>

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>

fn by_ref(&mut self) -> &mut Self

fn bytes(self) -> Bytes<Self>

fn chars(self) -> Chars<Self>

fn chain<R>(self, next: R) -> Chain<Self, R> where R: Read

fn take(self, limit: u64) -> Take<Self>

fn tee<W>(self, out: W) -> Tee<Self, W> where W: Write

impl Write for Socks4Stream

fn write(&mut self, buf: &[u8]) -> Result<usize>

fn flush(&mut self) -> Result<()>

fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>

fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>

fn by_ref(&mut self) -> &mut Self

fn broadcast<W>(self, other: W) -> Broadcast<Self, W> where W: Write

impl<'a> Write for &'a Socks4Stream

fn write(&mut self, buf: &[u8]) -> Result<usize>

fn flush(&mut self) -> Result<()>

fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>

fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>

fn by_ref(&mut self) -> &mut Self

fn broadcast<W>(self, other: W) -> Broadcast<Self, W> where W: Write

Derived Implementations

impl Debug for Socks4Stream

fn fmt(&self, __arg_0: &mut Formatter) -> Result