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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! Node Type Configuration for Network Topology
//!
//! This module defines the network node types and their behaviors in the Citadel
//! Protocol. It supports both traditional client-server and peer-to-peer network
//! topologies.
//!
//! # Features
//!
//! - Server configuration with static IP addresses
//! - Peer configuration for residential NAT environments
//! - Automatic UPnP handling for peer nodes
//! - Fallback to NAT traversal when UPnP is unavailable
//!
//! # Examples
//!
//! ```rust
//! use citadel_wire::hypernode_type::NodeType;
//! use std::net::SocketAddr;
//!
//! // Configure a server with static IP
//! let addr: SocketAddr = "127.0.0.1:8080".parse().unwrap();
//! let server = NodeType::server(addr).unwrap();
//! assert!(server.is_server());
//!
//! // Configure a peer node (residential NAT)
//! let peer = NodeType::default();
//! assert!(peer.is_peer());
//! ```
//!
//! # Important Notes
//!
//! - Server nodes must have stable, reachable IP addresses
//! - Peer nodes automatically attempt UPnP port forwarding
//! - Fallback to NAT traversal for symmetric NATs
//! - Socket addresses are validated during construction
//!
//! # Related Components
//!
//! - [`crate::udp_traversal`] - NAT traversal functionality
//! - [`crate::standard::upnp_handler`] - UPnP port forwarding
//! - [`crate::standard::socket_helpers`] - Socket utilities
//!
use ;
/// Used for determining the proper action when loading the server