From 3a6423d2baf7de74a42d4da29af375cd02e0c062 Mon Sep 17 00:00:00 2001 From: Vecna Date: Sun, 25 Feb 2024 17:42:30 -0500 Subject: [PATCH] Space things out for better readability --- src/extra_info.rs | 3 +++ src/lib.rs | 4 ++++ src/negative_report.rs | 4 ++++ src/positive_report.rs | 7 +++++++ 4 files changed, 18 insertions(+) diff --git a/src/extra_info.rs b/src/extra_info.rs index 421ef93..711d292 100644 --- a/src/extra_info.rs +++ b/src/extra_info.rs @@ -24,13 +24,16 @@ pub const DIRECTORY: &str = "extra_infos"; pub struct ExtraInfo { /// Bridge nickname, probably unused pub nickname: String, + /// Bridge fingerprint, a SHA-1 hash of the bridge ID pub fingerprint: [u8; 20], + /// Date (in UTC) that this document covered (bridge-stats-end if /// available) or that the document was published (published), stored /// as a Julian date because we don't need to know more precisely than /// the day. pub date: u32, + /// Map of country codes and how many users (rounded up to a multiple of /// 8) have connected to that bridge during the day. /// Uses BTreeMap instead of HashMap so ExtraInfo can implement Hash. diff --git a/src/lib.rs b/src/lib.rs index 3242c44..14ce1a0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -63,12 +63,16 @@ pub fn get_date() -> u32 { pub struct BridgeInfo { /// hashed fingerprint (SHA-1 hash of 20-byte bridge ID) pub fingerprint: [u8; 20], + /// nickname of bridge (probably not necessary) pub nickname: String, + /// first Julian date we started collecting data on this bridge pub first_seen: u32, + /// flag indicating whether the bridge is believed to be blocked pub is_blocked: bool, + /// map of dates to data for that day pub info_by_day: HashMap, } diff --git a/src/negative_report.rs b/src/negative_report.rs index a9eac38..50f4366 100644 --- a/src/negative_report.rs +++ b/src/negative_report.rs @@ -19,10 +19,13 @@ pub enum NegativeReportError { pub struct NegativeReport { /// hashed fingerprint (SHA-1 hash of 20-byte bridge ID) pub fingerprint: [u8; 20], + /// some way to prove knowledge of bridge bridge_pok: ProofOfBridgeKnowledge, + /// user's country code pub country: String, + /// today's Julian date pub date: u32, } @@ -140,6 +143,7 @@ impl SerializableNegativeReport { pub enum ProofOfBridgeKnowledge { /// Hash of bridge line as proof of knowledge of bridge line HashOfBridgeLine(HashOfBridgeLine), + /// Hash of bucket ID for Lox user HashOfBucket(HashOfBucket), } diff --git a/src/positive_report.rs b/src/positive_report.rs index ae01ad5..d01c41a 100644 --- a/src/positive_report.rs +++ b/src/positive_report.rs @@ -24,12 +24,16 @@ pub enum PositiveReportError { pub struct PositiveReport { /// hashed fingerprint (SHA-1 hash of 20-byte bridge ID) pub fingerprint: [u8; 20], + /// token from the bridge indicating it was reached bridge_token: Option, + // proof of Lox cred with level >= 3 and this bridge lox_proof: lox_pr::Request, + /// user's country code, may be an empty string pub country: String, + /// today's Julian date pub date: u32, } @@ -189,8 +193,10 @@ impl SerializablePositiveReport { pub struct UnsignedBridgeToken { /// hashed fingerprint (SHA-1 hash of 20-byte bridge ID) pub fingerprint: [u8; 20], + /// client's country code pub country: String, + /// today's Julian date pub date: u32, } @@ -259,6 +265,7 @@ impl SerializableUnsignedBridgeToken { pub struct BridgeToken { /// the unsigned version of this token pub unsigned_bridge_token: UnsignedBridgeToken, + /// signature from bridge's ed25519 key sig: Signature, }