Format hosts entries into a text string
(hosts: &[(String, String)], now: &str)
| 35 | |
| 36 | /// Format hosts entries into a text string |
| 37 | pub fn format_hosts_text(hosts: &[(String, String)], now: &str) -> String { |
| 38 | let mut result = String::from("# fetch-github-hosts begin\n"); |
| 39 | for (ip, domain) in hosts { |
| 40 | result.push_str(&format!("{:<28}{}\n", ip, domain)); |
| 41 | } |
| 42 | result.push_str(&format!("# last fetch time: {}\n", now)); |
| 43 | result.push_str("# update url: https://hosts.gitcdn.top/hosts.txt\n"); |
| 44 | result.push_str("# fetch-github-hosts end\n\n"); |
| 45 | result |
| 46 | } |
no outgoing calls
no test coverage detected