mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-05-14 00:51:12 +03:00
Update sing-box core
This commit is contained in:
12
include/ccm.go
Normal file
12
include/ccm.go
Normal file
@@ -0,0 +1,12 @@
|
||||
//go:build with_ccm && (!darwin || cgo)
|
||||
|
||||
package include
|
||||
|
||||
import (
|
||||
"github.com/sagernet/sing-box/adapter/service"
|
||||
"github.com/sagernet/sing-box/service/ccm"
|
||||
)
|
||||
|
||||
func registerCCMService(registry *service.Registry) {
|
||||
ccm.RegisterService(registry)
|
||||
}
|
||||
20
include/ccm_stub.go
Normal file
20
include/ccm_stub.go
Normal file
@@ -0,0 +1,20 @@
|
||||
//go:build !with_ccm
|
||||
|
||||
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 registerCCMService(registry *service.Registry) {
|
||||
service.Register[option.CCMServiceOptions](registry, C.TypeCCM, func(ctx context.Context, logger log.ContextLogger, tag string, options option.CCMServiceOptions) (adapter.Service, error) {
|
||||
return nil, E.New(`CCM is not included in this build, rebuild with -tags with_CCM`)
|
||||
})
|
||||
}
|
||||
20
include/ccm_stub_darwin.go
Normal file
20
include/ccm_stub_darwin.go
Normal file
@@ -0,0 +1,20 @@
|
||||
//go:build with_ccm && darwin && !cgo
|
||||
|
||||
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 registerCCMService(registry *service.Registry) {
|
||||
service.Register[option.CCMServiceOptions](registry, C.TypeCCM, func(ctx context.Context, logger log.ContextLogger, tag string, options option.CCMServiceOptions) (adapter.Service, error) {
|
||||
return nil, E.New(`CCM requires CGO on darwin, rebuild with CGO_ENABLED=1`)
|
||||
})
|
||||
}
|
||||
12
include/naive_outbound.go
Normal file
12
include/naive_outbound.go
Normal file
@@ -0,0 +1,12 @@
|
||||
//go:build with_naive_outbound
|
||||
|
||||
package include
|
||||
|
||||
import (
|
||||
"github.com/sagernet/sing-box/adapter/outbound"
|
||||
"github.com/sagernet/sing-box/protocol/naive"
|
||||
)
|
||||
|
||||
func registerNaiveOutbound(registry *outbound.Registry) {
|
||||
naive.RegisterOutbound(registry)
|
||||
}
|
||||
20
include/naive_outbound_stub.go
Normal file
20
include/naive_outbound_stub.go
Normal file
@@ -0,0 +1,20 @@
|
||||
//go:build !with_naive_outbound
|
||||
|
||||
package include
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sagernet/sing-box/adapter"
|
||||
"github.com/sagernet/sing-box/adapter/outbound"
|
||||
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 registerNaiveOutbound(registry *outbound.Registry) {
|
||||
outbound.Register[option.NaiveOutboundOptions](registry, C.TypeNaive, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.NaiveOutboundOptions) (adapter.Outbound, error) {
|
||||
return nil, E.New(`naive outbound is not included in this build, rebuild with -tags with_naive_outbound`)
|
||||
})
|
||||
}
|
||||
12
include/ocm.go
Normal file
12
include/ocm.go
Normal file
@@ -0,0 +1,12 @@
|
||||
//go:build with_ocm
|
||||
|
||||
package include
|
||||
|
||||
import (
|
||||
"github.com/sagernet/sing-box/adapter/service"
|
||||
"github.com/sagernet/sing-box/service/ocm"
|
||||
)
|
||||
|
||||
func registerOCMService(registry *service.Registry) {
|
||||
ocm.RegisterService(registry)
|
||||
}
|
||||
20
include/ocm_stub.go
Normal file
20
include/ocm_stub.go
Normal file
@@ -0,0 +1,20 @@
|
||||
//go:build !with_ocm
|
||||
|
||||
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 registerOCMService(registry *service.Registry) {
|
||||
service.Register[option.OCMServiceOptions](registry, C.TypeOCM, func(ctx context.Context, logger log.ContextLogger, tag string, options option.OCMServiceOptions) (adapter.Service, error) {
|
||||
return nil, E.New(`OCM is not included in this build, rebuild with -tags with_ocm`)
|
||||
})
|
||||
}
|
||||
10
include/oom_killer.go
Normal file
10
include/oom_killer.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package include
|
||||
|
||||
import (
|
||||
"github.com/sagernet/sing-box/adapter/service"
|
||||
"github.com/sagernet/sing-box/service/oomkiller"
|
||||
)
|
||||
|
||||
func registerOOMKillerService(registry *service.Registry) {
|
||||
oomkiller.RegisterService(registry)
|
||||
}
|
||||
@@ -44,7 +44,7 @@ func registerQUICInbounds(registry *inbound.Registry) {
|
||||
inbound.Register[option.Hysteria2InboundOptions](registry, C.TypeHysteria2, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.Hysteria2InboundOptions) (adapter.Inbound, error) {
|
||||
return nil, C.ErrQUICNotIncluded
|
||||
})
|
||||
naive.ConfigureHTTP3ListenerFunc = func(listener *listener.Listener, handler http.Handler, tlsConfig tls.ServerConfig, logger logger.Logger) (io.Closer, error) {
|
||||
naive.ConfigureHTTP3ListenerFunc = func(ctx context.Context, logger logger.Logger, listener *listener.Listener, handler http.Handler, tlsConfig tls.ServerConfig, options option.NaiveInboundOptions) (io.Closer, error) {
|
||||
return nil, C.ErrQUICNotIncluded
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
"github.com/sagernet/sing-box/protocol/block"
|
||||
"github.com/sagernet/sing-box/protocol/bond"
|
||||
"github.com/sagernet/sing-box/protocol/direct"
|
||||
protocolDNS "github.com/sagernet/sing-box/protocol/dns"
|
||||
"github.com/sagernet/sing-box/protocol/group"
|
||||
"github.com/sagernet/sing-box/protocol/http"
|
||||
"github.com/sagernet/sing-box/protocol/limiter/bandwidth"
|
||||
@@ -88,7 +87,6 @@ func OutboundRegistry() *outbound.Registry {
|
||||
direct.RegisterOutbound(registry)
|
||||
|
||||
block.RegisterOutbound(registry)
|
||||
protocolDNS.RegisterOutbound(registry)
|
||||
|
||||
group.RegisterFailover(registry)
|
||||
group.RegisterSelector(registry)
|
||||
@@ -99,6 +97,7 @@ func OutboundRegistry() *outbound.Registry {
|
||||
shadowsocks.RegisterOutbound(registry)
|
||||
vmess.RegisterOutbound(registry)
|
||||
trojan.RegisterOutbound(registry)
|
||||
registerNaiveOutbound(registry)
|
||||
tor.RegisterOutbound(registry)
|
||||
ssh.RegisterOutbound(registry)
|
||||
shadowtls.RegisterOutbound(registry)
|
||||
@@ -112,7 +111,6 @@ func OutboundRegistry() *outbound.Registry {
|
||||
connection.RegisterOutbound(registry)
|
||||
|
||||
registerQUICOutbounds(registry)
|
||||
registerWireGuardOutbound(registry)
|
||||
registerStubForRemovedOutbounds(registry)
|
||||
|
||||
return registry
|
||||
@@ -162,6 +160,9 @@ func ServiceRegistry() *service.Registry {
|
||||
ssmapi.RegisterService(registry)
|
||||
|
||||
registerDERPService(registry)
|
||||
registerCCMService(registry)
|
||||
registerOCMService(registry)
|
||||
registerOOMKillerService(registry)
|
||||
|
||||
return registry
|
||||
}
|
||||
@@ -176,4 +177,7 @@ func registerStubForRemovedOutbounds(registry *outbound.Registry) {
|
||||
outbound.Register[option.ShadowsocksROutboundOptions](registry, C.TypeShadowsocksR, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.ShadowsocksROutboundOptions) (adapter.Outbound, error) {
|
||||
return nil, E.New("ShadowsocksR is deprecated and removed in sing-box 1.6.0")
|
||||
})
|
||||
outbound.Register[option.StubOptions](registry, C.TypeWireGuard, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.StubOptions) (adapter.Outbound, error) {
|
||||
return nil, E.New("WireGuard outbound is deprecated in sing-box 1.11.0 and removed in sing-box 1.13.0, use WireGuard endpoint instead")
|
||||
})
|
||||
}
|
||||
|
||||
@@ -4,14 +4,9 @@ package include
|
||||
|
||||
import (
|
||||
"github.com/sagernet/sing-box/adapter/endpoint"
|
||||
"github.com/sagernet/sing-box/adapter/outbound"
|
||||
"github.com/sagernet/sing-box/protocol/wireguard"
|
||||
)
|
||||
|
||||
func registerWireGuardOutbound(registry *outbound.Registry) {
|
||||
wireguard.RegisterOutbound(registry)
|
||||
}
|
||||
|
||||
func registerWireGuardEndpoint(registry *endpoint.Registry) {
|
||||
wireguard.RegisterEndpoint(registry)
|
||||
wireguard.RegisterWARPEndpoint(registry)
|
||||
|
||||
@@ -7,19 +7,12 @@ import (
|
||||
|
||||
"github.com/sagernet/sing-box/adapter"
|
||||
"github.com/sagernet/sing-box/adapter/endpoint"
|
||||
"github.com/sagernet/sing-box/adapter/outbound"
|
||||
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 registerWireGuardOutbound(registry *outbound.Registry) {
|
||||
outbound.Register[option.LegacyWireGuardOutboundOptions](registry, C.TypeWireGuard, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.LegacyWireGuardOutboundOptions) (adapter.Outbound, error) {
|
||||
return nil, E.New(`WireGuard is not included in this build, rebuild with -tags with_wireguard`)
|
||||
})
|
||||
}
|
||||
|
||||
func registerWireGuardEndpoint(registry *endpoint.Registry) {
|
||||
endpoint.Register[option.WireGuardEndpointOptions](registry, C.TypeWireGuard, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.WireGuardEndpointOptions) (adapter.Endpoint, error) {
|
||||
return nil, E.New(`WireGuard is not included in this build, rebuild with -tags with_wireguard`)
|
||||
|
||||
Reference in New Issue
Block a user