Expand description
§hb46pp
hb46pp is a Rust client for the
HTTP-Based IPv4 over IPv6 Provisioning Protocol used to discover
provisioning parameters for IPv4-over-IPv6 methods. It implements bootstrap TXT
discovery, request and response validation, IPv6-only HTTP transport, protocol
redirects, and retry timing and migration-state guidance.
Provisioning data for each supported IPv4-over-IPv6 method is retained as JSON. Applications select a method and interpret its parameters.
§Example
The default features provide a Hickory DNS resolver and a
Reqwest HTTP transport with a total timeout of 30 seconds per
provisioning request. DefaultClient::try_new uses the default client settings,
but callers can customize them with DefaultClient::builder.
use hb46pp::{Capability, FirmwareVersion, Product, ProvisioningRequest, VendorId};
use hb46pp::client::{DefaultClient, ProvisioningOutcome};
async fn provision() -> Result<(), Box<dyn std::error::Error>> {
let mut request = ProvisioningRequest::new(
"000000".parse::<VendorId>()?,
"example-router".parse::<Product>()?,
"1_0_0".parse::<FirmwareVersion>()?,
vec![Capability::DsLite],
None,
None,
)?;
let client = DefaultClient::try_new()?;
let outcome = client.provision(&request).await?;
let window = outcome.next_attempt_window();
match outcome {
ProvisioningOutcome::Provisioned(response) => {
if let Some(offer) = response.data().select(&[Capability::DsLite]) {
println!("DS-Lite parameters: {}", offer.parameters());
}
if let Some(token) = response.data().token().cloned() {
request.set_token(Some(token));
}
}
ProvisioningOutcome::NotFound => {
println!("disable the previous HB46PP-provisioned mechanism");
}
}
println!(
"make another attempt after a delay between {:?} and {:?}",
window.min(),
window.max()
);
Ok(())
}The library provides retry timing and uses ClientError::retry_action to
distinguish disabling from preserving the previous migration mechanism. It does
not choose a random delay, sleep, monitor network changes, modify network
configuration, or persist data. Those responsibilities remain with the
application.
§Features
default-client(default): default DNS resolver and HTTP transport.client: protocol flow and adapter traits without concrete network adapters.default-resolver: Hickory-based discovery resolver.default-transport: Reqwest-based IPv6-only HTTP transport.- No features: protocol models and validation only.
Custom transports must use IPv6, apply the requested TLS policy, avoid automatic redirects, and bound response resource usage.
§Security
HB46PP bootstrap discovery trusts the DNS response for 4over6.info. Requiring
certificate validation protects communication with the hostname in that
response, but does not independently authenticate that DNS selected the
intended provider. Applications should use HB46PP discovery only where the
access-network DNS is trusted.
The client rejects bootstrap policy t=a by default because it permits HTTP or
HTTPS without certificate validation. Applications that require compatibility
with such a provider must explicitly select
ProvisioningAuthenticationPolicy::AllowUnauthenticated.
The default transport rejects IPv4 and IPv4-mapped endpoints as well as unspecified, loopback, multicast, and link-local IPv6 destinations. Unique-local addresses remain available for provider network compatibility.
§License
Licensed under either of the following:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT License (LICENSE-MIT)
Modules§
- client
- Client and transport abstractions for HB46PP provisioning.
Structs§
- Bootstrap
- A validated HB46PP bootstrap record.
- Credentials
- Optional user name and password sent with a provisioning request.
- Firmware
Version - A validated value for the HB46PP
versionrequest parameter. - Product
- A validated value for the HB46PP
productrequest parameter. - Provider
Info - Informational names identifying the provisioned service and its providers.
- Provisioning
Data - Validated provisioning data returned by an HB46PP server.
- Provisioning
Request - Validated parameters used to request HB46PP provisioning data.
- Selected
Offer - An offer supported by the caller and selected using the server’s preference order.
- Token
- An opaque token returned by a provisioning server for a later request.
- Ttl
- The validated lifetime of provisioning data, in seconds.
- Vendor
Id - A validated value for the HB46PP
vendoridrequest parameter.
Enums§
- Auth
Status - The result of user/password authentication reported by the server.
- Auth
Status Error - Errors returned when parsing an
AuthStatus. - Bootstrap
Error - Errors returned when parsing and validating a
Bootstraprecord. - Capability
- An IPv4-over-IPv6 method recognized by HB46PP.
- Capability
Error - Errors returned when parsing a
Capabilityname. - Credentials
Error - Errors returned when constructing
Credentials. - Firmware
Version Error - Errors returned when parsing a
FirmwareVersion. - Product
Error - Errors returned when parsing a
Product. - Provisioning
Data Error - Errors returned when parsing and validating
ProvisioningData. - Provisioning
Request Error - Errors returned when constructing a
ProvisioningRequest. - Provisioning
UrlError - Errors returned when adding restricted credentials to a provisioning URL.
- TlsPolicy
- The certificate validation policy declared by an HB46PP bootstrap record.
- Token
Error - Errors returned when parsing a
Token. - TtlError
- Errors returned when constructing a provisioning
Ttl. - Vendor
IdError - Errors returned when parsing a
VendorId.