Files
kvm/log.go
Alex Howells 032457c9e5 feat(network): add Tailscale status to Settings > Network (#1276)
* feat(network): add Tailscale status to Settings > Network

Tailscale runs on JetKVM devices but has no visibility in the web UI.
This adds a read-only status card to the network settings page that
surfaces the output of `tailscale status --json` over the existing
JSON-RPC transport.

Backend (Go):

  tailscale.go -- TailscaleStatus/TailscalePeer structs returned by a
  single RPC handler (getTailscaleStatus). isTailscaleInstalled uses
  exec.LookPath; getTailscaleStatus shells out via exec.CommandContext
  with a 10s timeout and parses the JSON response. When the binary is
  absent the handler returns {installed: false} without error. When the
  daemon is unreachable it returns {installed: true, running: false}.

  tailscale_test.go -- table-driven tests for parseTailscaleStatus
  covering Running, NeedsLogin, Stopped, Starting, malformed JSON, and
  empty object inputs. Integration-level tests for getTailscaleStatus
  verify the exec mock path and confirm the function never returns an
  error regardless of environment state.

  jsonrpc.go -- getTailscaleStatus registered in rpcHandlers.
  log.go -- tailscaleLogger subsystem added.

Frontend (TypeScript/React):

  TailscaleCard.tsx -- GridCard component that calls getTailscaleStatus
  on mount. Renders nothing when installed=false. Shows a status badge
  (Connected/Needs Login/Stopped), Tailscale IPv4/IPv6, hostname, DNS
  name, auth URL when NeedsLogin, and health warnings when present.

  stores.ts -- TailscaleStatus and TailscalePeer interfaces.

  devices.$id.settings.network.tsx -- TailscaleCard rendered after
  PublicIPCard.

* fix(ui): address review feedback on TailscaleCard

Remove the health warnings section from TailscaleCard.tsx — these
surface raw Tailscale internal diagnostics (nftables errors, routing
warnings) that are not actionable for end users and clutter the
status card.

Reduce monospace font size on IPv4 and IPv6 address spans from
text-sm (14px) to text-[13px] so the mono typeface visually matches
the surrounding 14px proportional text.

Signed-off-by: Alex Howells <alex@howells.me>

---------

Signed-off-by: Alex Howells <alex@howells.me>
2026-03-17 18:37:03 +01:00

36 lines
1.4 KiB
Go

package kvm
import (
"github.com/jetkvm/kvm/internal/logging"
"github.com/rs/zerolog"
)
func ErrorfL(l *zerolog.Logger, format string, err error, args ...any) error {
return logging.ErrorfL(l, format, err, args...)
}
var (
logger = logging.GetSubsystemLogger("jetkvm")
failsafeLogger = logging.GetSubsystemLogger("failsafe")
networkLogger = logging.GetSubsystemLogger("network")
cloudLogger = logging.GetSubsystemLogger("cloud")
websocketLogger = logging.GetSubsystemLogger("websocket")
webrtcLogger = logging.GetSubsystemLogger("webrtc")
nativeLogger = logging.GetSubsystemLogger("native")
nbdLogger = logging.GetSubsystemLogger("nbd")
timesyncLogger = logging.GetSubsystemLogger("timesync")
jsonRpcLogger = logging.GetSubsystemLogger("jsonrpc")
hidRPCLogger = logging.GetSubsystemLogger("hidrpc")
watchdogLogger = logging.GetSubsystemLogger("watchdog")
websecureLogger = logging.GetSubsystemLogger("websecure")
otaLogger = logging.GetSubsystemLogger("ota")
serialLogger = logging.GetSubsystemLogger("serial")
terminalLogger = logging.GetSubsystemLogger("terminal")
displayLogger = logging.GetSubsystemLogger("display")
wolLogger = logging.GetSubsystemLogger("wol")
usbLogger = logging.GetSubsystemLogger("usb")
tailscaleLogger = logging.GetSubsystemLogger("tailscale")
// external components
ginLogger = logging.GetSubsystemLogger("gin")
)