tr064
Vendor-neutral async Rust client for TR-064, the UPnP/SOAP protocol many routers, modems and gateways use for device management.
- Reads the device description and the service descriptions (SCPD), so every service and action of a device is available at runtime, vendor extensions included
- Calls actions over SOAP and reports UPnP errors with their codes
- HTTP Digest authentication (MD5 and SHA-256). Reuses the nonce and never retries rejected credentials, so a wrong password does not lock the account
- TLS with a pinned certificate fingerprint for devices with self-signed certificates, and a helper to fetch the fingerprint on first use
- Logs requests through
tracing, with argument values and query parameters hidden unless aRedacthook shows them - rustls only, no OpenSSL
Example
use ;
async
For https, pin the device's certificate:
let url = parse?;
let fingerprint = fetch_fingerprint.await?;
// Confirm the fingerprint once, store it, and pin it from then on.
let client = builder.pin.build?;
The examples list the services of a device and call any action:
TR064_URL=http://192.168.178.1:49000
TR064_USERNAME=user TR064_PASSWORD=secret
Scope
The crate knows the protocol, not any particular device. Vendor-specific meaning, such as what a vendor's error codes stand for, belongs to the application. Values are passed and returned as strings. The SCPD names each argument's UPnP data type.
License
Apache-2.0