Resolve all GitHub domains and return (ip, domain) pairs
(domains: &[String])
| 24 | |
| 25 | /// Resolve all GitHub domains and return (ip, domain) pairs |
| 26 | pub fn fetch_hosts(domains: &[String]) -> Vec<(String, String)> { |
| 27 | let mut hosts = Vec::new(); |
| 28 | for domain in domains { |
| 29 | if let Some(ip) = resolve_ipv4(domain) { |
| 30 | hosts.push((ip, domain.clone())); |
| 31 | } |
| 32 | } |
| 33 | hosts |
| 34 | } |
| 35 | |
| 36 | /// Format hosts entries into a text string |
| 37 | pub fn format_hosts_text(hosts: &[(String, String)], now: &str) -> String { |
no test coverage detected