Struct shadowsocks::relay::udprelay::proxy_socket::ProxySocket[][src]

pub struct ProxySocket { /* fields omitted */ }

UDP client for communicating with ShadowSocks’ server

Implementations

impl ProxySocket[src]

pub async fn connect(
    context: SharedContext,
    svr_cfg: &ServerConfig
) -> Result<ProxySocket>
[src]

Create a client to communicate with Shadowsocks’ UDP server

pub async fn connect_with_opts(
    context: SharedContext,
    svr_cfg: &ServerConfig,
    opts: &ConnectOpts
) -> Result<ProxySocket>
[src]

Create a client to communicate with Shadowsocks’ UDP server

pub fn from_socket(
    context: SharedContext,
    svr_cfg: &ServerConfig,
    socket: UdpSocket
) -> ProxySocket
[src]

Create a ProxySocket from a UdpSocket

pub async fn bind(
    context: SharedContext,
    svr_cfg: &ServerConfig
) -> Result<ProxySocket>
[src]

Create a ProxySocket binding to a specific address

pub async fn send(&self, addr: &Address, payload: &[u8]) -> Result<usize>[src]

Send a UDP packet to addr through proxy

pub async fn send_to<A: ToSocketAddrs>(
    &self,
    target: A,
    addr: &Address,
    payload: &[u8]
) -> Result<usize>
[src]

Send a UDP packet to target from proxy

pub async fn recv(&self, recv_buf: &mut [u8]) -> Result<(usize, Address, usize)>[src]

Receive packet from Shadowsocks’ UDP server

This function will use recv_buf to store intermediate data, so it has to be big enough to store the whole shadowsocks’ packet

It is recommended to allocate a buffer to have at least 65536 bytes.

pub async fn recv_from(
    &self,
    recv_buf: &mut [u8]
) -> Result<(usize, SocketAddr, Address, usize)>
[src]

Receive packet from Shadowsocks’ UDP server

This function will use recv_buf to store intermediate data, so it has to be big enough to store the whole shadowsocks’ packet

It is recommended to allocate a buffer to have at least 65536 bytes.

pub fn local_addr(&self) -> Result<SocketAddr>[src]

Get local addr of socket

pub fn set_send_timeout(&mut self, t: Option<Duration>)[src]

Set send timeout, None will clear timeout

pub fn set_recv_timeout(&mut self, t: Option<Duration>)[src]

Set recv timeout, None will clear timeout

Auto Trait Implementations

Blanket Implementations

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

impl<T> Any for T where
    T: Any

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>,