Skip to main content

TailscaleProvider

Struct TailscaleProvider 

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

Tailscale network provider implementing NetworkProvider.

Wraps the Go sidecar (tsnet) and local TCP bridge to provide:

  • Peer discovery via WatchIPNBus events
  • Raw TCP dial/listen over encrypted Tailscale tunnels
  • Network-level ping and health monitoring

All bridge internals (pending_dials, session tokens, binary headers) are completely hidden. Callers interact only with plain TcpStreams and high-level types.

Implementations§

Source§

impl TailscaleProvider

Source

pub fn new(config: TailscaleConfig) -> Self

Create a new TailscaleProvider with the given configuration.

Does not start the provider — call start() to begin.

Source§

impl TailscaleProvider

Source

pub async fn local_identity_async(&self) -> NodeIdentity

Get the local identity (convenience alias — same as the trait method).

Retained for backwards compatibility with existing callers that used the old async version.

Source

pub async fn local_addr_async(&self) -> PeerAddr

Get the local address (convenience alias — same as the trait method).

Retained for backwards compatibility with existing callers that used the old async version.

Trait Implementations§

Source§

impl NetworkProvider for TailscaleProvider

Source§

async fn start(&mut self) -> Result<(), NetworkError>

Start the network provider. Read more
Source§

async fn stop(&self) -> Result<(), NetworkError>

Stop the network provider and clean up all resources.
Source§

fn local_identity(&self) -> NodeIdentity

Local node’s identity (stable ID, hostname, display name). Read more
Source§

fn local_addr(&self) -> PeerAddr

Local node’s network address. Read more
Source§

fn peer_events(&self) -> Receiver<NetworkPeerEvent>

Subscribe to peer events. Fires immediately when peers join/leave/update. Read more
Source§

async fn peers(&self) -> Vec<NetworkPeer>

Snapshot of all currently known peers.
Source§

async fn dial_tcp( &self, addr: &str, port: u16, ) -> Result<TcpStream, NetworkError>

Dial a TCP connection to a peer via the encrypted Tailscale tunnel. Read more
Source§

async fn dial_tcp_opts( &self, addr: &str, port: u16, opts: DialOpts, ) -> Result<TcpStream, NetworkError>

Dial a TCP connection with explicit options (e.g. a TLS override). Read more
Source§

async fn listen_tcp( &self, port: u16, ) -> Result<NetworkTcpListener, NetworkError>

Listen for incoming TCP connections on a port via the Tailscale tunnel. Read more
Source§

async fn unlisten_tcp(&self, port: u16) -> Result<(), NetworkError>

Stop listening on a previously opened port.
Source§

async fn ping(&self, addr: &str) -> Result<PingResult, NetworkError>

Ping a peer via the network layer (Tailscale TSMP).
Source§

async fn bind_udp(&self, port: u16) -> Result<NetworkUdpSocket, NetworkError>

Bind a UDP socket on a port via the network tunnel. Read more
Source§

async fn health(&self) -> HealthInfo

Node health info (key expiry, connection quality, warnings).
Source§

async fn proxy_add( &self, config: ProxyAddParams, ) -> Result<ProxyAddResult, NetworkError>

Start a reverse proxy. Only supported by providers with sidecar integration.
Source§

async fn proxy_remove(&self, id: &str) -> Result<(), NetworkError>

Stop a reverse proxy.
Source§

async fn proxy_list(&self) -> Result<Vec<ProxyListEntry>, NetworkError>

List active reverse proxies.

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> 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> Same for T

Source§

type Output = T

Should always be Self
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