diff --git a/.gitignore b/.gitignore index a84f36c..3ca43ae 100644 --- a/.gitignore +++ b/.gitignore @@ -14,5 +14,3 @@ Cargo.lock # MSVC Windows builds of rustc generate these, which store debugging information *.pdb -# Vim swapfiles -*.swp diff --git a/Cargo.toml b/Cargo.toml index a38d520..ca8db61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" [dependencies] unicorn_hat_hd_2 = { version = "*" } +#unicorn_hat_hd_2 = { version = "*", default-features = false, features = [ "fake-hardware" ] } url = "*" reqwest = "*" trust-dns-client = "*" diff --git a/src/dns.rs b/src/dns.rs deleted file mode 100644 index 6bf487a..0000000 --- a/src/dns.rs +++ /dev/null @@ -1,13 +0,0 @@ -use crate::{Probe, ProbeResult}; -use trust_dns_client::client::Client; - -// DNS probe - -pub struct DnsProbe { -} - -impl Probe for DnsProbe { - fn execute() -> ProbeResult { - unimplemented!(); - } -} diff --git a/src/http.rs b/src/http.rs deleted file mode 100644 index 768c3a3..0000000 --- a/src/http.rs +++ /dev/null @@ -1,31 +0,0 @@ -use crate::{Probe, ProbeResult}; -use url::Url; - -use std::net::SocketAddr; - -#[derive(Debug)] -pub enum HttpError { - UrlError(url::ParseError) -} - -// HTTP probe -// -pub struct HttpProbe { - remote_addr: SocketAddr -} - -impl HttpProbe { - pub fn get(url: &str) -> Result { - let request = url::Url::parse(url) - .map_err(HttpError::UrlError); - - unimplemented!(); - } -} - -impl Probe for HttpProbe { - fn execute() -> ProbeResult { - unimplemented!(); - } -} - diff --git a/src/main.rs b/src/main.rs index af7b5f1..6b8b12a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,7 @@ use unicorn_hat_hd_2::UnicornHatHd; +use url::Url; -use self::http::HttpProbe; - -mod dns; -mod http; +use std::net::SocketAddr; pub trait Probe { fn execute() -> ProbeResult; @@ -23,6 +21,26 @@ pub struct ProbeMetrics { pub latency_ms: u32 } +// HTTP probe +// +pub struct HttpProbe { + remote_addr: SocketAddr +} + +impl Probe for HttpProbe { + fn execute() -> ProbeResult { + unimplemented!(); + } +} + +// DNS probe + +pub struct DnsProbe { + fn execute() -> ProbeResult { + unimplemented!(); + } +} + fn main() { let mut hat_hd = UnicornHatHd::default(); @@ -32,9 +50,5 @@ fn main() { //hat_hd.set_pixel(x, y, [255, 255, 255].into()); //hat_hd.display().unwrap(); - let probes = vec![ - HttpProbe::get("https://google.co.uk").expect("Failed to parse URL") - ]; - }