diff --git a/Makefile b/Makefile index 3c8ef641..1c102fdb 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,10 @@ NAME = sing-box COMMIT = $(shell git rev-parse --short HEAD) -TAGS ?= with_gvisor,with_dhcp,with_wireguard,with_clash_api,with_quic,with_utls,with_tailscale -TAGS_TEST ?= with_gvisor,with_quic,with_wireguard,with_grpc,with_utls +TAGS ?= with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale GOHOSTOS = $(shell go env GOHOSTOS) GOHOSTARCH = $(shell go env GOHOSTARCH) -VERSION=$(shell CGO_ENABLED=0 GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) go run ./cmd/internal/read_tag) +VERSION=$(shell CGO_ENABLED=0 GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) go run github.com/sagernet/sing-box/cmd/internal/read_tag@latest) PARAMS = -v -trimpath -ldflags "-X 'github.com/sagernet/sing-box/constant.Version=$(VERSION)' -s -w -buildid=" MAIN_PARAMS = $(PARAMS) -tags "$(TAGS)" diff --git a/cmd/sing-box/cmd.go b/cmd/sing-box/cmd.go index 78b55a6f..575cb7a0 100644 --- a/cmd/sing-box/cmd.go +++ b/cmd/sing-box/cmd.go @@ -7,7 +7,6 @@ import ( "strconv" "time" - "github.com/sagernet/sing-box" "github.com/sagernet/sing-box/experimental/deprecated" "github.com/sagernet/sing-box/include" "github.com/sagernet/sing-box/log" @@ -68,6 +67,5 @@ func preRun(cmd *cobra.Command, args []string) { if len(configPaths) == 0 && len(configDirectories) == 0 { configPaths = append(configPaths, "config.json") } - globalCtx = service.ContextWith(globalCtx, deprecated.NewStderrManager(log.StdLogger())) - globalCtx = box.Context(globalCtx, include.InboundRegistry(), include.OutboundRegistry(), include.EndpointRegistry(), include.DNSTransportRegistry(), include.ServiceRegistry()) + globalCtx = include.Context(service.ContextWith(globalCtx, deprecated.NewStderrManager(log.StdLogger()))) } diff --git a/include/registry.go b/include/registry.go index 4c9ad449..94d56db1 100644 --- a/include/registry.go +++ b/include/registry.go @@ -3,6 +3,7 @@ package include import ( "context" + "github.com/sagernet/sing-box" "github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing-box/adapter/endpoint" "github.com/sagernet/sing-box/adapter/inbound" @@ -39,6 +40,10 @@ import ( E "github.com/sagernet/sing/common/exceptions" ) +func Context(ctx context.Context) context.Context { + return box.Context(ctx, InboundRegistry(), OutboundRegistry(), EndpointRegistry(), DNSTransportRegistry(), ServiceRegistry()) +} + func InboundRegistry() *inbound.Registry { registry := inbound.NewRegistry() diff --git a/test/box_test.go b/test/box_test.go index 717e93ba..de2602e8 100644 --- a/test/box_test.go +++ b/test/box_test.go @@ -32,7 +32,7 @@ func TestMain(m *testing.M) { var globalCtx context.Context func init() { - globalCtx = box.Context(context.Background(), include.InboundRegistry(), include.OutboundRegistry(), include.EndpointRegistry(), include.DNSTransportRegistry(), include.ServiceRegistry()) + globalCtx = include.Context(context.Background()) } func startInstance(t *testing.T, options option.Options) *box.Box {