pub struct IicpNode { /* private fields */ }Expand description
IICP provider node — handles registration, heartbeats, and task serving.
Implementations§
Source§impl IicpNode
impl IicpNode
pub fn new(cfg: NodeConfig) -> Self
Sourcepub fn node_hmac_key(&self) -> String
pub fn node_hmac_key(&self) -> String
Current HMAC key in use for ADR-019 pricing signatures (empty if unregistered AND no operator-provisioned key).
Sourcepub fn cfg(&self) -> &NodeConfig
pub fn cfg(&self) -> &NodeConfig
Borrow this node’s configuration. Useful for callers (e.g.
crate::conformance::run_conformance_checks) that need to inspect
directory_url, endpoint, or node_id without owning the config.
Sourcepub fn set_relay_worker_endpoint(&mut self, endpoint: String)
pub fn set_relay_worker_endpoint(&mut self, endpoint: String)
Set the relay-worker endpoint after construction. Used by the CLI when a
relay is auto-elected post-NAT-detection (tier ≥ 3): serve() reads
self.cfg.relay_worker_endpoint to start the outbound relay session.
Sourcepub fn apply_nat_profile(&mut self, profile: &NatProfile)
pub fn apply_nat_profile(&mut self, profile: &NatProfile)
Populate endpoint, transport_endpoint, and the NAT observability
fields from a NatProfile produced by crate::nat_detection::detect_nat.
Operators typically call this right after detect_nat() and before
register() so the directory receives the discovered public endpoint
- transport_method/nat_type/transport_metadata in the same payload.
Defensive: tier-4 (unreachable) profiles do NOT overwrite a manually-
set endpoint, and transport_method == "unreachable" is filtered out
before register.
Sourcepub async fn revoke_pinhole(&self) -> bool
pub async fn revoke_pinhole(&self) -> bool
#343 — close the UPnP IPv6 firewall pinhole if one is tracked. Best-effort.
Sourcepub async fn deregister(&self, node_token: Option<&str>) -> Result<()>
pub async fn deregister(&self, node_token: Option<&str>) -> Result<()>
Tell the directory this node is going away.
Mirrors iicp_client.IicpNode.deregister (Python iter-1471) and
IicpNode.deregister (TS iter-1474). Best-effort: shutdown paths
swallow failures so a flaky directory connection doesn’t block exit.
Deregister from the directory. node_token defaults to the token stashed by
register() (BUG-5) when None — pass Some(token) to override.
pub async fn register(&self) -> Result<String>
Sourcepub async fn heartbeat(&self, node_token: &str) -> Result<()>
pub async fn heartbeat(&self, node_token: &str) -> Result<()>
Send a single heartbeat to the directory.