1use std::net::SocketAddr;
2
3#[derive(Debug, Clone)]
5pub struct UdpConfig {
6 pub bind_addr: Option<SocketAddr>,
8
9 pub reuseaddr: Option<bool>,
11
12 pub broadcast: Option<bool>,
14
15 pub ttl: Option<u32>,
17
18 pub bind_device: Option<String>,
20}
21
22impl Default for UdpConfig {
23 fn default() -> Self {
24 Self {
25 bind_addr: None,
26 reuseaddr: None,
27 broadcast: None,
28 ttl: None,
29 bind_device: None,
30 }
31 }
32}
33
34#[cfg(test)]
35mod tests {
36 use super::*;
37
38 #[test]
39 fn udp_config_default_values() {
40 let cfg = UdpConfig::default();
41 assert!(cfg.bind_addr.is_none());
42 assert!(cfg.reuseaddr.is_none());
43 assert!(cfg.broadcast.is_none());
44 assert!(cfg.ttl.is_none());
45 assert!(cfg.bind_device.is_none());
46 }
47}