tycho_core/overlay_client/
config.rs1use std::time::Duration;
2
3use serde::{Deserialize, Serialize};
4use tycho_util::serde_helpers;
5
6#[derive(Default, Debug, Clone, Serialize, Deserialize)]
7#[serde(default)]
8#[non_exhaustive]
9pub struct PublicOverlayClientConfig {
10 pub neighbors: NeighborsConfig,
12 pub validators: ValidatorsConfig,
14}
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
17#[serde(default)]
18pub struct NeighborsConfig {
19 #[serde(with = "serde_helpers::humantime")]
23 pub update_interval: Duration,
24
25 #[serde(with = "serde_helpers::humantime")]
29 pub ping_interval: Duration,
30
31 #[serde(with = "serde_helpers::humantime")]
35 pub apply_score_interval: Duration,
36
37 pub keep: usize,
41
42 pub max_ping_tasks: usize,
46
47 #[serde(with = "serde_helpers::humantime")]
51 pub default_roundtrip: Duration,
52
53 #[serde(with = "serde_helpers::humantime")]
57 pub send_timeout: Duration,
58
59 #[serde(with = "serde_helpers::humantime")]
63 pub query_timeout: Duration,
64}
65
66impl Default for NeighborsConfig {
67 fn default() -> Self {
68 Self {
69 update_interval: Duration::from_secs(2 * 60),
70 ping_interval: Duration::from_secs(30),
71 apply_score_interval: Duration::from_secs(10),
72 keep: 5,
73 max_ping_tasks: 5,
74 default_roundtrip: Duration::from_millis(300),
75 send_timeout: Duration::from_millis(500),
76 query_timeout: Duration::from_secs(1),
77 }
78 }
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(default)]
83pub struct ValidatorsConfig {
84 #[serde(with = "serde_helpers::humantime")]
88 pub ping_interval: Duration,
89
90 #[serde(with = "serde_helpers::humantime")]
94 pub ping_timeout: Duration,
95
96 pub keep: usize,
100
101 pub max_ping_tasks: usize,
105
106 #[serde(with = "serde_helpers::humantime")]
110 pub send_timeout: Duration,
111}
112
113impl Default for ValidatorsConfig {
114 fn default() -> Self {
115 Self {
116 ping_interval: Duration::from_secs(60),
117 ping_timeout: Duration::from_secs(1),
118 keep: 5,
119 max_ping_tasks: 5,
120 send_timeout: Duration::from_millis(500),
121 }
122 }
123}