pub struct Device {
pub node_id: String,
pub name: String,
pub hostname: String,
pub addresses: Vec<String>,
pub tags: Vec<String>,
}Expand description
One device, in the fields anything outside the device tools needs of it.
The control plane’s device object is large and mostly irrelevant here: what resolution and completion both want is the set of names a person might use for a machine, and the identifier the API will actually take in exchange.
Fields§
§node_id: StringWhat the control plane accepts, and what resolution answers with.
name: StringThe MagicDNS name, fully qualified.
hostname: StringThe machine’s own name for itself, which need not be unique.
addresses: Vec<String>Every Tailscale address it answers on.
The tags it wears, tag: prefix included. Read from the device rather
than from the policy file because a tag nothing wears and a tag in use
are different questions, and completion wants both answered.
Implementations§
Source§impl Device
impl Device
Sourcepub fn short_name(&self) -> &str
pub fn short_name(&self) -> &str
The label before the first dot of the MagicDNS name.
laptop.example-tailnet.ts.net is what a listing prints and laptop is
what a person types, so both have to name the same device.
Sourcepub fn answers_to(&self, lowercased: &str) -> bool
pub fn answers_to(&self, lowercased: &str) -> bool
Whether an already-lowercased value is one of this device’s names.
Exact against each field rather than a prefix: this decides which device a caller meant, and a value that merely begins like a name is not an answer to that. Completion matches loosely; addressing does not.