1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
//! tokio-ping is an asynchronous ICMP pinging library. //! //! The repository is located at <https://github.com/knsd/tokio-ping/>. //! //! # Usage example //! //! Note, sending and receiving ICMP packets requires privileges. //! //! ```rust,no_run //! extern crate futures; //! extern crate tokio; //! //! extern crate tokio_ping; //! //! use futures::{Future, Stream}; //! //! fn main() { //! let addr = std::env::args().nth(1).unwrap().parse().unwrap(); //! //! let pinger = tokio_ping::Pinger::new(); //! let stream = pinger.and_then(move |pinger| Ok(pinger.chain(addr).stream())); //! let future = stream.and_then(|stream| { //! stream.take(3).for_each(|mb_time| { //! match mb_time { //! Some(time) => println!("time={:?}", time), //! None => println!("timeout"), //! } //! Ok(()) //! }) //! }); //! //! tokio::run(future.map_err(|err| { //! eprintln!("Error: {}", err) //! })) //! } //! ``` #[macro_use] extern crate failure; #[macro_use] extern crate futures; extern crate libc; extern crate mio; extern crate rand; extern crate socket2; extern crate parking_lot; extern crate tokio_executor; extern crate tokio_reactor; extern crate tokio_timer; mod errors; mod packet; mod ping; mod socket; pub use errors::Error; pub use ping::{Pinger, PingChain, PingChainStream, PingFuture};