pub struct LpdPeer {
pub info_hash: String,
pub port: u16,
pub addr: IpAddr,
pub last_seen: Instant,
pub token: Option<u32>,
}Expand description
Information about a peer discovered via LPD
Fields§
§info_hash: StringThe torrent info hash this peer is sharing
port: u16The peer’s listen port
addr: IpAddrThe peer’s IP address (from recv_from)
last_seen: InstantWhen this peer was last announced
token: Option<u32>Random token from the announcement (for anti-spoofing)
Implementations§
Source§impl LpdPeer
impl LpdPeer
Sourcepub fn with_token(
info_hash: impl Into<String>,
port: u16,
addr: IpAddr,
token: u32,
) -> Self
pub fn with_token( info_hash: impl Into<String>, port: u16, addr: IpAddr, token: u32, ) -> Self
Create with token
Sourcepub fn socket_addr(&self) -> SocketAddr
pub fn socket_addr(&self) -> SocketAddr
Get the peer’s address as SocketAddr
Sourcepub fn is_expired(&self, max_age: Duration) -> bool
pub fn is_expired(&self, max_age: Duration) -> bool
Check if this peer has expired based on age
Trait Implementations§
impl Eq for LpdPeer
Auto Trait Implementations§
impl Freeze for LpdPeer
impl RefUnwindSafe for LpdPeer
impl Send for LpdPeer
impl Sync for LpdPeer
impl Unpin for LpdPeer
impl UnsafeUnpin for LpdPeer
impl UnwindSafe for LpdPeer
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.