pub struct Client { /* private fields */ }Expand description
Client for the Tailscale Local API.
Connections are pooled and reused via hyper’s connection management. TCP port and auth token are discovered per-request (matching Go’s behavior), so the client adapts to daemon restarts and late starts.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new client with default transport settings.
Port and token are discovered per-request, so the client works even if the daemon isn’t running at creation time.
Sourcepub fn with_config(config: TransportConfig) -> Self
pub fn with_config(config: TransportConfig) -> Self
Create a new client with explicit transport configuration.
Source§impl Client
Local API methods.
impl Client
Local API methods.
Sourcepub async fn status_without_peers(&self) -> Result<Status, Error>
pub async fn status_without_peers(&self) -> Result<Status, Error>
Get the current tailscaled status without peer information.
Sourcepub async fn who_is(&self, remote_addr: &str) -> Result<WhoIsResponse, Error>
pub async fn who_is(&self, remote_addr: &str) -> Result<WhoIsResponse, Error>
Look up the owner of an IP address, IP:port, or node key.
Returns Error::PeerNotFound if the peer is not found (HTTP 404).
Sourcepub async fn who_is_node_key(
&self,
node_key: &str,
) -> Result<WhoIsResponse, Error>
pub async fn who_is_node_key( &self, node_key: &str, ) -> Result<WhoIsResponse, Error>
Look up a peer by node key.
Sourcepub async fn who_is_proto(
&self,
proto: &str,
remote_addr: &str,
) -> Result<WhoIsResponse, Error>
pub async fn who_is_proto( &self, proto: &str, remote_addr: &str, ) -> Result<WhoIsResponse, Error>
Look up the owner of an IP address with a specific protocol.
The proto parameter should be “tcp” or “udp”.
Sourcepub async fn cert_pair(&self, domain: &str) -> Result<(Vec<u8>, Vec<u8>), Error>
pub async fn cert_pair(&self, domain: &str) -> Result<(Vec<u8>, Vec<u8>), Error>
Get a TLS certificate and private key for the given domain. Returns (cert_pem, key_pem).
Sourcepub async fn cert_pair_with_validity(
&self,
domain: &str,
min_validity_secs: u64,
) -> Result<(Vec<u8>, Vec<u8>), Error>
pub async fn cert_pair_with_validity( &self, domain: &str, min_validity_secs: u64, ) -> Result<(Vec<u8>, Vec<u8>), Error>
Get a TLS certificate with minimum validity duration (in seconds). Returns (cert_pem, key_pem).
Sourcepub async fn get_serve_config(&self) -> Result<ServeConfig, Error>
pub async fn get_serve_config(&self) -> Result<ServeConfig, Error>
Get the current serve config.
The returned ServeConfig has its e_tag field populated from the
HTTP Etag response header.
Sourcepub async fn set_serve_config(&self, config: &ServeConfig) -> Result<(), Error>
pub async fn set_serve_config(&self, config: &ServeConfig) -> Result<(), Error>
Set the serve config.
The e_tag field on the config is sent as the If-Match header
for conditional updates.