Skip to main content

Crate hatchery_c2_client

Crate hatchery_c2_client 

Source
Expand description

Bounded typed HTTP/1.1 client for the local Gate4Agent C2 observer API.

Structs§

C2Client
C2ControlHandle
C2EventReceiver
C2PendingRequest
C2ReconnectingEventReceiver
The event stream for a reconnecting connection. Backed by two bridge channels created once, before the first physical connection, that only close when the supervisor itself terminates – a reconnect is invisible to it. The two channels mirror the split C2EventReceiver already carries per physical connection (regular events vs. harness_mcp read-proxy events), so a caller that wants harness_mcp events served ahead of a regular-event backlog can drain them independently instead of going through the merged recv().
C2ReconnectingHandle
Swappable, never-closing counterpart to C2ControlHandle. Every accessor clones or reads out of a watch cell a background supervisor mutates on reconnect; no caller ever holds a handle bound to one specific physical connection, so a relay restart never permanently breaks it.
DrainClient
DrainSession
HqWgAllowedIp
One allowed IP. HQ accepts only the host route of the C2 tunnel address.
HqWgClientConfig
HQ-side client configuration. Listen port must be 0.
HqWgPeer
The single C2 peer HQ dials.

Enums§

C2ClientError
C2ConnectionLossReason
Why control_owner tore its connection down, attached to every request still pending at that moment (C2ControlError::ConnectionLost). Logged once at the teardown point instead of being silently swallowed.
C2ControlError
C2LinkState
Whether the harness’s own dedicated C2 control connection is live right now or being re-established after a loss.
DrainError
HqWgClientError

Functions§

bring_up_hq_wireguard
Creates the HQ interface with kernel WireGuard and installs a route only to the C2 tunnel address. A failed ip link add type wireguard is returned as HqWgClientError::InterfaceCreate with no other transport substituted.
connect_core_operator
Dial the core operator control socket (A2). Same wire as the former C2 control endpoint; the socket now lives on hatchery-server, not on C2.
connect_core_operator_reconnecting
Dial a reconnecting core operator control socket (A2). Connects to a local gate4agent-c2 control endpoint the same way connect_local does – a dead endpoint at boot still fails fast with the identical error, unchanged – then hands the connection to a background supervisor that keeps it alive for as long as the returned handle (or its event receiver) is held.
connect_local
connect_local_reconnecting
Connects to a local gate4agent-c2 control endpoint the same way connect_local does – a dead endpoint at boot still fails fast with the identical error, unchanged – then hands the connection to a background supervisor that keeps it alive for as long as the returned handle (or its event receiver) is held.
connect_tunnel_reconnecting
Same supervisor as connect_local_reconnecting, dialing the tunnel TCP control port instead of the unix socket. Unix reconnect is unchanged.
connect_tunnel_tcp
Dials the C2 control frame protocol over TCP.