Add new admin panel, failover, dns fallback, providers, limiters. Update XHTTP

This commit is contained in:
Sergei Maklagin
2026-05-11 00:59:35 +03:00
parent 652e0baf57
commit 3bd162ed6f
241 changed files with 36409 additions and 4086 deletions

12
include/profiler.go Normal file
View File

@@ -0,0 +1,12 @@
//go:build with_profiler
package include
import (
"github.com/sagernet/sing-box/adapter/service"
"github.com/sagernet/sing-box/service/profiler"
)
func registerProfilerService(registry *service.Registry) {
profiler.RegisterService(registry)
}

20
include/profiler_stub.go Normal file
View File

@@ -0,0 +1,20 @@
//go:build !with_profiler
package include
import (
"context"
"github.com/sagernet/sing-box/adapter"
"github.com/sagernet/sing-box/adapter/service"
C "github.com/sagernet/sing-box/constant"
"github.com/sagernet/sing-box/log"
"github.com/sagernet/sing-box/option"
E "github.com/sagernet/sing/common/exceptions"
)
func registerProfilerService(registry *service.Registry) {
service.Register[option.ProfilerServiceOptions](registry, C.TypeProfiler, func(ctx context.Context, logger log.ContextLogger, tag string, options option.ProfilerServiceOptions) (adapter.Service, error) {
return nil, E.New(`Profiler is not included in this build, rebuild with -tags with_profiler`)
})
}

View File

@@ -14,6 +14,7 @@ import (
"github.com/sagernet/sing-box/dns"
"github.com/sagernet/sing-box/dns/transport"
"github.com/sagernet/sing-box/dns/transport/fakeip"
"github.com/sagernet/sing-box/dns/transport/fallback"
"github.com/sagernet/sing-box/dns/transport/hosts"
"github.com/sagernet/sing-box/dns/transport/local"
"github.com/sagernet/sing-box/log"
@@ -22,10 +23,13 @@ import (
"github.com/sagernet/sing-box/protocol/block"
"github.com/sagernet/sing-box/protocol/bond"
"github.com/sagernet/sing-box/protocol/direct"
"github.com/sagernet/sing-box/protocol/failover"
"github.com/sagernet/sing-box/protocol/group"
"github.com/sagernet/sing-box/protocol/http"
"github.com/sagernet/sing-box/protocol/limiter/bandwidth"
"github.com/sagernet/sing-box/protocol/limiter/connection"
"github.com/sagernet/sing-box/protocol/limiter/rate"
"github.com/sagernet/sing-box/protocol/limiter/traffic"
"github.com/sagernet/sing-box/protocol/mieru"
"github.com/sagernet/sing-box/protocol/mixed"
"github.com/sagernet/sing-box/protocol/naive"
@@ -45,9 +49,9 @@ import (
remoteProvider "github.com/sagernet/sing-box/provider/remote"
"github.com/sagernet/sing-box/service/admin_panel"
"github.com/sagernet/sing-box/service/manager"
"github.com/sagernet/sing-box/service/manager_api"
"github.com/sagernet/sing-box/service/node"
nodeManagerClient "github.com/sagernet/sing-box/service/node_manager/client"
nodeManagerServer "github.com/sagernet/sing-box/service/node_manager/server"
"github.com/sagernet/sing-box/service/node_manager_api"
"github.com/sagernet/sing-box/service/resolved"
"github.com/sagernet/sing-box/service/ssmapi"
E "github.com/sagernet/sing/common/exceptions"
@@ -78,6 +82,7 @@ func InboundRegistry() *inbound.Registry {
anytls.RegisterInbound(registry)
bond.RegisterInbound(registry)
failover.RegisterInbound(registry)
registerQUICInbounds(registry)
registerStubForRemovedInbounds(registry)
@@ -112,9 +117,12 @@ func OutboundRegistry() *outbound.Registry {
registerMASQUEOutbound(registry)
bond.RegisterOutbound(registry)
failover.RegisterOutbound(registry)
bandwidth.RegisterOutbound(registry)
connection.RegisterOutbound(registry)
traffic.RegisterOutbound(registry)
rate.RegisterOutbound(registry)
parser.RegisterOutbound(registry)
@@ -157,6 +165,7 @@ func DNSTransportRegistry() *dns.TransportRegistry {
hosts.RegisterTransport(registry)
local.RegisterTransport(registry)
fakeip.RegisterTransport(registry)
fallback.RegisterTransport(registry)
resolved.RegisterTransport(registry)
registerQUICTransports(registry)
@@ -171,9 +180,9 @@ func ServiceRegistry() *service.Registry {
admin_panel.RegisterService(registry)
manager.RegisterService(registry)
manager_api.RegisterService(registry)
node.RegisterService(registry)
nodeManagerClient.RegisterService(registry)
nodeManagerServer.RegisterService(registry)
node_manager_api.RegisterService(registry)
resolved.RegisterService(registry)
ssmapi.RegisterService(registry)
@@ -181,6 +190,7 @@ func ServiceRegistry() *service.Registry {
registerCCMService(registry)
registerOCMService(registry)
registerOOMKillerService(registry)
registerProfilerService(registry)
return registry
}