Struct makiko::ClientReceiver
source · pub struct ClientReceiver { /* private fields */ }
Expand description
Receiving half of a Client
.
ClientReceiver
provides you with the ClientEvent
s, various events that are produced
during the life of the connection. You can usually ignore them, except
ClientEvent::ServerPubkey
, which is used to verify the server’s public key (if you ignore
that event, we assume that you reject the key and we abort the connection). However, you
must receive these events, otherwise the client will stall when the internal buffer of
events fills up.
Implementations§
source§impl ClientReceiver
impl ClientReceiver
sourcepub async fn recv(&mut self) -> Result<Option<ClientEvent>>
pub async fn recv(&mut self) -> Result<Option<ClientEvent>>
Wait for the next event.
Returns None
if the connection was closed.
sourcepub fn poll_recv(
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<Option<ClientEvent>>>
pub fn poll_recv( &mut self, cx: &mut Context<'_> ) -> Poll<Result<Option<ClientEvent>>>
Poll-friendly variant of .recv()
.
sourcepub fn specialize_channels(&mut self, enable: bool)
pub fn specialize_channels(&mut self, enable: bool)
Control whether we should treat some ClientEvent::Channel
events specially (low level
API).
When the server attempts to open a channel, we normally give you a
ClientEvent::Channel
. However, to provide a higher level API, we treat some channels
specially: when the channel type is "forwarded-tcpip"
, you will get a
ClientEvent::Tunnel
event instead of ClientEvent::Channel
event, so you can easily
work with the high-level Tunnel
API instead of the low-level Channel
API.
In most cases, the default behavior is perfectly OK and you want to keep this enabled. But
if you want to use the low-level API, you can disable this behavior by calling this method
with false
.