Struct surge_ping::Client
source · pub struct Client { /* private fields */ }Expand description
If you want to pass the Client in the task, please wrap it with Arc: Arc<Client>.
and can realize the simultaneous ping of multiple addresses when only one socket is created.
Implementations§
source§impl Client
impl Client
sourcepub fn new(config: &Config) -> Result<Self>
pub fn new(config: &Config) -> Result<Self>
A client is generated according to the configuration. In fact, a AsyncSocket is wrapped inside,
and you can clone to any task at will.
sourcepub async fn pinger(&self, host: IpAddr, ident: PingIdentifier) -> Pinger
pub async fn pinger(&self, host: IpAddr, ident: PingIdentifier) -> Pinger
Create a Pinger instance, you can make special configuration for this instance.
sourcepub fn get_socket(&self) -> AsyncSocket
pub fn get_socket(&self) -> AsyncSocket
Expose the underlying socket, if user wants to modify any options on it