pub struct RemotePairing {
pub ticket: String,
pub api_key: String,
pub default_model: Option<String>,
pub port: Option<u16>,
}Expand description
The machine gglib remote join paired with, and the key that machine
issued — one record, because they are one fact.
They were two settings rows, remote_last_ticket and remote_api_key,
written independently by the same call. A key is issued by the machine
whose one-time code was redeemed, so it means nothing apart from the
ticket that names that machine: a bare-ticket dial to a second machine
rewrote the ticket and left the first machine’s key sitting beside it,
and gglib remote status then reported a fully paired connection whose
every request came back 401. Holding the two in one record makes that
disagreement unrepresentable rather than merely wrong, and gives the
stale-key question — whose key is this? — an answer.
Written only by gglib remote join: there is no CLI flag and no GUI
control, and gglib config settings show reports the key as held-or-not
rather than printing it.
Persisted as one settings_kv row holding a JSON object, the way
inference_defaults is — camelCase inside, to match it and so that the
CLI’s kebab-casing of nested keys reads remote-pairing.api-key.
Fields§
§ticket: StringThe ticket that machine handed out, in its canonical form.
An address rather than a credential — reaching the far side still
takes Self::api_key. It used to go stale every time that machine
ran enable, because each one minted a fresh identity; identities
last now, so a ticket stays good across the far machine’s restarts
and a device pairs once. A later dial to the same machine at a new
address still replaces this and keeps the key, which is what makes
the ticket the mutable half.
api_key: StringThat machine’s API key: its proxy_api_key, received by redeeming
its one-time pairing code through the tunnel.
Not optional, deliberately. A record that could hold a ticket with no key is the shape the desync above lived in — the half-write that lost the binding. A dial to a machine this one holds no key for is refused before it is made, so there is no state left for such a record to describe.
default_model: Option<String>The model a --remote turn is for when the command line names none:
the one this machine last asked that machine for.
Remembered rather than configured — there is no flag and no setting
to type it into — because the alternative was naming the model on
every turn, and the model a person asks a machine for is the one
they asked it for last time. Per pairing, not global: it is a name
in that machine’s catalogue, and it goes with the record when the
pairing does. #[serde(default)] so a record written before the
field existed loads as nothing remembered yet.
port: Option<u16>The loopback port the paired machine was last reachable at here, tried first next time so the address a client was configured against stays the address.
Stable rather than fixed: a port can be taken by something else
between two sessions, and connect then binds the next free one,
says so, and remembers that. --port pins it, and is remembered
the same way. #[serde(default)] for the reason the field above
gives.
Trait Implementations§
Source§impl Clone for RemotePairing
impl Clone for RemotePairing
Source§fn clone(&self) -> RemotePairing
fn clone(&self) -> RemotePairing
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RemotePairing
impl Debug for RemotePairing
Source§impl<'de> Deserialize<'de> for RemotePairing
impl<'de> Deserialize<'de> for RemotePairing
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for RemotePairing
impl PartialEq for RemotePairing
Source§fn eq(&self, other: &RemotePairing) -> bool
fn eq(&self, other: &RemotePairing) -> bool
self and other values to be equal, and is used by ==.