Struct shadowsocks::relay::tcprelay::proxy_stream::client::ProxyClientStream[][src]

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

A stream for sending / receiving data stream from remote server via shadowsocks’ proxy server

Implementations

impl ProxyClientStream<TcpStream>[src]

pub async fn connect<A>(
    context: SharedContext,
    svr_cfg: &ServerConfig,
    addr: A
) -> Result<ProxyClientStream<TcpStream>> where
    A: Into<Address>, 
[src]

Connect to target addr via shadowsocks’ server configured by svr_cfg

pub async fn connect_with_opts<A>(
    context: SharedContext,
    svr_cfg: &ServerConfig,
    addr: A,
    opts: &ConnectOpts
) -> Result<ProxyClientStream<TcpStream>> where
    A: Into<Address>, 
[src]

Connect to target addr via shadowsocks’ server configured by svr_cfg

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

pub async fn connect_map<A, F>(
    context: SharedContext,
    svr_cfg: &ServerConfig,
    addr: A,
    map_fn: F
) -> Result<ProxyClientStream<S>> where
    A: Into<Address>,
    F: FnOnce(TcpStream) -> S, 
[src]

Connect to target addr via shadowsocks’ server configured by svr_cfg, maps TcpStream to customized stream with map_fn

pub async fn connect_with_opts_map<A, F>(
    context: SharedContext,
    svr_cfg: &ServerConfig,
    addr: A,
    opts: &ConnectOpts,
    map_fn: F
) -> Result<ProxyClientStream<S>> where
    A: Into<Address>,
    F: FnOnce(TcpStream) -> S, 
[src]

Connect to target addr via shadowsocks’ server configured by svr_cfg, maps TcpStream to customized stream with map_fn

pub fn from_stream<A>(
    context: SharedContext,
    stream: S,
    svr_cfg: &ServerConfig,
    addr: A
) -> ProxyClientStream<S> where
    A: Into<Address>, 
[src]

Create a ProxyClientStream with a connected stream to a shadowsocks’ server

NOTE: stream must be connected to the server with the same configuration as svr_cfg, otherwise strange errors would occurs

pub fn get_ref(&self) -> &S[src]

Get reference to the underlying stream

pub fn get_mut(&mut self) -> &mut S[src]

Get mutable reference to the underlying stream

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

Consumes the ProxyClientStream and return the underlying stream

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

Trait Implementations

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

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

Auto Trait Implementations

impl<S> !RefUnwindSafe for ProxyClientStream<S>

impl<S> Send for ProxyClientStream<S> where
    S: Send

impl<S> Sync for ProxyClientStream<S> where
    S: Sync

impl<S> Unpin for ProxyClientStream<S> where
    S: Unpin

impl<S> !UnwindSafe for ProxyClientStream<S>

Blanket Implementations

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

impl<T> Any for T where
    T: Any

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,