pub struct PeerConfig {
pub node_id: String,
pub public_key: String,
pub endpoint: String,
pub overlay_ip: IpAddr,
pub keepalive: Option<u16>,
pub hostname: Option<String>,
pub slice_cidr: Option<IpNet>,
}Expand description
Peer configuration for overlay network
Fields§
§node_id: StringPeer’s node ID (for identification)
public_key: StringPeer’s overlay public key
endpoint: StringPeer’s public endpoint (host:port)
overlay_ip: IpAddrPeer’s overlay IP address (IPv4 or IPv6)
keepalive: Option<u16>Optional persistent keepalive interval in seconds
hostname: Option<String>Optional custom DNS hostname for this peer (without zone suffix) If provided, the peer will be registered with this name in addition to the auto-generated IP-based hostname.
slice_cidr: Option<IpNet>Peer’s per-node slice CIDR. None on old configs; when set, used as
the peer’s allowed_ips instead of overlay_ip/32.
Implementations§
Source§impl PeerConfig
impl PeerConfig
Sourcepub fn new(
node_id: String,
public_key: String,
endpoint: String,
overlay_ip: IpAddr,
) -> Self
pub fn new( node_id: String, public_key: String, endpoint: String, overlay_ip: IpAddr, ) -> Self
Create a new peer configuration
Sourcepub fn with_hostname(self, hostname: impl Into<String>) -> Self
pub fn with_hostname(self, hostname: impl Into<String>) -> Self
Set a custom DNS hostname for this peer
Sourcepub fn with_slice_cidr(self, cidr: IpNet) -> Self
pub fn with_slice_cidr(self, cidr: IpNet) -> Self
Set the per-node slice CIDR for this peer.
When set, to_peer_info() uses the slice CIDR as the peer’s
allowed_ips (so the overlay accepts the peer’s full slice of
container IPs) instead of the legacy single-host overlay_ip/32.
Sourcepub fn to_peer_info(&self) -> Result<PeerInfo, Box<dyn Error>>
pub fn to_peer_info(&self) -> Result<PeerInfo, Box<dyn Error>>
Convert to PeerInfo for overlay transport configuration
When slice_cidr is set, the peer’s allowed_ips is the slice CIDR
string. Otherwise, falls back to the legacy overlay_ip/{32,128}
host-prefix representation for back-compat.
§Errors
Returns an error if the endpoint address cannot be parsed.
Trait Implementations§
Source§impl Clone for PeerConfig
impl Clone for PeerConfig
Source§fn clone(&self) -> PeerConfig
fn clone(&self) -> PeerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more