commit 74749801d59e0251b1888d80cd3f9a5279c8473d Author: David Goulet dgoulet@torproject.org Date: Wed Aug 11 09:25:44 2021 -0400
Format in both tor.git and arti have changed a bit
Signed-off-by: David Goulet dgoulet@torproject.org --- src/main.rs | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/src/main.rs b/src/main.rs index ad9e165..c1802c2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,12 +12,13 @@ use tor_netdoc::doc::netstatus::RouterFlags;
mod onionoo;
+// Header format from dir-list-spec.txt but static so Stem is happy about it. In the future, we +// want to stop doing that. static HEADER_COMMENT: &'static str = -"// AUTOGENERATED. DON'T EDIT THIS FILE -// -// List of directories on the Tor network where we think we can -// download directory info. We only use this list when we haven't yet -// downloaded our first directory."; +"/* type=fallback */ +/* version=4.0.0 */ +/* timestamp=20210412000000 */ +/* source=offer-list */";
fn write_file_tor_git(writer: &mut BufWriter<&File>, relay: &tor_netdir::Relay) -> Result<()> { let ipv4: Vec<_> = relay @@ -30,25 +31,20 @@ fn write_file_tor_git(writer: &mut BufWriter<&File>, relay: &tor_netdir::Relay) .orport_addrs() .filter(|sa| sa.is_ipv6()) .collect(); - let mut ipv6_str: String = "".to_string(); - if !ipv6.is_empty() { - ipv6_str = format!(" ipv6={}", ipv6[0]); - } - writeln!(writer, "// Nickname: {} */", relay.rs().nickname())?; writeln!( writer, - ""{} orport={}{}"", + ""{} orport={} id={}"", ipv4[0].ip(), ipv4[0].port(), - ipv6_str - )?; - writeln!( - writer, - "" id={}"", relay.rsa_id().to_string().to_uppercase().replace("$", "") )?; - writeln!(writer, "" ed={}",", relay.md().ed25519_id().to_string())?; - writeln!(writer, "")?; + if !ipv6.is_empty() { + writeln!(writer, "" ipv6={}"", ipv6[0])?; + } + writeln!(writer, "/* nickname={} */", relay.rs().nickname())?; + writeln!(writer, "/* extrainfo=0 */")?; + writeln!(writer, "/* ===== */")?; + writeln!(writer, ",")?; Ok(()) }
@@ -65,7 +61,7 @@ fn write_file_tor_arti(writer: &mut BufWriter<&File>, relay: &tor_netdir::Relay) " "{}",", relay.md().ed25519_id().to_string() )?; - writeln!(writer, " vec![")?; + writeln!(writer, " &[")?; writeln!( writer, "{: <12}{}", "",
tor-commits@lists.torproject.org