pub struct C2Config {
pub api_listen: SocketAddr,
pub control_endpoint: String,
pub control_tunnel_listen: Option<SocketAddr>,
pub nodes: Vec<C2NodeConfig>,
pub node_listen: Option<SocketAddr>,
pub timings: C2Timings,
/* private fields */
}Fields§
§api_listen: SocketAddr§control_endpoint: String§control_tunnel_listen: Option<SocketAddr>Optional TCP control accept bound to the C2 tunnel address.
The unix control_endpoint listener is always started as well.
nodes: Vec<C2NodeConfig>§node_listen: Option<SocketAddr>Where nodes that cannot be dialled come to announce themselves.
None unless at least one node is configured accept.
timings: C2TimingsImplementations§
Source§impl C2Config
impl C2Config
pub fn new( api_listen: SocketAddr, api_token: impl Into<String>, nodes: Vec<C2NodeConfig>, ) -> Result<Self, C2ConfigError>
Sourcepub fn with_node_listen(
self,
node_listen: SocketAddr,
) -> Result<Self, C2ConfigError>
pub fn with_node_listen( self, node_listen: SocketAddr, ) -> Result<Self, C2ConfigError>
Binds the address nodes call in on.
Loopback, or one concrete C2 WireGuard tunnel address (same rule as
Self::with_control_tunnel_listen). The node wire authenticates both
ends but encrypts nothing, so 0.0.0.0 and other unspecified binds are
refused: off-tunnel plaintext would expose terminal contents. When the
listen address is the C2 tunnel IP, kernel WireGuard encrypts the path
and either side may dial.
Sourcepub fn validate_call_home(&self) -> Result<(), C2ConfigError>
pub fn validate_call_home(&self) -> Result<(), C2ConfigError>
Every node that waits to be called needs somewhere to call, so a config that asks for one without the other is refused rather than started into a relay that can never reach that node. Checked at startup, not at connect time, because the failure is total and permanent – there is nothing to retry.
pub fn with_timings(self, timings: C2Timings) -> Self
pub fn with_control_endpoint( self, endpoint: impl Into<String>, ) -> Result<Self, C2ConfigError>
Sourcepub fn with_control_tunnel_listen(
self,
listen: SocketAddr,
) -> Result<Self, C2ConfigError>
pub fn with_control_tunnel_listen( self, listen: SocketAddr, ) -> Result<Self, C2ConfigError>
TCP door for an HQ WireGuard client. Bound to one concrete address
(the address on the C2 tunnel), never 0.0.0.0 or port 0. Does not
replace the unix control listener.