fix(vnc): Bridge nutzt aria-net-Gateway statt host.docker.internal (VNC refused)

Kern des "Verbinde..."-Hangs: host.docker.internal loeste zu 172.17.0.1 (docker0)
auf, QEMUs VNC ist aber ans aria-net-Gateway 192.168.64.1 gebunden (dorthin
bindet der Brain) → Connection refused. Die Bridge ermittelt den VNC-Host jetzt
selbst per _docker_gateway() (/proc/net/route) = dasselbe Gateway wie der Brain.
ARIA_VNC_HOST-Env hat weiter Vorrang.

Live belegt: Bridge->192.168.64.1:5901 liefert RFB-Handshake, ->host.docker.
internal:5901 (172.17.0.1) = refused.

py_compile clean. Deploy: bridge rebuild.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-21 00:35:26 +02:00
co-authored by Claude Opus 4.8
parent 3c6bf0783e
commit 25abd220ad
+23 -1
View File
@@ -43,6 +43,25 @@ from openwakeword.model import Model as WakeWordModel
from modes import Mode, canonical_id, detect_mode_switch, mode_from_id, should_speak from modes import Mode, canonical_id, detect_mode_switch, mode_from_id, should_speak
def _docker_gateway() -> str:
"""Docker-Gateway-IP (= Host-IP auf DIESEM Container-Netz, aria-net) aus
/proc/net/route. Genau die IP, an die der Brain QEMUs VNC bindet — im
Gegensatz zu host.docker.internal, das auf die Default-Bridge (docker0)
zeigt und daher die VM nicht trifft."""
try:
import socket as _sock
import struct as _struct
with open("/proc/net/route") as f:
for line in f.readlines()[1:]:
fields = line.strip().split()
if len(fields) >= 4 and fields[1] == "00000000" and int(fields[3], 16) & 2:
return _sock.inet_ntoa(_struct.pack("<L", int(fields[2], 16)))
except Exception:
pass
return ""
# ── Logging ────────────────────────────────────────────────── # ── Logging ──────────────────────────────────────────────────
logging.basicConfig( logging.basicConfig(
@@ -738,7 +757,10 @@ class ARIABridge:
# "task": asyncio.Task}. Wir bruecken rohes RFB-TCP (QEMU-VNC auf dem # "task": asyncio.Task}. Wir bruecken rohes RFB-TCP (QEMU-VNC auf dem
# Host) <-> RVS (vnc_data/vnc_input, Base64-in-JSON). # Host) <-> RVS (vnc_data/vnc_input, Base64-in-JSON).
self._vnc_sessions: dict[str, dict] = {} self._vnc_sessions: dict[str, dict] = {}
self._vnc_host: str = os.environ.get("ARIA_VNC_HOST", "host.docker.internal") # VNC-Host: das aria-net-Gateway (dort bindet der Brain QEMUs VNC).
# host.docker.internal zeigt faelschlich auf docker0 (172.17.0.1) → refused.
self._vnc_host: str = (os.environ.get("ARIA_VNC_HOST")
or _docker_gateway() or "host.docker.internal")
# Satelliten (Aussenposten in fremden Netzen). id → {location, caps, # Satelliten (Aussenposten in fremden Netzen). id → {location, caps,
# control, last_seen}. Registrierung via sat_hello. _pending_sat: # control, last_seen}. Registrierung via sat_hello. _pending_sat:
# requestId → Future (sat_devices / sat_result), analog _pending_flux. # requestId → Future (sat_devices / sat_result), analog _pending_flux.