pub struct Peer {
pub peer_id: PeerId,
pub peer_addr: SocketAddr,
pub updated: DurationSinceUnixEpoch,
pub uploaded: NumberOfBytes,
pub downloaded: NumberOfBytes,
pub left: NumberOfBytes,
pub event: AnnounceEvent,
}Expand description
Peer struct used by the core Tracker.
A sample peer:
use aquatic_udp_protocol::{AnnounceEvent, NumberOfBytes, PeerId};
use torrust_tracker_primitives::peer;
use std::net::SocketAddr;
use std::net::IpAddr;
use std::net::Ipv4Addr;
use torrust_tracker_primitives::DurationSinceUnixEpoch;
peer::Peer {
peer_id: PeerId(*b"-qB00000000000000000"),
peer_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(126, 0, 0, 1)), 8080),
updated: DurationSinceUnixEpoch::new(1_669_397_478_934, 0),
uploaded: NumberOfBytes::new(0),
downloaded: NumberOfBytes::new(0),
left: NumberOfBytes::new(0),
event: AnnounceEvent::Started,
};Fields§
§peer_id: PeerIdID used by the downloader peer
peer_addr: SocketAddrThe IP and port this peer is listening on
updated: DurationSinceUnixEpochThe last time the the tracker receive an announce request from this peer (timestamp)
uploaded: NumberOfBytesThe total amount of bytes uploaded by this peer so far
downloaded: NumberOfBytesThe total amount of bytes downloaded by this peer so far
left: NumberOfBytesThe number of bytes this peer still has to download
event: AnnounceEventThis is an optional key which maps to started, completed, or stopped (or empty, which is the same as not being present).
Implementations§
Trait Implementations§
Source§impl Ord for Peer
impl Ord for Peer
Source§impl PartialOrd for Peer
impl PartialOrd for Peer
Source§impl ReadInfo for Peer
impl ReadInfo for Peer
fn is_seeder(&self) -> bool
fn get_event(&self) -> AnnounceEvent
fn get_id(&self) -> PeerId
fn get_updated(&self) -> DurationSinceUnixEpoch
fn get_address(&self) -> SocketAddr
impl Copy for Peer
impl Eq for Peer
impl StructuralPartialEq for Peer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more