Discovery: wide-area bridge DNS-SD

# Conflicts:
#	apps/ios/Sources/Bridge/BridgeDiscoveryModel.swift
#	src/cli/dns-cli.ts
This commit is contained in:
Peter Steinberger
2025-12-17 20:25:40 +01:00
parent e9bfe34850
commit 557ffdbe35
24 changed files with 293 additions and 19 deletions

View File

@@ -5,6 +5,8 @@ export type SystemPresence = {
ip?: string;
version?: string;
platform?: string;
deviceFamily?: string;
modelIdentifier?: string;
lastInputSeconds?: number;
mode?: string;
reason?: string;
@@ -54,12 +56,20 @@ function initSelfPresence() {
if (p === "win32") return `windows ${rel}`;
return `${p} ${rel}`;
})();
const deviceFamily = (() => {
const p = os.platform();
if (p === "darwin") return "Mac";
if (p === "win32") return "Windows";
if (p === "linux") return "Linux";
return p;
})();
const text = `Gateway: ${host}${ip ? ` (${ip})` : ""} · app ${version} · mode gateway · reason self`;
const selfEntry: SystemPresence = {
host,
ip,
version,
platform,
deviceFamily,
mode: "gateway",
reason: "self",
text,
@@ -123,6 +133,8 @@ type SystemPresencePayload = {
ip?: string;
version?: string;
platform?: string;
deviceFamily?: string;
modelIdentifier?: string;
lastInputSeconds?: number;
mode?: string;
reason?: string;
@@ -147,6 +159,8 @@ export function updateSystemPresence(payload: SystemPresencePayload) {
ip: payload.ip ?? parsed.ip ?? existing.ip,
version: payload.version ?? parsed.version ?? existing.version,
platform: payload.platform ?? existing.platform,
deviceFamily: payload.deviceFamily ?? existing.deviceFamily,
modelIdentifier: payload.modelIdentifier ?? existing.modelIdentifier,
mode: payload.mode ?? parsed.mode ?? existing.mode,
lastInputSeconds:
payload.lastInputSeconds ??