pub struct AsyncControlClient { /* private fields */ }Expand description
A client to communicate with control.
Implementations§
Source§impl AsyncControlClient
impl AsyncControlClient
Sourcepub async fn check_auth(
config: &Config,
node_keys: &NodeState,
auth_key: Option<&str>,
) -> Result<(), Error>
pub async fn check_auth( config: &Config, node_keys: &NodeState, auth_key: Option<&str>, ) -> Result<(), Error>
Check whether it is possible to login with the given config, node keys, and auth key.
Sourcepub async fn connect(
config: &Config,
node_keys: &NodeState,
auth_key: Option<&str>,
auth_url_tx: Sender<Option<Url>>,
) -> Result<(Self, impl Stream<Item = Arc<StateUpdate>> + Send + Sync + use<>), Error>
pub async fn connect( config: &Config, node_keys: &NodeState, auth_key: Option<&str>, auth_url_tx: Sender<Option<Url>>, ) -> Result<(Self, impl Stream<Item = Arc<StateUpdate>> + Send + Sync + use<>), Error>
Connects to the control plane, registers this Tailscale node, and starts handling the message stream from control.
The second element of the return value is a netmap stream which started listening before the client connected, i.e. it will not miss any updates from control.
auth_url_tx is the embedder-owned “current pending re-auth URL” cell: if the live
map-poll loop hits a mid-session re-auth (control returns
MachineNotAuthorized on a re-register because the
node key expired or was revoked), run publishes that URL here without tearing the loop
down, so the embedder can prompt the user to re-authorize while registration keeps retrying.
The caller creates the channel and keeps the Receiver (this crate must
not depend on the embedder’s device-state types, so the cell carries a bare Option<Url>).
Sourcepub async fn set_home_region<'c>(
&mut self,
region_id: RegionId,
latencies: impl IntoIterator<Item = (&'c str, f64)>,
)
pub async fn set_home_region<'c>( &mut self, region_id: RegionId, latencies: impl IntoIterator<Item = (&'c str, f64)>, )
Set the DERP home region for this node.
Sourcepub async fn set_endpoints(&mut self, endpoints: Vec<Endpoint>)
pub async fn set_endpoints(&mut self, endpoints: Vec<Endpoint>)
Advertise this node’s magicsock UDP endpoints (ip:port candidates) to the control server so peers can learn where to attempt direct connections.
Sourcepub async fn set_routable_ips(&mut self, routes: Vec<IpNet>)
pub async fn set_routable_ips(&mut self, routes: Vec<IpNet>)
Re-advertise this node’s routable IP prefixes (Hostinfo.RoutableIPs) to control mid-session
— the wire half of a runtime set_advertise_routes. routes is the final advertised set
(already filtered); it is sent on the live map-poll connection without tearing down the
long-poll, exactly like set_endpoints.
Sourcepub async fn set_hostname(&mut self, hostname: String)
pub async fn set_hostname(&mut self, hostname: String)
Update this node’s Hostinfo.Hostname to hostname at control mid-session — the wire half of
a runtime set_hostname. Sent on the live map-poll connection without tearing down the
long-poll, exactly like set_routable_ips.
Sourcepub fn netmap_stream(
&self,
) -> impl Stream<Item = Arc<StateUpdate>> + Send + Sync + use<>
pub fn netmap_stream( &self, ) -> impl Stream<Item = Arc<StateUpdate>> + Send + Sync + use<>
Get a stream of all netmap updates.