pub struct Puncher { /* private fields */ }Implementations§
Source§impl Puncher
impl Puncher
pub fn new( udp_socket_manager: Option<Arc<UdpSocketManager>>, tcp_socket_manager: Option<Arc<TcpSocketManager>>, ) -> Puncher
Source§impl Puncher
impl Puncher
Sourcepub fn need_punch(&self, punch_info: &PunchInfo) -> bool
pub fn need_punch(&self, punch_info: &PunchInfo) -> bool
Call need_punch at a certain frequency, and call punch_now after getting true.
Determine whether punching is needed.
Sourcepub async fn punch(&self, buf: &[u8], punch_info: PunchInfo) -> Result<()>
pub async fn punch(&self, buf: &[u8], punch_info: PunchInfo) -> Result<()>
Call punch at a certain frequency
pub async fn punch_now( &self, tcp_buf: Option<&[u8]>, udp_buf: &[u8], punch_info: PunchInfo, ) -> Result<()>
Trait Implementations§
Source§impl From<&TunnelDispatcher> for Puncher
impl From<&TunnelDispatcher> for Puncher
Source§fn from(value: &TunnelDispatcher) -> Self
fn from(value: &TunnelDispatcher) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Puncher
impl !RefUnwindSafe for Puncher
impl Send for Puncher
impl Sync for Puncher
impl Unpin for Puncher
impl !UnwindSafe for Puncher
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