From b44430859282716bdcee311a3ebb99504ee41bc7 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Mon, 27 Jul 2026 20:48:43 +0200 Subject: [PATCH] feat(host): PUNKTFUNK_HOST_NAME names the host in Moonlight and the clients MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A box called `bazzite-htpc` had no way to present itself as "Living Room" short of renaming the machine. The new knob overrides the name everywhere a human sees it: the GameStream serverinfo element and the mDNS service instance name both adverts carry. Unset (the default) is the machine's own hostname, exactly as before. Free text is the point, so the DNS-level name is now a separate concern from the display name. The instance label may contain spaces and accents; an A-record target may not, and mdns-sd rejects the whole ServiceInfo if the target is not a legal name — which would take discovery down rather than merely look wrong. dns_label() sanitizes the target and passes an already-legal name through byte-for-byte, so hosts without the override advertise precisely what they always did. The display name loses `.` (it would split the label, and clients derive the name as the first label of the fullname, so "Ben's PC v1.2" would arrive as "Ben's PC v1") and is capped at the 63-byte DNS-SD ceiling on a char boundary. Co-Authored-By: Claude Opus 5 (1M context) (cherry picked from commit bbf72261a12e0e67601f549d40db65ae61979268) --- crates/pf-host-config/src/lib.rs | 9 +++ crates/punktfunk-host/src/discovery.rs | 50 +++++++++++++++- crates/punktfunk-host/src/gamestream/mdns.rs | 4 +- crates/punktfunk-host/src/gamestream/mod.rs | 60 ++++++++++++++++++++ crates/punktfunk-host/src/windows/service.rs | 6 +- docs-site/content/docs/configuration.md | 1 + scripts/host.env.example | 4 ++ scripts/windows/host.env.example | 4 ++ 8 files changed, 134 insertions(+), 4 deletions(-) diff --git a/crates/pf-host-config/src/lib.rs b/crates/pf-host-config/src/lib.rs index c1ca2156..7b61a926 100644 --- a/crates/pf-host-config/src/lib.rs +++ b/crates/pf-host-config/src/lib.rs @@ -61,6 +61,12 @@ pub fn env_on(name: &str) -> Option { /// derived `Debug` impl, so the parser can stay a single platform-neutral function. #[derive(Debug, Clone, Default)] pub struct HostConfig { + /// `PUNKTFUNK_HOST_NAME` — the name this host shows up under in Moonlight (the serverinfo + /// `` element) and in Punktfunk's own clients (the mDNS service *instance* name both + /// adverts carry). Unset/blank = the machine's own hostname, which is what it always was. Free + /// text ("Living Room PC"); the DNS-level `