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
impl TailscaleProvider
Sourcepub fn new(config: TailscaleConfig) -> Self
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
impl TailscaleProvider
Sourcepub async fn local_identity_async(&self) -> NodeIdentity
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.
Sourcepub async fn local_addr_async(&self) -> PeerAddr
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
impl NetworkProvider for TailscaleProvider
Source§async fn stop(&self) -> Result<(), NetworkError>
async fn stop(&self) -> Result<(), NetworkError>
Stop the network provider and clean up all resources.
Source§fn local_identity(&self) -> NodeIdentity
fn local_identity(&self) -> NodeIdentity
Local node’s identity (stable ID, hostname, display name). Read more
Source§fn local_addr(&self) -> PeerAddr
fn local_addr(&self) -> PeerAddr
Local node’s network address. Read more
Source§fn peer_events(&self) -> Receiver<NetworkPeerEvent>
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>
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>
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>
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>
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 listen_tcp_opts(
&self,
port: u16,
opts: ListenOpts,
) -> Result<NetworkTcpListener, NetworkError>
async fn listen_tcp_opts( &self, port: u16, opts: ListenOpts, ) -> Result<NetworkTcpListener, NetworkError>
As
listen_tcp, with options (RFC 023 §7.1). Read moreSource§async fn unlisten_tcp(&self, port: u16) -> Result<(), NetworkError>
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>
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>
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
async fn health(&self) -> HealthInfo
Node health info (key expiry, connection quality, warnings).
Source§fn proxy_runtime_errors(&self) -> Option<Receiver<ProxyRuntimeError>>
fn proxy_runtime_errors(&self) -> Option<Receiver<ProxyRuntimeError>>
Subscribe to runtime proxy-engine errors (RFC 023 G5).
None for
providers without a proxy engine — the caller then skips spawning a
forwarding task.Source§async fn proxy_add(
&self,
config: ProxyAddParams,
) -> Result<ProxyAddResult, NetworkError>
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>
async fn proxy_remove(&self, id: &str) -> Result<(), NetworkError>
Stop a reverse proxy.
Source§async fn proxy_list(&self) -> Result<Vec<ProxyListEntry>, NetworkError>
async fn proxy_list(&self) -> Result<Vec<ProxyListEntry>, NetworkError>
List active reverse proxies.
Auto Trait Implementations§
impl !RefUnwindSafe for TailscaleProvider
impl !UnwindSafe for TailscaleProvider
impl Freeze for TailscaleProvider
impl Send for TailscaleProvider
impl Sync for TailscaleProvider
impl Unpin for TailscaleProvider
impl UnsafeUnpin for TailscaleProvider
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
Mutably borrows from an owned value. Read more