`cargo check --all-targets` emitted 32 warnings; it now emits none. Almost all of them came from one cause: main.rs declared `mod config/fleet/printer/uplink` while lib.rs declared the same modules, so every file was compiled twice, once per crate. In the binary copy nothing is externally reachable, so every `pub use` re-export and every method that only an example or a test calls was genuinely dead - and the warnings were real about the binary while being wrong about the library's actual public API. main.rs now uses the library crate and keeps only `mod go2rtc`, which nothing else needs. The rest, individually: - `ModuleInfo` was re-exported from bambu_commands but not from printer, so it was unreachable even though `GetVersionResponse.module` is a public field of type `Vec<ModuleInfo>` - a caller could not name the type of a field it can read. Re-exported rather than dropped. - Three stub `publish` impls take a payload they do not use yet; renamed to `_payload`. - One unused import in examples/test_bambu_certs.rs. That leaves the `async_fn_in_trait` lint on GenericPrinter, which is now `allow`ed with the reasoning written down rather than left to fire on every build. The old comment said it "only matters once this is wired into the multi-threaded daemon", which has since happened - so the question got answered instead of deferred: the futures cannot be required to be `Send`, and that is fine because every printer is reached through one Arc<Mutex<Vec<..>>> from the uplink's own task, so they are created and polled in the same place. The note says what to do if a printer ever gets its own task. No behaviour change. Tests still pass and the daemon was re-verified against the live P1P and H2C through the full backend path.
31 lines
974 B
Rust
31 lines
974 B
Rust
//! Run with: cargo run --example test_bambu_certs
|
|
//!
|
|
//! Loads printers.toml (copy printers.example.toml to get started, fill in
|
|
//! your real printers) and attempts a raw TLS handshake to each Bambu
|
|
//! printer's MQTTS port (8883) - no MQTT protocol involved, just "does the
|
|
//! certificate verify". Prusa/Klipper entries are skipped; they don't have
|
|
//! this trust question.
|
|
|
|
use continuum_proxy::fleet;
|
|
use continuum_proxy::printer::PrinterHandle;
|
|
|
|
fn main() -> anyhow::Result<()> {
|
|
let printers = fleet::load(std::path::Path::new("printers.toml"))?;
|
|
|
|
for printer in &printers {
|
|
match printer {
|
|
PrinterHandle::Bambu(bambu) => report(bambu.base().name.as_str(), bambu.test_tls_handshake()),
|
|
_ => {}
|
|
}
|
|
}
|
|
|
|
Ok(())
|
|
}
|
|
|
|
fn report(name: &str, result: anyhow::Result<()>) {
|
|
match result {
|
|
Ok(()) => println!("{name}: OK - certificate verified"),
|
|
Err(err) => println!("{name}: FAILED - {err}"),
|
|
}
|
|
}
|