hopr_transport_protocol/
config.rs

1use hopr_primitive_types::prelude::HoprBalance;
2use serde::{Deserialize, Serialize};
3use serde_with::{DisplayFromStr, serde_as};
4use validator::Validate;
5
6/// Configuration of the P2P protocols.
7#[serde_as]
8#[derive(Debug, smart_default::SmartDefault, Serialize, Deserialize, Validate, Copy, Clone, PartialEq)]
9#[serde(deny_unknown_fields)]
10pub struct ProtocolConfig {
11    /// Winning probability that gets printed on any outgoing tickets.
12    /// If not set, the network value is used.
13    #[validate(range(min = 0.0, max = 1.0))]
14    pub outgoing_ticket_winning_prob: Option<f64>,
15    #[serde_as(as = "Option<DisplayFromStr>")]
16    /// Possible override of the network outgoing ticket price.
17    pub outgoing_ticket_price: Option<HoprBalance>,
18    /// auto-nat server port
19    #[serde(default)]
20    pub autonat_port: Option<u16>,
21}