cdns_rs/network_common.rs
1use std::{net::SocketAddr, os::fd::BorrowedFd};
2
3/// A common items for bot sync and async. Shhould be implemented
4/// by each instance.
5pub trait SocketTapCommon
6{
7 /// Tells if socket/stream is connected to remote host
8 fn is_conncected(&self) -> bool;
9
10 /// Returns the raw fd of the socket.
11 fn get_fd(&self) -> Option<BorrowedFd>;
12
13 /// Returns the remote host Ip and port.
14 fn get_remote_addr(&self) -> &SocketAddr;
15}