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]
context: SharedContext,
svr_cfg: &ServerConfig
) -> Result<ProxySocket>
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]
context: SharedContext,
svr_cfg: &ServerConfig,
opts: &ConnectOpts
) -> Result<ProxySocket>
Create a client to communicate with Shadowsocks’ UDP server
pub fn from_socket(
context: SharedContext,
svr_cfg: &ServerConfig,
socket: UdpSocket
) -> ProxySocket
[src]
context: SharedContext,
svr_cfg: &ServerConfig,
socket: UdpSocket
) -> ProxySocket
Create a ProxySocket
from a UdpSocket
pub async fn bind(
context: SharedContext,
svr_cfg: &ServerConfig
) -> Result<ProxySocket>
[src]
context: SharedContext,
svr_cfg: &ServerConfig
) -> Result<ProxySocket>
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]
&self,
target: A,
addr: &Address,
payload: &[u8]
) -> Result<usize>
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]
&self,
recv_buf: &mut [u8]
) -> Result<(usize, SocketAddr, Address, usize)>
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
impl !RefUnwindSafe for ProxySocket
impl Send for ProxySocket
impl Sync for ProxySocket
impl Unpin for ProxySocket
impl !UnwindSafe for ProxySocket
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,