pub trait NetZoneAddress:
TryFrom<NetworkAddress, Error = NetworkAddressIncorrectZone>
+ Into<NetworkAddress>
+ Display
+ 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;
}
Expand description
An address on a specific NetworkZone
.
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?
- TODO: rename this to Host.
Required Methods§
Sourcefn make_canonical(&mut self)
fn make_canonical(&mut self)
Turns this address into its canonical form.
Sourcefn ban_id(&self) -> Self::BanID
fn ban_id(&self) -> Self::BanID
Returns the Self::BanID
for this address.
fn should_add_to_peer_list(&self) -> bool
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.