Skip to main content

pim_core/config/
peer.rs

1//! Statically configured peer targets.
2
3use serde::{Deserialize, Serialize};
4
5/// A statically configured peer target.
6#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
7pub struct PeerConfig {
8    /// Optional human-readable label.
9    #[serde(default)]
10    pub label: String,
11    /// Connection mechanism and endpoint details for this peer.
12    #[serde(flatten)]
13    pub endpoint: PeerEndpointConfig,
14}
15
16/// Mechanism-specific peer connection settings.
17#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
18#[serde(tag = "mechanism", rename_all = "snake_case")]
19pub enum PeerEndpointConfig {
20    /// A directly reachable transport endpoint.
21    Tcp {
22        /// TCP address to connect to, e.g. "192.168.1.1:9100".
23        address: String,
24    },
25    /// A peer expected to be reachable over a Bluetooth PAN link.
26    Bluetooth {
27        /// IPv4 or IPv6 address reachable on the Bluetooth PAN interface.
28        ip: String,
29    },
30}