pub struct MonProxySocket<S> { /* private fields */ }Expand description
Monitored ProxySocket
Implementations§
Source§impl<S> MonProxySocket<S>
impl<S> MonProxySocket<S>
Sourcepub fn from_socket(socket: ProxySocket<S>, flow_stat: Arc<FlowStat>) -> Self
pub fn from_socket(socket: ProxySocket<S>, flow_stat: Arc<FlowStat>) -> Self
Create a new socket with flow monitor
Sourcepub fn get_ref(&self) -> &ProxySocket<S>
pub fn get_ref(&self) -> &ProxySocket<S>
Get the underlying ProxySocket<S> immutable reference
Source§impl<S> MonProxySocket<S>where
S: DatagramSend,
impl<S> MonProxySocket<S>where
S: DatagramSend,
Sourcepub async fn send(&self, addr: &Address, payload: &[u8]) -> Result<()>
pub async fn send(&self, addr: &Address, payload: &[u8]) -> Result<()>
Send a UDP packet to addr through proxy
Sourcepub async fn send_with_ctrl(
&self,
addr: &Address,
control: &UdpSocketControlData,
payload: &[u8],
) -> Result<()>
pub async fn send_with_ctrl( &self, addr: &Address, control: &UdpSocketControlData, payload: &[u8], ) -> Result<()>
Send a UDP packet to addr through proxy
Sourcepub async fn send_to(
&self,
target: SocketAddr,
addr: &Address,
payload: &[u8],
) -> Result<()>
pub async fn send_to( &self, target: SocketAddr, addr: &Address, payload: &[u8], ) -> Result<()>
Send a UDP packet to target from proxy
Sourcepub async fn send_to_with_ctrl(
&self,
target: SocketAddr,
addr: &Address,
control: &UdpSocketControlData,
payload: &[u8],
) -> Result<()>
pub async fn send_to_with_ctrl( &self, target: SocketAddr, addr: &Address, control: &UdpSocketControlData, payload: &[u8], ) -> Result<()>
Send a UDP packet to target from proxy
Source§impl<S> MonProxySocket<S>where
S: DatagramReceive,
impl<S> MonProxySocket<S>where
S: DatagramReceive,
Sourcepub async fn recv(&self, recv_buf: &mut [u8]) -> Result<(usize, Address)>
pub async fn recv(&self, recv_buf: &mut [u8]) -> Result<(usize, Address)>
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.
Sourcepub async fn recv_with_ctrl(
&self,
recv_buf: &mut [u8],
) -> Result<(usize, Address, Option<UdpSocketControlData>)>
pub async fn recv_with_ctrl( &self, recv_buf: &mut [u8], ) -> Result<(usize, Address, Option<UdpSocketControlData>)>
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.
Sourcepub async fn recv_from(
&self,
recv_buf: &mut [u8],
) -> Result<(usize, SocketAddr, Address)>
pub async fn recv_from( &self, recv_buf: &mut [u8], ) -> Result<(usize, SocketAddr, Address)>
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.
Sourcepub async fn recv_from_with_ctrl(
&self,
recv_buf: &mut [u8],
) -> Result<(usize, SocketAddr, Address, Option<UdpSocketControlData>)>
pub async fn recv_from_with_ctrl( &self, recv_buf: &mut [u8], ) -> Result<(usize, SocketAddr, Address, Option<UdpSocketControlData>)>
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.