Skip to main content

RemotePairing

Struct RemotePairing 

Source
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: String

The 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: String

That 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

Source§

fn clone(&self) -> RemotePairing

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RemotePairing

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RemotePairing

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for RemotePairing

Source§

fn eq(&self, other: &RemotePairing) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for RemotePairing

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for RemotePairing

Source§

impl StructuralPartialEq for RemotePairing

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,