diff --git a/core/cmd/nekobox_core/internal/boxbox/version.go b/core/cmd/nekobox_core/internal/boxbox/version.go deleted file mode 100644 index 2d989ba..0000000 --- a/core/cmd/nekobox_core/internal/boxbox/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package boxbox - -import "github.com/sagernet/sing-box/constant" - -func init() { - constant.Version = Version -} - -var Version = "1.10.5" diff --git a/core/cmd/nekobox_core/main.go b/core/cmd/nekobox_core/main.go index 6c6e948..ce0869c 100644 --- a/core/cmd/nekobox_core/main.go +++ b/core/cmd/nekobox_core/main.go @@ -10,12 +10,12 @@ import ( "nekobox_core/server" - "nekobox_core/internal/boxbox" + C "github.com/sagernet/sing-box/constant" _ "nekobox_core/internal/distro/all" ) func main() { - fmt.Println("sing-box:", boxbox.Version) + fmt.Println("sing-box:", C.Version) fmt.Println() runtimeDebug.SetMemoryLimit(2 * 1024 * 1024 * 1024) // 2GB go func() { diff --git a/script/build_go.sh b/script/build_go.sh index c24451a..0907c11 100755 --- a/script/build_go.sh +++ b/script/build_go.sh @@ -25,5 +25,6 @@ popd #### Go: nekobox_core #### pushd core/cmd/nekobox_core -go build -v -o $DEST -trimpath -ldflags "-w -s" -tags "with_clash_api,with_gvisor,with_quic,with_wireguard,with_utls,with_ech,with_dhcp" +VERSION_SINGBOX=$(go list -m -f '{{.Version}}' github.com/sagernet/sing-box) +go build -v -o $DEST -trimpath -ldflags "-w -s -X 'github.com/sagernet/sing-box/constant.Version=${VERSION_SINGBOX}'" -tags "with_clash_api,with_gvisor,with_quic,with_wireguard,with_utls,with_ech,with_dhcp" popd