Struct shadowsocks::relay::tcprelay::proxy_listener::ProxyListener
source · pub struct ProxyListener { /* private fields */ }
Expand description
A TCP listener for accepting shadowsocks’ client connection
Implementations§
source§impl ProxyListener
impl ProxyListener
sourcepub async fn bind(
context: SharedContext,
svr_cfg: &ServerConfig
) -> Result<ProxyListener>
pub async fn bind( context: SharedContext, svr_cfg: &ServerConfig ) -> Result<ProxyListener>
Create a ProxyListener
binding to a specific address
sourcepub async fn bind_with_opts(
context: SharedContext,
svr_cfg: &ServerConfig,
accept_opts: AcceptOpts
) -> Result<ProxyListener>
pub async fn bind_with_opts( context: SharedContext, svr_cfg: &ServerConfig, accept_opts: AcceptOpts ) -> Result<ProxyListener>
Create a ProxyListener
binding to a specific address with opts
sourcepub fn from_listener(
context: SharedContext,
listener: TcpListener,
svr_cfg: &ServerConfig
) -> ProxyListener
pub fn from_listener( context: SharedContext, listener: TcpListener, svr_cfg: &ServerConfig ) -> ProxyListener
Create a ProxyListener
from a TcpListener
sourcepub async fn accept(&self) -> Result<(ProxyServerStream<TcpStream>, SocketAddr)>
pub async fn accept(&self) -> Result<(ProxyServerStream<TcpStream>, SocketAddr)>
Accepts a shadowsocks’ client connection
sourcepub async fn accept_map<F, S>(
&self,
map_fn: F
) -> Result<(ProxyServerStream<S>, SocketAddr)>
pub async fn accept_map<F, S>( &self, map_fn: F ) -> Result<(ProxyServerStream<S>, SocketAddr)>
Accepts a shadowsocks’ client connection and maps the accepted TcpStream
to another stream type
sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Get local binded address
sourcepub fn get_ref(&self) -> &TcpListener
pub fn get_ref(&self) -> &TcpListener
Get reference to the internal listener
sourcepub fn into_inner(self) -> TcpListener
pub fn into_inner(self) -> TcpListener
Consumes the ProxyListener
and return the internal listener
Auto Trait Implementations§
impl !RefUnwindSafe for ProxyListener
impl Send for ProxyListener
impl Sync for ProxyListener
impl Unpin for ProxyListener
impl !UnwindSafe for ProxyListener
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more