Skip to main content

SoftwareVersionDetail

Enum SoftwareVersionDetail 

Source
pub enum SoftwareVersionDetail {
    Full,
    Minor,
    Off,
}
Expand description

How much of its own build a node reveals when it advertises (dig_ecosystem#2215).

Advertising an exact build is a fingerprinting aid — it tells an observer precisely which peers run a version with a publicly disclosed defect. This is the operator’s dial between that cost and the diagnostic value of knowing what the network is running.

It lives here, beside PeerSoftware, because rendering and parsing are two halves of one format: a node that hand-rolled its own product/version string would be re-implementing half the contract, and the two halves would drift. A node picks a mode; this type renders it.

Variants§

§

Full

Advertise the exact build, e.g. dig-node/0.99.1. The default: the diagnostic value is why the field exists, and an operator who disagrees opts down explicitly.

§

Minor

Advertise only the major and minor level, e.g. dig-node/0.99.0. Hides the patch level, and any pre-release or build metadata, while remaining READABLE at the far end.

§

Off

Advertise nothing. Indistinguishable from a peer built before this field existed, and reads as PeerSoftware::Unknown.

Implementations§

Source§

impl SoftwareVersionDetail

Source

pub fn render(self, product: &str, version: &Version) -> String

Render the advertisement a node with this setting puts on its handshake.

The result is ALWAYS either the empty string or a value PeerSoftware::parse reads back as Reported. Coarsening reduces PRECISION; it never produces a value that reads as Unknown while pretending to be a report. Two consequences follow, and both are tested:

  • Minor renders MAJOR.MINOR.0, never a bare MAJOR.MINOR — two-part versions are not valid semver, so that spelling would read as Unknown and become a second, confusing spelling of Off.
  • Minor of a 0.0.x build renders the EMPTY STRING, because its coarsening is version zero and version zero is the “unknown” sentinel. There is no coarser representable value, so it advertises nothing rather than advertising the sentinel as if it were a report.

A coarsened 1.4.0 is indistinguishable from a genuine 1.4.0. That is the point of coarsening, not a defect in it.

Trait Implementations§

Source§

impl Clone for SoftwareVersionDetail

Source§

fn clone(&self) -> SoftwareVersionDetail

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 Copy for SoftwareVersionDetail

Source§

impl Debug for SoftwareVersionDetail

Source§

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

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

impl Default for SoftwareVersionDetail

Source§

fn default() -> SoftwareVersionDetail

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SoftwareVersionDetail

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 Eq for SoftwareVersionDetail

Source§

impl PartialEq for SoftwareVersionDetail

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for SoftwareVersionDetail

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 StructuralPartialEq for SoftwareVersionDetail

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.