aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 26be932..8f56601 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -22,7 +22,6 @@ use std::net::IpAddr;
use std::result::Result;
use std::str::FromStr;
-#[derive(Deserialize)]
pub struct PhishTank {
pub phishes: Vec<Phish>,
}
@@ -60,6 +59,13 @@ pub fn load_phistank<R: BufRead>(input: R) -> Result<PhishTank, io::Error> {
Ok(PhishTank { phishes })
}
+
+impl PhishTank {
+ pub fn is_phish(&self, url: &str) -> bool {
+ self.phishes.iter().find(|phish| phish.url == url).is_some()
+ }
+}
+
// Helper function to deserialize a number represented as a string.
//
// The PhishTank dataset represents numbers this way, so the default