Skip to main content

ControlRunner

Struct ControlRunner 

Source
pub struct ControlRunner { /* private fields */ }
Expand description

Actor responsible for maintaining the connection to control.

This actor is responsible for proxying the map response stream onto the message bus.

Implementations§

Source§

impl ControlRunner

Source

pub fn ipv4( &self, ctx: &mut Context<Self, DelegatedReply<Option<Ipv4Addr>>>, ) -> DelegatedReply<Option<Ipv4Addr>>

Fetch the IPv4 address for this tailscale device.

Source

pub fn ipv6( &self, ctx: &mut Context<Self, DelegatedReply<Option<Ipv6Addr>>>, ) -> DelegatedReply<Option<Ipv6Addr>>

Fetch the IPv6 address for this tailscale device.

Source

pub fn self_node( &self, ctx: &mut Context<Self, DelegatedReply<Option<Node>>>, ) -> DelegatedReply<Option<Node>>

Fetch the self node for this tailscale device.

Source

pub fn current_ssh_policy(&self) -> Option<SshPolicy>

Fetch the current Tailscale SSH policy, if control has pushed one.

Returns None when control has not sent an SSH policy (the SSH server treats this as deny-all — fail-closed). Unlike self_node this does not block waiting for a value: an absent policy is a legitimate, immediate answer.

Source

pub fn current_tka_status(&self) -> Option<TkaStatus>

Fetch the current Tailnet Lock status, if control has pushed one.

Returns None when control has sent no TKAInfo (tailnet lock not in use / no change seen).

Source

pub fn cert_domains(&self) -> Vec<String>

The cert-eligible DNS names from control’s netmap DNS config (Go nm.DNS.CertDomains).

Returns an empty Vec when control has sent no DNS config, or one carrying no cert domains (an empty list is a legitimate, immediate answer — like current_ssh_policy, this does not block waiting for a value).

Source

pub fn dns_config(&self) -> Option<DnsConfig>

The full DNS config from control’s netmap (Go netmap.NetworkMap.DNS), or None when control has sent no DNS config yet. An immediate answer (does not block); the facade surfaces this for Device::dns_config (the daemon’s tnet dns status).

Source

pub fn netcheck(&self) -> NetcheckReport

The latest network-conditions report (preferred DERP region + per-region latencies). An immediate answer (does not block); empty before the first DERP-latency measurement. The facade surfaces this for Device::netcheck (the daemon’s tnet netcheck).

Source

pub fn fetch_id_token( &self, ctx: &mut Context<Self, DelegatedReply<Result<String, IdTokenError>>>, audience: String, ) -> DelegatedReply<Result<String, IdTokenError>>

Request an OIDC ID token from control scoped to audience (workload-identity federation).

Opens a fresh Noise channel and POSTs /machine/id-token; returns the signed JWT or an IdTokenError. Runs on a spawned task (delegated reply) so the actor mailbox isn’t blocked for the round-trip.

Source

pub fn logout( &self, ctx: &mut Context<Self, DelegatedReply<Result<(), LogoutError>>>, ) -> DelegatedReply<Result<(), LogoutError>>

Log this node out of the tailnet: deregister it by expiring its current node key.

Mirrors fetch_id_token: clones the control config + node keys into a spawned task (delegated reply, so the round-trip doesn’t block the mailbox) and re-POSTs /machine/register with a past expiry over a fresh Noise channel. This is a control-plane state change only — it does NOT stop this actor or tear down the datapath (the caller follows up with the normal runtime shutdown), and it does not touch the on-disk node key, so re-registering with the same key is the re-login path.

Trait Implementations§

Source§

impl Actor for ControlRunner

Source§

type Args = Params

Arguments to initialize the actor. Read more
Source§

type Error = ControlRunnerError

Actor error type. Read more
Source§

async fn on_start( params: Params, slf: ActorRef<Self>, ) -> Result<Self, Self::Error>

Called when the actor starts, before it processes any messages. Read more
Source§

fn name() -> &'static str

The name of the actor, which can be useful for logging or debugging. Read more
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

Called when the actor receives a message to be processed. Read more
Source§

fn on_panic( &mut self, actor_ref: WeakActorRef<Self>, err: PanicError, ) -> impl Future<Output = Result<ControlFlow<ActorStopReason>, Self::Error>> + Send

Called when the actor encounters a panic or an error during “tell” message handling. Read more
Called when a linked actor dies. Read more
Source§

