关系:Server -> Peers -> Peer -> PeerInfo
Server
/// P2P server implementation, handling bootstrapping to find and connect to
/// peers, receiving connections from other peers and keep track of all of them.
pub struct Server {
pub config: P2PConfig,
capabilities: Capabilities,
handshake: Arc<Handshake>,
pub peers: Arc<Peers>,
stop: Arc<AtomicBool>,
pause: Arc<AtomicBool>,
}
P2PConfig
/// Configuration for the peer-to-peer server.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct P2PConfig {
pub host: IpAddr,
pub port: u16,
pub peers_allow: Option<Vec<String>>,
pub peers_deny: Option<Vec<String>>,
pub ban_window: Option<i64>,
pub peer_max_count: Option<u32>,
pub peer_min_preferred_count: Option<u32>,
}