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
//! 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. //! //! ``` //! extern crate futures; //! extern crate tokio_core; //! extern crate tokio_ping; //! //! use futures::Stream; //! //! fn main() { //! let addr = std::env::args().nth(1).unwrap().parse().unwrap(); //! //! let mut reactor = tokio_core::reactor::Core::new().unwrap(); //! let pinger = tokio_ping::Pinger::new(&reactor.handle()).unwrap(); //! let stream = pinger.chain(addr).stream(); //! //! let future = stream.take(3).for_each(|mb_time| { //! match mb_time { //! Some(time) => println!("time={}", time), //! None => println!("timeout"), //! } //! Ok(()) //! }); //! //! reactor.run(future).unwrap_or_default(); //! } //! //! ``` #[macro_use] extern crate error_chain; extern crate futures; extern crate lazy_socket; extern crate libc; extern crate mio; extern crate rand; extern crate time; #[macro_use] extern crate tokio_core; mod errors; mod packet; mod ping; mod socket; pub use errors::{Error, ErrorKind}; pub use ping::{Pinger, PingChain, PingChainStream, PingFuture};