#[repr(i32)]pub enum K2WireType {
Unspecified = 0,
Preflight = 1,
Notify = 2,
Module = 3,
Disconnect = 15,
}Expand description
Enumeration of the types of messages that can be sent between peers.
We are using this enum field to distinguish between top-level messages, rather than protobuf’s oneof because of the downsides of upgrading oneofs.
Variants§
Unspecified = 0
The “UNSPECIFIED” type for future message types.
In general, peers should ignore unspecified messages, but should still count them toward any ratelimiting metrics.
Preflight = 1
This message is preflight data.
The implementor is responsible for encoding any module-specific requirements within the data payload of this message type. For example, if peers are required to include the “dht_v1” module to communicate with each other, they should reject preflight to peers that do not include that module.
Notify = 2
This is a notification or fire-and-forget message from a peer.
This type requires that a “space” be specified.
Module = 3
This is a module communication.
Most of Kitsune2’s communications will likely proceed between Kitsune2’s modules.
This type requires that a “space” be specified. This type requires that a “module” be specified.
Disconnect = 15
This message indicates a general disconnect, with the reason or context specified in the data payload.
We may add additional specific disconnect codes in the future.
Implementations§
Source§impl K2WireType
impl K2WireType
Source§impl K2WireType
impl K2WireType
Sourcepub fn as_str_name(&self) -> &'static str
pub fn as_str_name(&self) -> &'static str
String value of the enum field names used in the ProtoBuf definition.
The values are not transformed in any way and thus are considered stable (if the ProtoBuf definition does not change) and safe for programmatic use.
Sourcepub fn from_str_name(value: &str) -> Option<Self>
pub fn from_str_name(value: &str) -> Option<Self>
Creates an enum from field names used in the ProtoBuf definition.
Trait Implementations§
Source§impl Clone for K2WireType
impl Clone for K2WireType
Source§fn clone(&self) -> K2WireType
fn clone(&self) -> K2WireType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more