96a35ca84c
ci / rust (push) Failing after 29s
ci / web (push) Failing after 35s
docker / build-push (., web/Dockerfile, punktfunk-web) (push) Successful in 5s
docker / build-push (ci, ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 3s
docker / build-push (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 18s
ci / docs-site (push) Failing after 38s
apple / swift (push) Successful in 1m15s
docker / deploy-docs (push) Successful in 17s
New crate crates/punktfunk-client-linux (binary punktfunk-client), the native Linux client on the Option A architecture (2026-06-12 research): - GTK4/libadwaita shell linking punktfunk-core directly (no C ABI): mDNS host list, TOFU fingerprint prompt, SPAKE2 PIN pairing dialog, preferences (mode/bitrate/gamepad/shortcut capture), stats overlay, --connect host[:port] for scripting. - Video: FFmpeg software HEVC decode (LOW_DELAY, slice threads) -> RGBA -> GdkMemoryTexture inside GtkGraphicsOffload (the dmabuf subsurface path lights up when VAAPI lands; black-background keeps fullscreen scanout-eligible). - Audio: Opus -> PipeWire playback stream, the host virtual-mic's adaptive jitter ring inverted. - Input: keyboard as the exact inverse of the host VK table (evdev keycodes, layout-independent; unit-tested), absolute mouse through the Contain-fit transform, WHEEL_DELTA(120) scroll, compositor shortcut inhibition while streaming, Ctrl+Alt+Shift+Q release chord, F11 fullscreen. SDL3 gamepad capture (single pad-0 model) + rumble and DualSense lightbar feedback on the same thread. - Session pump owns video+audio pulls; the gamepad thread owns rumble+hidout — possible because NativeClient's plane receivers are now mutexed, making it Sync (Arc-shared, compiler-verified per-plane contract instead of the ABI's manual assertion). - Linux-gated deps + a stub main keep cargo build --workspace green on macOS. Validated live against serve --native on this box: 1920x1080@60, locked 60 fps, capture->decoded p50 ~6.4 ms (software decode, debug build). Teardown keys off AdwNavigationPage::hidden — NavigationView push fires a transient unmap/map cycle that must not end the session. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
77 lines
2.9 KiB
Rust
77 lines
2.9 KiB
Rust
//! LAN host discovery: browse the host's mDNS advert (`_punktfunk._udp`, TXT keys
|
|
//! `fp`/`pair`/`id` — see the host crate's `discovery.rs`) on a worker thread and stream
|
|
//! results to the UI.
|
|
|
|
use mdns_sd::{ServiceDaemon, ServiceEvent};
|
|
|
|
#[derive(Clone, Debug)]
|
|
pub struct DiscoveredHost {
|
|
/// Stable row key: the advertised host id, falling back to the mDNS fullname.
|
|
pub key: String,
|
|
pub name: String,
|
|
pub addr: String,
|
|
pub port: u16,
|
|
/// Host certificate fingerprint to pin (lowercase hex), empty if not advertised.
|
|
pub fp_hex: String,
|
|
/// Pairing requirement: `"required"` or `"optional"`.
|
|
pub pair: String,
|
|
}
|
|
|
|
/// Browse continuously for the app's lifetime. The thread exits when the receiver is
|
|
/// dropped (the send fails) or the daemon dies.
|
|
pub fn browse() -> async_channel::Receiver<DiscoveredHost> {
|
|
let (tx, rx) = async_channel::unbounded();
|
|
std::thread::Builder::new()
|
|
.name("punktfunk-mdns".into())
|
|
.spawn(move || {
|
|
let daemon = match ServiceDaemon::new() {
|
|
Ok(d) => d,
|
|
Err(e) => {
|
|
tracing::warn!(error = %e, "mDNS daemon failed — discovery disabled");
|
|
return;
|
|
}
|
|
};
|
|
let receiver = match daemon.browse("_punktfunk._udp.local.") {
|
|
Ok(r) => r,
|
|
Err(e) => {
|
|
tracing::warn!(error = %e, "mDNS browse failed — discovery disabled");
|
|
return;
|
|
}
|
|
};
|
|
while let Ok(event) = receiver.recv() {
|
|
if let ServiceEvent::ServiceResolved(info) = event {
|
|
let props = info.get_properties();
|
|
let val = |k: &str| props.get_property_val_str(k).unwrap_or("").to_string();
|
|
let Some(addr) = info.get_addresses().iter().next().map(|a| a.to_string())
|
|
else {
|
|
continue;
|
|
};
|
|
let id = val("id");
|
|
let host = DiscoveredHost {
|
|
key: if id.is_empty() {
|
|
info.get_fullname().to_string()
|
|
} else {
|
|
id
|
|
},
|
|
name: info
|
|
.get_fullname()
|
|
.split('.')
|
|
.next()
|
|
.unwrap_or("?")
|
|
.to_string(),
|
|
addr,
|
|
port: info.get_port(),
|
|
fp_hex: val("fp"),
|
|
pair: val("pair"),
|
|
};
|
|
if tx.send_blocking(host).is_err() {
|
|
break; // UI gone — stop browsing
|
|
}
|
|
}
|
|
}
|
|
let _ = daemon.shutdown();
|
|
})
|
|
.expect("spawn mdns thread");
|
|
rx
|
|
}
|