Compare commits

..

No commits in common. "168621cd993adb0a19a105c4fa17641698866b2b" and "0237540773eaf7fce7a9b45f3fc449cbd47be0f6" have entirely different histories.

5 changed files with 23 additions and 54 deletions

2
.gitignore vendored
View file

@ -14,5 +14,3 @@ Cargo.lock
# MSVC Windows builds of rustc generate these, which store debugging information # MSVC Windows builds of rustc generate these, which store debugging information
*.pdb *.pdb
# Vim swapfiles
*.swp

View file

@ -7,6 +7,7 @@ edition = "2021"
[dependencies] [dependencies]
unicorn_hat_hd_2 = { version = "*" } unicorn_hat_hd_2 = { version = "*" }
#unicorn_hat_hd_2 = { version = "*", default-features = false, features = [ "fake-hardware" ] }
url = "*" url = "*"
reqwest = "*" reqwest = "*"
trust-dns-client = "*" trust-dns-client = "*"

View file

@ -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!();
}
}

View file

@ -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<HttpProbe, HttpError> {
let request = url::Url::parse(url)
.map_err(HttpError::UrlError);
unimplemented!();
}
}
impl Probe for HttpProbe {
fn execute() -> ProbeResult {
unimplemented!();
}
}

View file

@ -1,9 +1,7 @@
use unicorn_hat_hd_2::UnicornHatHd; use unicorn_hat_hd_2::UnicornHatHd;
use url::Url;
use self::http::HttpProbe; use std::net::SocketAddr;
mod dns;
mod http;
pub trait Probe { pub trait Probe {
fn execute() -> ProbeResult; fn execute() -> ProbeResult;
@ -23,6 +21,26 @@ pub struct ProbeMetrics {
pub latency_ms: u32 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() { fn main() {
let mut hat_hd = UnicornHatHd::default(); let mut hat_hd = UnicornHatHd::default();
@ -32,9 +50,5 @@ fn main() {
//hat_hd.set_pixel(x, y, [255, 255, 255].into()); //hat_hd.set_pixel(x, y, [255, 255, 255].into());
//hat_hd.display().unwrap(); //hat_hd.display().unwrap();
let probes = vec![
HttpProbe::get("https://google.co.uk").expect("Failed to parse URL")
];
} }