pub enum SourceClass {
Operator {
host: String,
port: u16,
},
Relay {
host: String,
},
Public {
host: String,
},
PeerV4 {
a: u8,
b: u8,
},
PeerV6 {
h0: u16,
h1: u16,
},
}Expand description
The grammar Reading::source follows (SPEC.md §7.2). Each variant is one independence
class; two readings whose classes render the SAME string are the same class and cannot
corroborate each other.
Variants§
Operator
A server the operator configured (a DIG_STUN_SERVER entry). Each configured endpoint is
its own class — the operator vouched for it specifically.
Fields
Relay
The DIG relay’s co-located STUN server. One class per relay host.
Public
A third-party public STUN host (stun.l.google.com, stun.cloudflare.com, …). One class
per host — they are different operators.
PeerV4
A DIG peer answering over IPv4 (SPEC.md §6). One class per IPv4 /16 — the SAME partition
dig_gossip::util::ip_address::subnet_group uses, so a consumer already holding that group
key renders the identical class from the same IP.
Fields
PeerV6
A DIG peer answering over IPv6. One class per IPv6 /32.
Implementations§
Source§impl SourceClass
impl SourceClass
Sourcepub fn operator(host: impl Into<String>, port: u16) -> Self
pub fn operator(host: impl Into<String>, port: u16) -> Self
The class for a server the operator configured.
Sourcepub fn relay(host: impl Into<String>) -> Self
pub fn relay(host: impl Into<String>) -> Self
The class for the DIG relay’s co-located STUN server.
Sourcepub fn peer(ip: IpAddr) -> Self
pub fn peer(ip: IpAddr) -> Self
The class for a DIG peer, from the peer’s TRANSPORT address ip. ip is folded per
SPEC.md §5.3 (fold_ip) before its leading bytes are taken, so a mapped or compat IPv6
peer renders the same class as its plain-IPv4 twin. A consumer that already computed
dig_gossip::util::ip_address::subnet_group(ip) for the same ip lands in the same
partition (SPEC.md §7.2) — this crate does not, and must not, re-implement that function.
Trait Implementations§
Source§impl Clone for SourceClass
impl Clone for SourceClass
Source§fn clone(&self) -> SourceClass
fn clone(&self) -> SourceClass
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more