@@ -93,15 +93,19 @@ pub struct FeatureBatching {
9393}
9494
9595/// Configurable features for Wireguard peers
96- #[ derive( Clone , Debug , Default , PartialEq , Eq , Serialize , Deserialize ) ]
96+ #[ derive( Clone , Debug , SmartDefault , PartialEq , Eq , Serialize , Deserialize ) ]
9797#[ cfg_attr( test, derive( proptest_derive:: Arbitrary ) ) ]
98+ #[ serde( default ) ]
9899pub struct FeatureWireguard {
99100 /// Configurable persistent keepalive periods for wireguard peers
100101 #[ serde( default ) ]
101102 pub persistent_keepalive : FeaturePersistentKeepalive ,
102103 /// Configurable wireguard polling period
103104 #[ serde( default ) ]
104105 pub polling : FeaturePolling ,
106+ /// Configurable Wireguard health monitor
107+ #[ serde( default ) ]
108+ pub health_monitoring : FeatureHealthMonitoring ,
105109 /// Configurable up/down behavior of WireGuard-NT adapter. See RFC LLT-0089 for details
106110 #[ serde( default ) ]
107111 pub enable_dynamic_wg_nt_control : bool ,
@@ -148,6 +152,19 @@ pub struct FeaturePersistentKeepalive {
148152 pub stun : Option < u32 > ,
149153}
150154
155+ /// Configurable Wireguard health monitor
156+ #[ derive( Copy , Clone , Debug , PartialEq , Eq , Serialize , Deserialize , SmartDefault ) ]
157+ #[ serde( default ) ]
158+ #[ cfg_attr( test, derive( proptest_derive:: Arbitrary ) ) ]
159+ pub struct FeatureHealthMonitoring {
160+ /// Minimum interval between two UAPI errors required before escalating to a critical error (in seconds) [default 10s]
161+ #[ default( 10 ) ]
162+ pub failure_escalation_min_interval_secs : u32 ,
163+ /// Maximum acceptable gap between consecutive UAPI polls before suspecting system suspension (in seconds) [default 60s]
164+ #[ default( 60 ) ]
165+ pub expected_max_uapi_poll_interval : u32 ,
166+ }
167+
151168/// Configurable Wireguard polling period
152169#[ derive( Clone , Debug , PartialEq , Eq , Serialize , Deserialize , SmartDefault ) ]
153170#[ serde( default ) ]
@@ -698,6 +715,10 @@ mod tests {
698715 "wireguard_polling_period": 1000,
699716 "wireguard_polling_period_after_state_change": 50
700717 },
718+ "health_monitoring": {
719+ "failure_escalation_min_interval_secs": 44,
720+ "expected_max_uapi_poll_interval": 55
721+ },
701722 "enable_dynamic_wg_nt_control": true,
702723 "skt_buffer_size": 123456,
703724 "inter_thread_channel_size": 123456,
@@ -801,6 +822,10 @@ mod tests {
801822 wireguard_polling_period: 1000 ,
802823 wireguard_polling_period_after_state_change: 50
803824 } ,
825+ health_monitoring: FeatureHealthMonitoring {
826+ failure_escalation_min_interval_secs: 44 ,
827+ expected_max_uapi_poll_interval: 55
828+ } ,
804829 enable_dynamic_wg_nt_control: true ,
805830 skt_buffer_size: Some ( 123456 ) ,
806831 inter_thread_channel_size: Some ( 123456 ) ,
0 commit comments