blokli-client 0.29.1

Client connector to Blokli
Documentation

Rust client for the Blokli GraphQL API.

DNS override

By default, [BlokliClient] uses the system DNS resolver through reqwest. Callers that need to keep Blokli communication working while DNS is unreliable can configure [BlokliClientConfig::dns_override] to pin the Blokli URL hostname to a fixed IP address.

The request hostname is not rewritten. For example, a client configured with https://blokli.example.org and a DNS override still sends requests for blokli.example.org, preserving TLS SNI and certificate validation while bypassing system DNS for that hostname. When [BlokliDnsOverride::port] is set, it becomes the request port; otherwise the original URL port or scheme default is used.

use std::net::IpAddr;

use blokli_client::{BlokliClient, BlokliClientConfig, BlokliDnsOverride};

let client = BlokliClient::new(
    "https://blokli.example.org".parse()?,
    BlokliClientConfig {
        dns_override: Some(BlokliDnsOverride {
            ip: IpAddr::from([203, 0, 113, 10]),
            port: None,
        }),
        ..Default::default()
    },
);
# let _ = client;
# Ok::<(), Box<dyn std::error::Error>>(())

Leave dns_override as None to use normal system DNS resolution.