pub struct Peer {Show 18 fields
pub index: PeerIndex,
pub peer_status: PeerStatus,
pub block_fetch_url: String,
pub static_peer_config: Option<PeerConfig>,
pub challenge_for_peer: Option<SaitoHash>,
pub key_list: Vec<SaitoPublicKey>,
pub services: Vec<PeerService>,
pub last_msg_at: Timestamp,
pub disconnected_at: Timestamp,
pub wallet_version: Version,
pub core_version: Version,
pub key_list_limiter: RateLimiter,
pub handshake_limiter: RateLimiter,
pub message_limiter: RateLimiter,
pub invalid_block_limiter: RateLimiter,
pub public_key: Option<SaitoPublicKey>,
pub peer_type: PeerType,
pub ip_address: Option<String>,
}
Fields§
§index: PeerIndex
§peer_status: PeerStatus
§block_fetch_url: String
§static_peer_config: Option<PeerConfig>
§challenge_for_peer: Option<SaitoHash>
§key_list: Vec<SaitoPublicKey>
§services: Vec<PeerService>
§last_msg_at: Timestamp
§disconnected_at: Timestamp
§wallet_version: Version
§core_version: Version
§key_list_limiter: RateLimiter
§handshake_limiter: RateLimiter
§message_limiter: RateLimiter
§invalid_block_limiter: RateLimiter
§public_key: Option<SaitoPublicKey>
§peer_type: PeerType
§ip_address: Option<String>
Implementations§
Source§impl Peer
impl Peer
pub fn new(peer_index: PeerIndex) -> Peer
pub fn new_stun( peer_index: PeerIndex, public_key: SaitoPublicKey, io_handler: &(dyn InterfaceIO + Send + Sync), ) -> Peer
pub fn is_stun_peer(&self) -> bool
pub fn has_key_list_limit_exceeded(&mut self, current_time: Timestamp) -> bool
pub fn has_handshake_limit_exceeded(&mut self, current_time: Timestamp) -> bool
pub fn has_message_limit_exceeded(&mut self, current_time: Timestamp) -> bool
pub fn has_invalid_block_limit_exceeded( &mut self, current_time: Timestamp, ) -> bool
pub fn get_limited_till(&mut self, current_time: Timestamp) -> Option<Timestamp>
pub fn get_url(&self) -> String
pub async fn initiate_handshake( &mut self, io_handler: &(dyn InterfaceIO + Send + Sync), ) -> Result<(), Error>
pub async fn handle_handshake_challenge( &mut self, challenge: HandshakeChallenge, io_handler: &(dyn InterfaceIO + Send + Sync), wallet_lock: Arc<RwLock<Wallet>>, configs_lock: Arc<RwLock<dyn Configuration + Send + Sync>>, ) -> Result<(), Error>
pub async fn handle_handshake_response( &mut self, response: HandshakeResponse, io_handler: &(dyn InterfaceIO + Send + Sync), wallet_lock: Arc<RwLock<Wallet>>, configs_lock: Arc<RwLock<dyn Configuration + Send + Sync>>, current_time: Timestamp, ) -> Result<(), Error>
Sourcepub fn get_block_fetch_url(
&self,
block_hash: SaitoHash,
lite: bool,
my_public_key: SaitoPublicKey,
) -> String
pub fn get_block_fetch_url( &self, block_hash: SaitoHash, lite: bool, my_public_key: SaitoPublicKey, ) -> String
pub async fn send_ping( &mut self, current_time: Timestamp, io_handler: &(dyn InterfaceIO + Send + Sync), )
pub fn has_service(&self, service: String) -> bool
pub fn compare_version(&self, version: &Version) -> Option<Ordering>
pub fn is_static_peer(&self) -> bool
pub fn get_public_key(&self) -> Option<SaitoPublicKey>
pub fn mark_as_disconnected(&mut self, disconnected_at: Timestamp)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Peer
impl RefUnwindSafe for Peer
impl Send for Peer
impl Sync for Peer
impl Unpin for Peer
impl UnwindSafe for Peer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more