From 3153385897e9560fde2d0ffa94c928fde528955e Mon Sep 17 00:00:00 2001 From: onyinyang Date: Thu, 9 Mar 2023 16:59:20 -0500 Subject: [PATCH] Add fields to BridgeLine --- crates/lox-library/src/bridge_table.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/lox-library/src/bridge_table.rs b/crates/lox-library/src/bridge_table.rs index aa64d98..b33af2c 100644 --- a/crates/lox-library/src/bridge_table.rs +++ b/crates/lox-library/src/bridge_table.rs @@ -36,16 +36,20 @@ pub const MAX_BRIDGES_PER_BUCKET: usize = 3; /// level 1) pub const MIN_BUCKET_REACHABILITY: usize = 2; + /// A bridge information line #[serde_as] -#[derive(Serialize, Deserialize, Copy, Clone, Hash, Eq, PartialEq, Debug)] +#[derive(Serialize, Deserialize, Clone, Copy, Hash, Eq, PartialEq, Debug)] pub struct BridgeLine { + /// pluggable transport protocol string as a byte array + pub pt_type: [u8; 25], /// IPv4 or IPv6 address pub addr: [u8; 16], /// port pub port: u16, - /// other protocol information, including pluggable transport, - /// public key, etc. + /// fingerprint as a byte array + pub fingerprint: [u8; 20], + /// other protocol information, including cert and iat mode #[serde_as(as = "[_; BRIDGE_BYTES - 18]")] pub info: [u8; BRIDGE_BYTES - 18], } @@ -68,8 +72,10 @@ impl Default for BridgeLine { /// An "empty" BridgeLine is represented by all zeros fn default() -> Self { Self { + pt_type: [0; 25], addr: [0; 16], port: 0, + fingerprint: [0; 20], info: [0; BRIDGE_BYTES - 18], } }