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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//! # Connection Metadata Management
//!
//! This module manages connection metadata for the Citadel Protocol, handling
//! connection information storage and protocol specifications for client-side
//! connections.
//!
//! ## Features
//!
//! * **Connection Information**
//! - Socket address storage
//! - Connection state persistence
//! - Connection display formatting
//!
//! * **Protocol Support**
//! - Ordered reliable connections (TCP / WebSocket)
//! - Ordered reliable secure with optional domain (TLS / WSS)
//! - P2P with optional domain (QUIC / WebRTC)
//!
//! * **Serialization**
//! - Serde compatibility
//! - Debug formatting
//! - Display implementation
//!
//! ## Usage Example
//!
//! ```rust
//! use citadel_user::connection_metadata::{ConnectionInfo, ConnectProtocol};
//! use std::net::{SocketAddr, IpAddr, Ipv4Addr};
//!
//! fn manage_connections() {
//! // Create connection info
//! let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080);
//! let connection = ConnectionInfo { addr };
//!
//! // Create different protocol types
//! let ordered = ConnectProtocol::OrderedReliable;
//! let secure = ConnectProtocol::OrderedReliableSecure(Some("example.com".to_string()));
//! let p2p = ConnectProtocol::P2P(Some("p2p.example.com".to_string()));
//!
//! // Get domain information
//! assert_eq!(ordered.get_domain(), None);
//! assert_eq!(secure.get_domain(), Some("example.com".to_string()));
//! assert_eq!(p2p.get_domain(), Some("p2p.example.com".to_string()));
//!
//! // Display connection info
//! println!("Connection: {}", connection);
//! }
//! ```
//!
//! ## Important Notes
//!
//! * Connection info is serializable for persistence
//! * Protocol types support optional domain names
//! * Ordered reliable connections don't use domain information
//! * Connection display shows socket address
//! * All types implement Clone and Debug
//!
//! ## Related Components
//!
//! * `ClientNetworkAccount` - Uses connection metadata
//! * `AccountManager` - Manages connection states
//! * `PersistenceHandler` - Stores connection info
//! * `citadel_wire` - Network communication
//!
use crateAccountError;
use ;
use ;
use SocketAddr;
/// For saving the state of client-side connections
/// For saving the state of client-side connections