pub trait TargetSource {
// Required method
fn targets(&self) -> Vec<Target>;
// Provided method
fn count(&self) -> usize { ... }
}Expand description
Trait for any source of scan targets.
Implement this for custom target sources (APIs, databases, queues).
Required Methods§
Provided Methods§
Sourcefn count(&self) -> usize
fn count(&self) -> usize
Number of targets.
Example:
use scantarget::{Target, TargetSource};
struct StaticSource(Vec<Target>);
impl TargetSource for StaticSource {
fn targets(&self) -> Vec<Target> {
self.0.clone()
}
}
let source = StaticSource(vec!["https://example.com".parse::<Target>().unwrap()]);
assert_eq!(source.count(), 1);