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 moreSource§impl Debug for PeerConfig
impl Debug for PeerConfig
Source§impl<'de> Deserialize<'de> for PeerConfig
impl<'de> Deserialize<'de> for PeerConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for PeerConfig
impl RefUnwindSafe for PeerConfig
impl Send for PeerConfig
impl Sync for PeerConfig
impl Unpin for PeerConfig
impl UnsafeUnpin for PeerConfig
impl UnwindSafe for PeerConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FromBase64 for Twhere
T: for<'de> Deserialize<'de>,
impl<T> FromBase64 for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more