pub struct PeerTracker { /* private fields */ }Expand description
Actor that tracks peer delta updates and emits new states.
Implementations§
Source§impl PeerTracker
impl PeerTracker
Sourcepub async fn peer_by_name(
&mut self,
ctx: &mut Context<Self, DelegatedReply<Option<Node>>>,
name: String,
) -> DelegatedReply<Option<Node>>
pub async fn peer_by_name( &mut self, ctx: &mut Context<Self, DelegatedReply<Option<Node>>>, name: String, ) -> DelegatedReply<Option<Node>>
Lookup a peer by name.
Waits until we’ve received at least one peer update from control.
Sourcepub fn peer_by_accepted_route(
&mut self,
ctx: &mut Context<Self, DelegatedReply<Vec<Node>>>,
ip: IpAddr,
) -> DelegatedReply<Vec<Node>>
pub fn peer_by_accepted_route( &mut self, ctx: &mut Context<Self, DelegatedReply<Vec<Node>>>, ip: IpAddr, ) -> DelegatedReply<Vec<Node>>
Lookup all peers that accept packets addressed to the given IP.
This includes the peer’s tailnet address and any subnet routes it provides. Only
the peers with the most specific subnet route match that covers ip will be
returned.
E.g., suppose:
- We’re querying for
10.1.2.3 PeerAandPeerBhave accepted routes for10.1.2.0/24PeerChas an accepted route for10.1.0.0/16
Only PeerA and PeerB will be returned, since they have the most specific
prefix match.
Sourcepub fn peer_by_tailnet_ip(
&mut self,
ctx: &mut Context<Self, DelegatedReply<Option<Node>>>,
ip: IpAddr,
) -> DelegatedReply<Option<Node>>
pub fn peer_by_tailnet_ip( &mut self, ctx: &mut Context<Self, DelegatedReply<Option<Node>>>, ip: IpAddr, ) -> DelegatedReply<Option<Node>>
Lookup the peer that has the given tailnet IP address.
Sourcepub fn get_status(
&mut self,
ctx: &mut Context<Self, DelegatedReply<Vec<StatusNode>>>,
) -> DelegatedReply<Vec<StatusNode>>
pub fn get_status( &mut self, ctx: &mut Context<Self, DelegatedReply<Vec<StatusNode>>>, ) -> DelegatedReply<Vec<StatusNode>>
Build the peer entries of a Status snapshot.
Returns one StatusNode per known peer. The self node is not included here (it
lives in the control runner); Runtime::status combines both.
Waits until we’ve received at least one peer update from control.
Sourcepub fn whois(
&mut self,
ctx: &mut Context<Self, DelegatedReply<Option<WhoIs>>>,
addr: SocketAddr,
) -> DelegatedReply<Option<WhoIs>>
pub fn whois( &mut self, ctx: &mut Context<Self, DelegatedReply<Option<WhoIs>>>, addr: SocketAddr, ) -> DelegatedReply<Option<WhoIs>>
Resolve which node owns a tailnet source address.
Maps the source IP of addr to the owning node via the tailnet-IP index, returning a
WhoIs. The port is ignored (a tailnet IP uniquely identifies a node).
The resulting WhoIs carries no user/login or capability data: this
fork’s domain Node does not retain those wire fields. See the
status module docs for the gap.
Waits until we’ve received at least one peer update from control.
Sourcepub fn watch_netmap(&self) -> Receiver<Vec<StatusNode>>
pub fn watch_netmap(&self) -> Receiver<Vec<StatusNode>>
Subscribe to netmap peer-change events.
Returns a watch::Receiver whose value is the current set of peer
StatusNodes, updated on every netmap state update from control. Embedders can await
changes via watch::Receiver::changed to react to peers joining, leaving, or changing.
The receiver’s initial value is the peer set at subscription time (empty before the
first netmap update). This is a peer-only view; combine with the self node from
Runtime::status when a full snapshot is needed.
Trait Implementations§
Source§impl Actor for PeerTracker
impl Actor for PeerTracker
Source§async fn on_start(
env: Self::Args,
slf: ActorRef<Self>,
) -> Result<Self, Self::Error>
async fn on_start( env: Self::Args, slf: ActorRef<Self>, ) -> Result<Self, Self::Error>
Source§fn name() -> &'static str
fn name() -> &'static str
Source§fn on_message(
&mut self,
msg: Box<dyn DynMessage<Self>>,
actor_ref: ActorRef<Self>,
tx: Option<Sender<Result<Box<dyn Any + Send>, SendError<Box<dyn Any + Send>, Box<dyn Any + Send>>>>>,
stop: &mut bool,
) -> impl Future<Output = Result<(), Box<dyn ReplyError>>> + Send
fn on_message( &mut self, msg: Box<dyn DynMessage<Self>>, actor_ref: ActorRef<Self>, tx: Option<Sender<Result<Box<dyn Any + Send>, SendError<Box<dyn Any + Send>, Box<dyn Any + Send>>>>>, stop: &mut bool, ) -> impl Future<Output = Result<(), Box<dyn ReplyError>>> + Send
Source§fn on_panic(
&mut self,
actor_ref: WeakActorRef<Self>,
err: PanicError,
) -> impl Future<Output = Result<ControlFlow<ActorStopReason>, Self::Error>> + Send
fn on_panic( &mut self, actor_ref: WeakActorRef<Self>, err: PanicError, ) -> impl Future<Output = Result<ControlFlow<ActorStopReason>, Self::Error>> + Send
Source§fn on_link_died(
&mut self,
actor_ref: WeakActorRef<Self>,
id: ActorId,
reason: ActorStopReason,
) -> impl Future<Output = Result<ControlFlow<ActorStopReason>, Self::Error>> + Send
fn on_link_died( &mut self, actor_ref: WeakActorRef<Self>, id: ActorId, reason: ActorStopReason, ) -> impl Future<Output = Result<ControlFlow<ActorStopReason>, Self::Error>> + Send
Source§fn on_stop(
&mut self,
actor_ref: WeakActorRef<Self>,
reason: ActorStopReason,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn on_stop( &mut self, actor_ref: WeakActorRef<Self>, reason: ActorStopReason, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn next(
&mut self,
actor_ref: WeakActorRef<Self>,
mailbox_rx: &mut MailboxReceiver<Self>,
) -> impl Future<Output = Option<Signal<Self>>> + Send
fn next( &mut self, actor_ref: WeakActorRef<Self>, mailbox_rx: &mut MailboxReceiver<Self>, ) -> impl Future<Output = Option<Signal<Self>>> + Send
Source§impl Message<Arc<StateUpdate>> for PeerTracker
impl Message<Arc<StateUpdate>> for PeerTracker
Source§impl Message<GetStatus> for PeerTracker
impl Message<GetStatus> for PeerTracker
Source§impl Message<PeerByAcceptedRoute> for PeerTracker
impl Message<PeerByAcceptedRoute> for PeerTracker
Source§impl Message<PeerByName> for PeerTracker
impl Message<PeerByName> for PeerTracker
Source§impl Message<PeerByTailnetIp> for PeerTracker
impl Message<PeerByTailnetIp> for PeerTracker
Source§impl Message<RepublishState> for PeerTracker
impl Message<RepublishState> for PeerTracker
Source§impl Message<WatchNetmap> for PeerTracker
impl Message<WatchNetmap> for PeerTracker
Auto Trait Implementations§
impl !RefUnwindSafe for PeerTracker
impl !UnwindSafe for PeerTracker
impl Freeze for PeerTracker
impl Send for PeerTracker
impl Sync for PeerTracker
impl Unpin for PeerTracker
impl UnsafeUnpin for PeerTracker
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<A, T> DynMessage<A> for T
impl<A, T> DynMessage<A> for T
Source§fn handle_dyn<'a>(
self: Box<T>,
state: &'a mut A,
actor_ref: ActorRef<A>,
tx: Option<Sender<Result<Box<dyn Any + Send>, SendError<Box<dyn Any + Send>, Box<dyn Any + Send>>>>>,
stop: &'a mut bool,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn ReplyError>>> + Send + 'a>>
fn handle_dyn<'a>( self: Box<T>, state: &'a mut A, actor_ref: ActorRef<A>, tx: Option<Sender<Result<Box<dyn Any + Send>, SendError<Box<dyn Any + Send>, Box<dyn Any + Send>>>>>, stop: &'a mut bool, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn ReplyError>>> + Send + 'a>>
impl<T> ErasedDestructor for Twhere
T: 'static,
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>
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>
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