fn on_stop( &mut self, actor_ref: WeakActorRef<Self>, reason: ActorStopReason, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Called before the actor stops. Read more
Source§

fn next( &mut self, actor_ref: WeakActorRef<Self>, mailbox_rx: &mut MailboxReceiver<Self>, ) -> impl Future<Output = Option<Signal<Self>>> + Send

Awaits the next signal typically from the mailbox. Read more
Source§

impl Message<CertDomains> for ControlRunner

Source§

type Reply = Vec<String>

The reply sent back to the message caller.
Source§

async fn handle( &mut self, msg: CertDomains, _ctx: &mut Context<Self, Self::Reply>, ) -> Self::Reply

Handler for this message.
Source§

impl Message<CurrentSshPolicy> for ControlRunner

Source§

type Reply = Option<SshPolicy>

The reply sent back to the message caller.
Source§

async fn handle( &mut self, msg: CurrentSshPolicy, _ctx: &mut Context<Self, Self::Reply>, ) -> Self::Reply

Handler for this message.
Source§

impl Message<CurrentTkaStatus> for ControlRunner

Source§

type Reply = Option<TkaStatus>

The reply sent back to the message caller.
Source§

async fn handle( &mut self, msg: CurrentTkaStatus, _ctx: &mut Context<Self, Self::Reply>, ) -> Self::Reply

Handler for this message.
Source§

impl Message<DnsConfig> for ControlRunner

Source§

type Reply = Option<DnsConfig>

The reply sent back to the message caller.
Source§

async fn handle( &mut self, msg: DnsConfig, _ctx: &mut Context<Self, Self::Reply>, ) -> Self::Reply

Handler for this message.
Source§

impl Message<FetchIdToken> for ControlRunner

Source§

type Reply = DelegatedReply<Result<String, IdTokenError>>

The reply sent back to the message caller.
Source§

async fn handle( &mut self, msg: FetchIdToken, ctx: &mut Context<Self, Self::Reply>, ) -> Self::Reply

Handler for this message.
Source§

impl Message<Ipv4> for ControlRunner

Source§

type Reply = DelegatedReply<Option<Ipv4Addr>>

The reply sent back to the message caller.
Source§

async fn handle( &mut self, msg: Ipv4, ctx: &mut Context<Self, Self::Reply>, ) -> Self::Reply

Handler for this message.
Source§

impl Message<Ipv6> for ControlRunner

Source§

type Reply = DelegatedReply<Option<Ipv6Addr>>

The reply sent back to the message caller.
Source§

async fn handle( &mut self, msg: Ipv6, ctx: &mut Context<Self, Self::Reply>, ) -> Self::Reply

Handler for this message.
Source§

impl Message<Logout> for ControlRunner

Source§

type Reply = DelegatedReply<Result<(), LogoutError>>

The reply sent back to the message caller.
Source§

async fn handle( &mut self, msg: Logout, ctx: &mut Context<Self, Self::Reply>, ) -> Self::Reply

Handler for this message.
Source§

impl Message<Netcheck> for ControlRunner

Source§

type Reply = NetcheckReport

The reply sent back to the message caller.
Source§

async fn handle( &mut self, msg: Netcheck, _ctx: &mut Context<Self, Self::Reply>, ) -> Self::Reply

Handler for this message.
Source§

impl Message<SelfNode> for ControlRunner

Source§

type Reply = DelegatedReply<Option<Node>>

The reply sent back to the message caller.
Source§

async fn handle( &mut self, msg: SelfNode, ctx: &mut Context<Self, Self::Reply>, ) -> Self::Reply

Handler for this message.
Source§

impl Message<StreamMessage<Arc<StateUpdate>, (), ()>> for ControlRunner

Source§

type Reply = ()

The reply sent back to the message caller.
Source§

async fn handle( &mut self, msg: StreamMessage<Arc<StateUpdate>, (), ()>, ctx: &mut Context<Self, Self::Reply>, )

Handler for this message.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<A, T> DynMessage<A> for T
where A: Actor + Message<T>, T: Send + 'static,

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>>

Handles the dyn message with the provided actor state, ref, and reply sender.
Source§

fn as_any(self: Box<T>) -> Box<dyn Any>

Casts the type to a Box<dyn Any>.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<A> Spawn for A
where A: Actor,

Source§

fn spawn(args: Self::Args) -> ActorRef<Self>

Spawns the actor in a Tokio task, running asynchronously with a default bounded mailbox. Read more
Source§

fn spawn_default() -> ActorRef<Self>
where Self::Args: Default,

Spawns the actor with default initialization in a Tokio task. Read more
Source§

fn spawn_with_mailbox( args: Self::Args, _: (MailboxSender<Self>, MailboxReceiver<Self>), ) -> ActorRef<Self>

Spawns the actor in a Tokio task with a specific mailbox configuration. Read more
Spawns and links the actor in a Tokio task with a default bounded mailbox. Read more
Spawns and links the actor in a Tokio task with a specific mailbox configuration. Read more
Source§

fn spawn_in_thread(args: Self::Args) -> ActorRef<Self>

Spawns the actor in its own dedicated thread with a default bounded mailbox. Read more
Source§

fn spawn_in_thread_with_mailbox( args: Self::Args, _: (MailboxSender<Self>, MailboxReceiver<Self>), ) -> ActorRef<Self>

Spawns the actor in its own dedicated thread with a specific mailbox configuration. Read more
Source§

fn prepare() -> PreparedActor<Self>

Creates a new prepared actor, allowing access to its ActorRef before spawning. Read more
Source§

fn prepare_with_mailbox( _: (MailboxSender<Self>, MailboxReceiver<Self>), ) -> PreparedActor<Self>

Creates a new prepared actor with a specific mailbox configuration, allowing access to its ActorRef before spawning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more