Trait cuprate_p2p_core::NetZoneAddress
source · pub trait NetZoneAddress: TryFrom<NetworkAddress, Error = NetworkAddressIncorrectZone> + Into<NetworkAddress> + Display + BorshSerialize + BorshDeserialize + Hash + Eq + Copy + Send + Sync + Unpin + 'static {
type BanID: Debug + Hash + Eq + Clone + Copy + Send + 'static;
// Required methods
fn set_port(&mut self, port: u16);
fn make_canonical(&mut self);
fn ban_id(&self) -> Self::BanID;
fn should_add_to_peer_list(&self) -> bool;
}Required Associated Types§
sourcetype BanID: Debug + Hash + Eq + Clone + Copy + Send + 'static
type BanID: Debug + Hash + Eq + Clone + Copy + Send + 'static
Cuprate needs to be able to ban peers by IP addresses and not just by SocketAddr as that include the port, to be able to facilitate this network addresses must have a ban ID which for hidden services could just be the address it self but for clear net addresses will be the IP address. TODO: IP zone banning?
Required Methods§
fn make_canonical(&mut self)
fn ban_id(&self) -> Self::BanID
fn should_add_to_peer_list(&self) -> bool
Object Safety§
This trait is not object safe.