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,
pub enrollment: Option<EnrollConfig>,
pub restreamer_node_listen: Option<SocketAddr>,
pub restreamer_drain_listen: Option<SocketAddr>,
/* private fields */
}Fields§
§api_listen: SocketAddr§control_endpoint: StringDeprecated (A2): kept for config compatibility. C2 no longer opens an operator control socket; core drains and parses g4a.
control_tunnel_listen: Option<SocketAddr>Deprecated (A2): ignored. Operator control is not accepted on C2.
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: C2Timings§enrollment: Option<EnrollConfig>Node enrollment (one-time code, neutral status, runtime node add). None keeps the
fixed --node set and token authentication only.
restreamer_node_listen: Option<SocketAddr>A2 restreamer: node multiplex uplink listen. Requires restreamer_drain_listen.
restreamer_drain_listen: Option<SocketAddr>A2 restreamer: core drain listen (C2 never dials core).
Implementations§
Source§impl C2Config
impl C2Config
Sourcepub fn with_enrollment(self, enrollment: EnrollConfig) -> Self
pub fn with_enrollment(self, enrollment: EnrollConfig) -> Self
Turn on enrollment. Requires a node-listen address (checked by validate_call_home).
pub fn new( api_listen: SocketAddr, api_token: impl Into<String>, nodes: Vec<C2NodeConfig>, ) -> Result<Self, C2ConfigError>
Sourcepub fn with_restreamer(
self,
node_listen: SocketAddr,
drain_listen: SocketAddr,
core_token: impl Into<String>,
) -> Result<Self, C2ConfigError>
pub fn with_restreamer( self, node_listen: SocketAddr, drain_listen: SocketAddr, core_token: impl Into<String>, ) -> Result<Self, C2ConfigError>
Enable the A2 byte restreamer (node uplink + core drain). C2 never dials core.
Sourcepub fn with_restreamer_wg(
self,
c2_tunnel_ip: IpAddr,
node_port: u16,
drain_port: u16,
core_token: impl Into<String>,
) -> Result<Self, C2ConfigError>
pub fn with_restreamer_wg( self, c2_tunnel_ip: IpAddr, node_port: u16, drain_port: u16, core_token: impl Into<String>, ) -> Result<Self, C2ConfigError>
Production restreamer: both listeners on the C2 WireGuard tunnel IP.
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
Sourcepub fn with_control_endpoint(
self,
endpoint: impl Into<String>,
) -> Result<Self, C2ConfigError>
pub fn with_control_endpoint( self, endpoint: impl Into<String>, ) -> Result<Self, C2ConfigError>
Deprecated (A2): records the path but C2 does not listen on it.
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.
Deprecated (A2): records the address but C2 does not listen on it.