pub struct GeoRouter { /* private fields */ }Expand description
Geographic router for proximity-based peer selection
Implementations§
Source§impl GeoRouter
impl GeoRouter
Sourcepub fn new(config: GeoRouterConfig) -> Self
pub fn new(config: GeoRouterConfig) -> Self
Create a new geographic router
Sourcepub fn update_peer_location(&self, peer_id: PeerId, location: GeoLocation)
pub fn update_peer_location(&self, peer_id: PeerId, location: GeoLocation)
Update or add a peer’s location
Sourcepub fn remove_peer(&self, peer_id: &PeerId)
pub fn remove_peer(&self, peer_id: &PeerId)
Remove a peer’s location
Sourcepub fn get_peer_location(&self, peer_id: &PeerId) -> Option<GeoLocation>
pub fn get_peer_location(&self, peer_id: &PeerId) -> Option<GeoLocation>
Get location for a peer
Sourcepub fn get_peers_in_region(&self, region: GeoRegion) -> Vec<PeerId>
pub fn get_peers_in_region(&self, region: GeoRegion) -> Vec<PeerId>
Get all peers in a region
Sourcepub fn rank_peers_by_proximity(&self, reference: &GeoLocation) -> Vec<GeoPeer>
pub fn rank_peers_by_proximity(&self, reference: &GeoLocation) -> Vec<GeoPeer>
Rank all known peers by proximity to a location
Sourcepub fn get_nearby_peers(&self, reference: &GeoLocation) -> Vec<GeoPeer>
pub fn get_nearby_peers(&self, reference: &GeoLocation) -> Vec<GeoPeer>
Get nearby peers within threshold distance
Sourcepub fn estimate_ip_location(&self, _ip: IpAddr) -> Option<GeoLocation>
pub fn estimate_ip_location(&self, _ip: IpAddr) -> Option<GeoLocation>
Estimate IP location using simple heuristics (placeholder)
In production, this would use a GeoIP database like MaxMind GeoLite2
Sourcepub fn stats(&self) -> GeoRouterStats
pub fn stats(&self) -> GeoRouterStats
Get statistics
Auto Trait Implementations§
impl Freeze for GeoRouter
impl !RefUnwindSafe for GeoRouter
impl Send for GeoRouter
impl Sync for GeoRouter
impl Unpin for GeoRouter
impl !UnwindSafe for GeoRouter
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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