MCPcopy Create free account
hub / github.com/Licoy/fetch-github-hosts / format_hosts_text

Function format_hosts_text

src-tauri/src/dns.rs:37–46  ·  view source on GitHub ↗

Format hosts entries into a text string

(hosts: &[(String, String)], now: &str)

Source from the content-addressed store, hash-verified

35
36/// Format hosts entries into a text string
37pub 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}

Callers 1

server_fetch_hostsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected