Struct enr::Enr

source · []
pub struct Enr<K: EnrKey> { /* private fields */ }
Expand description

The ENR, allowing for arbitrary signing algorithms.

This struct will always have a valid signature, known public key type, sequence number and NodeId. All other parameters are variable/optional.

Implementations

The NodeId for the record.

The current sequence number of the ENR record.

Reads a custom key from the record if it exists.

Reads a custom key from the record if it exists as raw RLP bytes.

Returns an iterator over all key/value pairs in the ENR.

Returns the IPv4 address of the ENR record if it is defined.

Returns the IPv6 address of the ENR record if it is defined.

The id of ENR record if it is defined.

The TCP port of ENR record if it is defined.

The IPv6-specific TCP port of ENR record if it is defined.

The UDP port of ENR record if it is defined.

The IPv6-specific UDP port of ENR record if it is defined.

Provides a socket (based on the UDP port), if the IPv4 and UDP fields are specified.

Provides a socket (based on the UDP port), if the IPv6 and UDP fields are specified.

Provides a socket (based on the TCP port), if the IP and TCP fields are specified.

Provides a socket (based on the TCP port), if the IPv6 and TCP6 fields are specified.

The signature of the ENR record.

Returns the public key of the ENR record.

Verify the signature of the ENR record.

Provides the URL-safe base64 encoded “text” version of the ENR prefixed by “enr:”.

Returns the current size of the ENR.

Allows setting the sequence number to an arbitrary value.

Adds or modifies a key/value to the ENR record. A EnrKey is required to re-sign the record once modified.

Returns the previous value as rlp encoded bytes in the record if it exists.

Adds or modifies a key/value to the ENR record. A EnrKey is required to re-sign the record once modified. The value here is interpreted as raw RLP data.

Returns the previous value as rlp encoded bytes in the record if it exists.

Sets the ip field of the ENR. Returns any pre-existing IP address in the record.

Sets the udp field of the ENR. Returns any pre-existing UDP port in the record.

Sets the udp6 field of the ENR. Returns any pre-existing UDP port in the record.

Sets the tcp field of the ENR. Returns any pre-existing tcp port in the record.

Sets the tcp6 field of the ENR. Returns any pre-existing tcp6 port in the record.

Sets the IP and UDP port in a single update with a single increment in sequence number.

Sets the IP and TCP port in a single update with a single increment in sequence number.

Removes key/value mappings and adds or overwrites key/value mappings to the ENR record as one sequence number update. An EnrKey is required to re-sign the record once modified. Reverts whole ENR record on error.

Returns the previous values as rlp encoded bytes if they exist for the removed and added/ overwritten keys.

Sets a new public key for the record.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Decode a value from RLP bytes
Deserialize this value from the given Serde deserializer. Read more
Formats the value using the given formatter. Read more
Append a value to the stream
Get rlp-encoded bytes for this instance
Converts to this type from the input type.
Converts to this type from the input type.

Convert a URL-SAFE base64 encoded ENR into an ENR.

The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.