pub mod addr_manager;
pub mod ban_list;
mod peer_store_db;
mod peer_store_impl;
pub mod types;
pub(crate) use crate::Behaviour;
pub use crate::SessionType;
use p2p::multiaddr::Multiaddr;
pub(crate) use peer_store_impl::required_flags_filter;
pub use peer_store_impl::PeerStore;
pub(crate) const ADDR_COUNT_LIMIT: usize = 16384;
const ADDR_TIMEOUT_MS: u64 = 7 * 24 * 3600 * 1000;
pub(crate) const ADDR_TRY_TIMEOUT_MS: u64 = 3 * 24 * 3600 * 1000;
pub(crate) const DIAL_INTERVAL: u64 = 15 * 1000;
const ADDR_MAX_RETRIES: u32 = 3;
const ADDR_MAX_FAILURES: u32 = 10;
pub type Score = i32;
#[derive(Copy, Clone, Debug)]
pub struct PeerScoreConfig {
pub default_score: Score,
pub ban_score: Score,
pub ban_timeout_ms: u64,
}
impl Default for PeerScoreConfig {
fn default() -> Self {
PeerScoreConfig {
default_score: 100,
ban_score: 40,
ban_timeout_ms: 24 * 3600 * 1000, }
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum Status {
Connected,
Disconnected,
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum ReportResult {
Ok,
Banned,
}
impl ReportResult {
pub fn is_banned(self) -> bool {
self == ReportResult::Banned
}
pub fn is_ok(self) -> bool {
self == ReportResult::Ok
}
}