pub struct NameRecord {
pub name: String,
pub microvm_id: String,
pub endpoint: String,
pub agent_token: String,
pub region: String,
pub at: u64,
pub identity_host_seed: Option<String>,
pub identity_vm_public_key: Option<String>,
pub egress_posture: Option<String>,
}Expand description
One kept VM’s name, and everything an adopt needs to address it.
camelCase on the wire: this is the CLI registry’s on-disk format, read by later
versions, so fields are only ever added, and optional ones default when absent.
Fields§
§name: String§microvm_id: String§endpoint: String§agent_token: StringThe launch’s agent token: a bearer credential for the VM.
region: String§at: u64Seconds since the epoch when the name was registered.
identity_host_seed: Option<String>The launching host’s identity secret, base64, when run --identity generated one.
Persisted for the reason the agent token is: a later tunnel --verify-identity
needs it. It raises what a stolen record can do from “call the VM” to “call the VM
and impersonate the launching host to it”, which is the same trust domain.
identity_vm_public_key: Option<String>The VM’s public key, base64 — the pin --verify-identity checks the far end against.
egress_posture: Option<String>The egress posture label of the launch this name was registered for, when the
registering command launched the VM. None means unknown, never “open”.
Implementations§
Source§impl NameRecord
impl NameRecord
Sourcepub fn new_at(
name: impl Into<String>,
microvm_id: impl Into<String>,
endpoint: impl Into<String>,
agent_token: impl Into<String>,
region: impl Into<String>,
at: u64,
) -> Result<NameRecord, Error>
pub fn new_at( name: impl Into<String>, microvm_id: impl Into<String>, endpoint: impl Into<String>, agent_token: impl Into<String>, region: impl Into<String>, at: u64, ) -> Result<NameRecord, Error>
A record for a VM this process can already address, registered at seconds after the
Unix epoch.
Refuses an illegal name or an empty id, endpoint, or token: a record missing any of
them resolves to a VM nobody can adopt. The time is the caller’s, since this crate
doesn’t read the clock (ARCH-6); microvms_core::prelude::NameRecordExt::new stamps
the current time.
Sourcepub fn to_json(&self) -> Value
pub fn to_json(&self) -> Value
The record as JSON, secrets included — the form to store privately.
Sourcepub fn redacted_json(&self) -> Value
pub fn redacted_json(&self) -> Value
The record as JSON without its two secrets, the agent token and the identity host
seed: the form a listing prints, redacted as Debug redacts.
Built from the fields it keeps rather than by removing the secrets from
NameRecord::to_json, so a field added to the record stays out of every listing until
someone decides it can be shown.
Sourcepub fn from_json(value: Value) -> Result<NameRecord, Error>
pub fn from_json(value: Value) -> Result<NameRecord, Error>
A record from its JSON form, checked the way NameRecord::new_at checks.
Sourcepub fn tunnel_identity(&self) -> Result<Option<TunnelIdentity>, Error>
pub fn tunnel_identity(&self) -> Result<Option<TunnelIdentity>, Error>
The record’s tunnel identity, when it carries one.
Refuses a record holding one half of the pair, or a half that doesn’t decode, rather than reading it as unverifiable: the record claims a verifiable VM, and dropping the claim would hide that it’s broken.
Sourcepub fn set_tunnel_identity(&mut self, identity: Option<&TunnelIdentity>)
pub fn set_tunnel_identity(&mut self, identity: Option<&TunnelIdentity>)
Records identity’s pair, or clears it.
Trait Implementations§
Source§impl Clone for NameRecord
impl Clone for NameRecord
Source§fn clone(&self) -> NameRecord
fn clone(&self) -> NameRecord
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 NameRecord
Redacts the agent token and the identity seed: this type reaches logs through errors
and test output, and both values are credentials.
impl Debug for NameRecord
Redacts the agent token and the identity seed: this type reaches logs through errors and test output, and both values are credentials.
Source§impl<'de> Deserialize<'de> for NameRecord
impl<'de> Deserialize<'de> for NameRecord
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<NameRecord, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<NameRecord, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl NameRecordExt for NameRecord
impl NameRecordExt for NameRecord
Source§impl PartialEq for NameRecord
impl PartialEq for NameRecord
Source§impl Serialize for NameRecord
impl Serialize for NameRecord
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for NameRecord
Auto Trait Implementations§
impl Freeze for NameRecord
impl RefUnwindSafe for NameRecord
impl Send for NameRecord
impl Sync for NameRecord
impl Unpin for NameRecord
impl UnsafeUnpin for NameRecord
impl UnwindSafe for NameRecord
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more