Function goatns::utils::check_valid_tld

source ·
pub fn check_valid_tld(zone_name: &str, allowed_tlds: &[String]) -> bool
Expand description

Compares the TLD to the list of valid TLDs - usually from allowed_tlds in crate::config::ConfigFile

 use goatns::utils::check_valid_tld;

 let valid_tlds = vec![];
 let zone_name = "hello.example.goat";
 assert_eq!(check_valid_tld(&zone_name, &valid_tlds), true);

 let valid_tlds = vec!["goat".to_string()];
 let zone_name = "hello.example.goat";
 assert_eq!(check_valid_tld(&zone_name, &valid_tlds), true);

 let valid_tlds = vec!["cheese".to_string()];
 let zone_name = "hello.example.goat";
 assert_eq!(check_valid_tld(&zone_name, &valid_tlds), false);