M5: mDNS - Service-Bekanntmachung (zeroconf) und Discovery

This commit is contained in:
2026-07-14 14:31:57 +02:00
parent c362847ff5
commit 33f3f157b5
4 changed files with 192 additions and 1 deletions
+32
View File
@@ -0,0 +1,32 @@
package mdns
import (
"testing"
)
func TestGetServiceName(t *testing.T) {
expected := "_sportscore._tcp"
got := GetServiceName()
if got != expected {
t.Errorf("GetServiceName() = %q, want %q", got, expected)
}
}
func TestDiscoveryResult(t *testing.T) {
result := &DiscoveryResult{
Instance: "test-scoreboard",
Host: "myhost.local",
Port: 3000,
Addr: "192.168.1.100:3000",
}
if result.Instance != "test-scoreboard" {
t.Errorf("Instance = %q, want %q", result.Instance, "test-scoreboard")
}
if result.Port != 3000 {
t.Errorf("Port = %d, want 3000", result.Port)
}
if result.Addr != "192.168.1.100:3000" {
t.Errorf("Addr = %q, want %q", result.Addr, "192.168.1.100:3000")
}
}