Space things out for better readability

This commit is contained in:
Vecna 2024-02-25 17:42:30 -05:00
parent cde22fef67
commit 3a6423d2ba
4 changed files with 18 additions and 0 deletions

View File

@ -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.

View File

@ -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<u32, DailyBridgeInfo>,
}

View File

@ -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),
}

View File

@ -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<BridgeToken>,
// 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,
}