1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use std::collections::BTreeSet;
use serde::Serialize;
use crate::core::ModuleKind;
use crate::encoding::{Decodable, Encodable};
use crate::util::SafeUrl;
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Encodable, Decodable, Serialize)]
/// Connection information sent between peers in order to start config gen
pub struct PeerSetupCode {
/// Name of the peer, used in TLS auth
pub name: String,
/// The peer's api and p2p endpoint
pub endpoints: PeerEndpoints,
/// Federation name set by the leader
pub federation_name: Option<String>,
/// Whether to disable base fees, set by the leader
pub disable_base_fees: Option<bool>,
/// Modules enabled by the leader (if None, all available modules are
/// enabled)
pub enabled_modules: Option<BTreeSet<ModuleKind>>,
/// Total number of guardians (including the one who sets this), set by the
/// leader
pub federation_size: Option<u32>,
}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Encodable, Decodable, Serialize)]
pub enum PeerEndpoints {
Tcp {
/// Url for our websocket api endpoint
api_url: SafeUrl,
/// Url for our websocket p2p endpoint
p2p_url: SafeUrl,
/// TLS certificate for our websocket p2p endpoint#
#[serde(with = "::fedimint_core::encoding::as_hex")]
cert: Vec<u8>,
},
Iroh {
/// Public key for our iroh api endpoint
api_pk: iroh_base::PublicKey,
/// Public key for our iroh p2p endpoint
p2p_pk: iroh_base::PublicKey,
},
}