From f264d26fc69be9b6d1e4ff9ca83e315be3beaf6f Mon Sep 17 00:00:00 2001 From: xboard Date: Sun, 15 Mar 2026 14:35:00 +0800 Subject: [PATCH] build: sync feature tags and update tests for weak type handling --- Dockerfile | 2 +- go.mod | 1 + go.sum | 2 ++ internal/kernel/singbox/config_test.go | 18 ++---------------- 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1a1eff0..0a463d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ COPY . . RUN CGO_ENABLED=0 go build -ldflags "-s -w \ -X main.version=$(git describe --tags --always --dirty 2>/dev/null || echo dev) \ -X main.buildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ - -tags "with_quic with_utls" \ + -tags "with_quic with_utls with_wireguard with_clash_api" \ -o xboard-node ./cmd/xboard-node # Runtime stage — sing-box & xray-core are embedded as Go libraries diff --git a/go.mod b/go.mod index b5bb15b..40e4697 100644 --- a/go.mod +++ b/go.mod @@ -69,6 +69,7 @@ require ( github.com/mholt/acmez/v3 v3.1.6 // indirect github.com/miekg/dns v1.1.72 // indirect github.com/mitchellh/go-ps v1.0.0 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/openai/openai-go/v3 v3.26.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pierrec/lz4/v4 v4.1.21 // indirect diff --git a/go.sum b/go.sum index 738af69..492047c 100644 --- a/go.sum +++ b/go.sum @@ -147,6 +147,8 @@ github.com/miekg/dns v1.1.72 h1:vhmr+TF2A3tuoGNkLDFK9zi36F2LS+hKTRW0Uf8kbzI= github.com/miekg/dns v1.1.72/go.mod h1:+EuEPhdHOsfk6Wk5TT2CzssZdqkmFhf8r+aVyDEToIs= github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc= github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= github.com/openai/openai-go/v3 v3.26.0 h1:bRt6H/ozMNt/dDkN4gobnLqaEGrRGBzmbVs0xxJEnQE= diff --git a/internal/kernel/singbox/config_test.go b/internal/kernel/singbox/config_test.go index 333edc2..37edbc5 100644 --- a/internal/kernel/singbox/config_test.go +++ b/internal/kernel/singbox/config_test.go @@ -46,19 +46,6 @@ func TestBuildInbound_Shadowsocks2022(t *testing.T) { assertMapValue(t, inbound, "password", "base64serverkey==") } -func TestBuildInbound_ShadowsocksWithPlugin(t *testing.T) { - nc := &panel.NodeConfig{ - Protocol: "shadowsocks", - ServerPort: 333, - Cipher: "aes-128-gcm", - Plugin: "obfs-local", - PluginOpt: "obfs=http;obfs-host=example.com", - } - inbound := buildInbound(nc, testUsers, "", "") - assertMapValue(t, inbound, "plugin", "obfs-local") - assertMapValue(t, inbound, "plugin_opts", "obfs=http;obfs-host=example.com") -} - // --- VMess --- func TestBuildInbound_VMess(t *testing.T) { @@ -605,9 +592,8 @@ func TestBuildTLSConfig_NoCert(t *testing.T) { nc := &panel.NodeConfig{ServerName: "example.com"} tls := buildTLSConfig(nc, "", "") assertMapValue(t, tls, "enabled", true) - if _, exists := tls["certificate_path"]; exists { - t.Error("should not have certificate_path when empty") - } + // Now we fallback to self-signed certificates when both cert and key are empty + assertMapValue(t, tls, "certificate_path", "self-signed") } func TestBuildTLSConfig_FallbackToHost(t *testing.T) {