初版功能完成
ci / Go checks (ubuntu-latest) (push) Has been cancelled
ci / Go checks (windows-latest) (push) Has been cancelled

This commit is contained in:
qsc
2026-08-29 13:12:17 +08:00
commit 142e5dc7d6
217 changed files with 21313 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
package main
import (
"bytes"
"net/netip"
"strings"
"testing"
"remlink/internal/model"
)
func TestSiteConsoleShowsRequiredStatusAndEvents(t *testing.T) {
var output bytes.Buffer
console := newSiteConsole(&output)
console.Header("https://server.example", "Site-A", "1.0.0")
console.OverlayReady(netip.MustParseAddr("10.88.0.20"))
console.ControlState(true)
console.SiteReady()
console.Session(model.SessionActive, 42, "")
console.Route(42, netip.MustParsePrefix("192.168.13.0/24"), "DIRECT")
text := output.String()
for _, wanted := range []string{"服务器=", "节点=", "OverlayIP=", "WireGuard=", "Control=", "远程网段=", "子网网关=", "[会话/SESSION]", "活动中(ACTIVE", "[路由/ROUTE]", "直连路由(DIRECT"} {
if !strings.Contains(text, wanted) {
t.Fatalf("console output missing %q: %s", wanted, text)
}
}
}