pub struct Peer {
pub id: String,
pub name: String,
pub device_id: String,
pub device_name: String,
pub tailscale_id: String,
pub ip: IpAddr,
pub online: bool,
pub ws_connected: bool,
pub connection_type: String,
pub os: Option<String>,
pub last_seen: Option<String>,
}Expand description
A peer as seen by application code.
This is a simplified projection of the internal PeerState that hides
session-layer internals. Applications use this to display peer lists and
resolve peer IDs for send() / open_tcp().
RFC 017 introduced device_id and device_name derived from the hello
envelope — these are populated once the WebSocket link comes up. Before
that, they fall back to the legacy Tailscale ID / hostname pair so
application code has something to display even for not-yet-connected
peers.
Fields§
§id: StringLegacy per-peer ID. Kept for back-compat with call sites that
destructure peer.id; new code should prefer device_id
directly. Equal to device_id once the hello has landed; equal to
the Tailscale stable ID beforehand.
name: StringLegacy name (the Layer 3 Tailscale hostname — the slug). New code
should prefer device_name.
device_id: StringStable per-device ULID (RFC 017 §5.4) from the hello envelope. Falls back to the Tailscale stable ID until the hello handshake completes.
device_name: StringHuman-readable device name from the hello envelope (original Unicode form, NOT the slug). Falls back to the hostname until the hello completes.
tailscale_id: StringTailscale stable node ID — escape hatch for diagnostics and the transport routing key.
ip: IpAddrNetwork IP address.
online: boolWhether the peer is online (from Layer 3).
ws_connected: boolWhether there is an active WebSocket connection.
connection_type: StringConnection type description (e.g., "direct" or "relay:ord").
os: Option<String>Operating system, if known. Prefers the hello envelope’s value and falls back to Layer 3.
last_seen: Option<String>Last time the peer was seen online (RFC 3339 string).