[][src]Struct tokio_socks::tcp::Socks5Stream

pub struct Socks5Stream<S> { /* fields omitted */ }

A SOCKS5 client.

For convenience, it can be dereferenced to it's inner socket.

Implementations

impl Socks5Stream<TcpStream>[src]

pub async fn connect<'t, P, T>(
    proxy: P,
    target: T
) -> Result<Socks5Stream<TcpStream>> where
    P: ToProxyAddrs,
    T: IntoTargetAddr<'t>, 
[src]

Connects to a target server through a SOCKS5 proxy given the proxy address.

Error

It propagates the error that occurs in the conversion from T to TargetAddr.

pub async fn connect_with_password<'a, 't, P, T>(
    proxy: P,
    target: T,
    username: &'a str,
    password: &'a str
) -> Result<Socks5Stream<TcpStream>> where
    P: ToProxyAddrs,
    T: IntoTargetAddr<'t>, 
[src]

Connects to a target server through a SOCKS5 proxy using given username, password and the address of the proxy.

Error

It propagates the error that occurs in the conversion from T to TargetAddr.

impl<S> Socks5Stream<S> where
    S: AsyncRead + AsyncWrite + Unpin
[src]

pub async fn connect_with_socket<'t, T>(
    socket: S,
    target: T
) -> Result<Socks5Stream<S>> where
    T: IntoTargetAddr<'t>, 
[src]

Connects to a target server through a SOCKS5 proxy given a socket to it.

Error

It propagates the error that occurs in the conversion from T to TargetAddr.

pub async fn connect_with_password_and_socket<'a, 't, T>(
    socket: S,
    target: T,
    username: &'a str,
    password: &'a str
) -> Result<Socks5Stream<S>> where
    T: IntoTargetAddr<'t>, 
[src]

Connects to a target server through a SOCKS5 proxy using given username, password and a socket to the proxy

Error

It propagates the error that occurs in the conversion from T to TargetAddr.

pub fn into_inner(self) -> S[src]

Consumes the Socks5Stream, returning the inner socket.

pub fn target_addr(&self) -> TargetAddr<'_>[src]

Returns the target address that the proxy server connects to.

Trait Implementations

impl<T> AsyncRead for Socks5Stream<T> where
    T: AsyncRead + Unpin
[src]

impl<T> AsyncWrite for Socks5Stream<T> where
    T: AsyncWrite + Unpin
[src]

impl<S: Debug> Debug for Socks5Stream<S>[src]

impl<S> Deref for Socks5Stream<S>[src]

type Target = S

The resulting type after dereferencing.

impl<S> DerefMut for Socks5Stream<S>[src]

Auto Trait Implementations

impl<S> RefUnwindSafe for Socks5Stream<S> where
    S: RefUnwindSafe
[src]

impl<S> Send for Socks5Stream<S> where
    S: Send
[src]

impl<S> Sync for Socks5Stream<S> where
    S: Sync
[src]

impl<S> Unpin for Socks5Stream<S> where
    S: Unpin
[src]

impl<S> UnwindSafe for Socks5Stream<S> where
    S: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<R> AsyncReadExt for R where
    R: AsyncRead + ?Sized
[src]

impl<W> AsyncWriteExt for W where
    W: AsyncWrite + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.