Skip to main content

try_get_valid_nym_node_api_client

Function try_get_valid_nym_node_api_client 

Source
pub async fn try_get_valid_nym_node_api_client(
    base_host: &str,
    node_id: u32,
    custom_port: Option<u16>,
    user_agent: impl Into<UserAgent>,
) -> Result<Client, Error>
Expand description

Probe a nym-node’s HTTP API and return a connected crate::api::Client.

base_host is a hostname (e.g. nymtech.net) or IP address (e.g. 127.0.0.1). The function tries the following addresses in order, returning the first one whose /health endpoint reports an “up” status:

  1. http://<host>:<custom_port> (only when custom_port is Some)
  2. http://<host>:8080 — the standard nym-node API port
  3. https://<host> — node behind an HTTPS reverse proxy (port 443)
  4. http://<host> — node behind an HTTP reverse proxy (port 80)

This function is intended for infrastructure binaries (nym-api, network monitor, etc.), not regular clients, which is why hickory DNS is explicitly disabled.