Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
rsnet
Rust bindings for Tailscale's libtailscale C library. Embed a Tailscale node directly into your Rust process — get an IP on your tailnet entirely from userspace, no system daemon required.
Fully async (tokio). Streams implement AsyncRead + AsyncWrite + Unpin.
Prerequisites
- Go (to compile libtailscale from the git submodule)
- Rust stable (edition 2021+)
- A Tailscale auth key
git clone --recurse-submodules https://github.com/wowjeeez/rsnet.git
Quick start
let mut server = new?;
server.set_auth_key?;
server.set_dir?;
server.up?;
let listener = server.listen?;
loop
TLS
Go handles TLS + ACME certs natively — no rustls needed:
let listener = server.listen_native_tls?;
let stream = listener.accept.await?; // already decrypted
Services
Multi-port Tailscale Services with a builder pattern:
let mut svc = server.service
.https
.http
.tcp
.bind?;
println!;
loop
Note: services require a tagged auth key (create in admin console with e.g. tag:service).
LocalAPI
Typed access to Tailscale's node-local HTTP API:
let client = server.local_client?;
let me = client.whoami.await?;
let domain = client.fqdn.await?;
let status = client.status.await?;
let who = client.whois.await?;
let prefs = client.prefs.await?;
let = client.cert_pair.await?;
client.advertise_exit_node.await?;
client.advertise_routes.await?;
client.set_tags.await?;
let = client.get.await?;
Stream API
TailscaleStream mirrors tokio::TcpStream:
let stream = listener.accept.await?;
stream.peer_addr // Option<&str>
stream.local_port // Option<u16>
stream.readable.await?; // wait for readable
stream.writable.await?; // wait for writable
stream.try_read?; // non-blocking
stream.try_write?; // non-blocking
// async read/write via AsyncReadExt/AsyncWriteExt
stream.read_exact.await?;
stream.write_all.await?;
// split for bidirectional
let = split;
Examples
# plain HTTP on port 80
# HTTPS with native TLS on port 443
# multi-port service (requires tagged auth key)
Logging
Go-side logs are piped through tracing at debug level with target libtailscale:
RUST_LOG=libtailscale=debug cargo run --example hello -- ...
State persistence
Set a state directory to avoid re-authentication on every restart:
server.set_dir?;
Without this, libtailscale uses a default path keyed by binary name. Combined with set_ephemeral(true), the node is deleted from your tailnet when the process exits and needs re-auth next run.