|
@@ -18,10 +18,17 @@ use curve25519_dalek::ristretto::CompressedRistretto;
|
|
|
use curve25519_dalek::ristretto::RistrettoBasepointTable;
|
|
|
use curve25519_dalek::scalar::Scalar;
|
|
|
use rand::RngCore;
|
|
|
+use serde::{Serialize, Deserialize};
|
|
|
+use serde_big_array::big_array;
|
|
|
use std::collections::{HashMap, HashSet};
|
|
|
use std::convert::TryInto;
|
|
|
use subtle::ConstantTimeEq;
|
|
|
|
|
|
+big_array! {
|
|
|
+ BigArray;
|
|
|
+ +202,
|
|
|
+}
|
|
|
+
|
|
|
/// Each bridge information line is serialized into this many bytes
|
|
|
pub const BRIDGE_BYTES: usize = 220;
|
|
|
|
|
@@ -35,7 +42,7 @@ pub const MAX_BRIDGES_PER_BUCKET: usize = 3;
|
|
|
pub const MIN_BUCKET_REACHABILITY: usize = 2;
|
|
|
|
|
|
/// A bridge information line
|
|
|
-#[derive(Copy, Clone, Hash, Eq, PartialEq, Debug)]
|
|
|
+#[derive(Serialize, Deserialize, Copy, Clone, Hash, Eq, PartialEq, Debug)]
|
|
|
pub struct BridgeLine {
|
|
|
/// IPv4 or IPv6 address
|
|
|
pub addr: [u8; 16],
|
|
@@ -43,6 +50,7 @@ pub struct BridgeLine {
|
|
|
pub port: u16,
|
|
|
/// other protocol information, including pluggable transport,
|
|
|
/// public key, etc.
|
|
|
+ #[serde(with = "BigArray")]
|
|
|
pub info: [u8; BRIDGE_BYTES - 18],
|
|
|
}
|
|
|
|