Add cloudflared inbound support
This commit is contained in:
12
include/cloudflared.go
Normal file
12
include/cloudflared.go
Normal file
@@ -0,0 +1,12 @@
|
||||
//go:build with_cloudflared
|
||||
|
||||
package include
|
||||
|
||||
import (
|
||||
"github.com/sagernet/sing-box/adapter/inbound"
|
||||
"github.com/sagernet/sing-box/protocol/cloudflare"
|
||||
)
|
||||
|
||||
func registerCloudflaredInbound(registry *inbound.Registry) {
|
||||
cloudflare.RegisterInbound(registry)
|
||||
}
|
||||
20
include/cloudflared_stub.go
Normal file
20
include/cloudflared_stub.go
Normal file
@@ -0,0 +1,20 @@
|
||||
//go:build !with_cloudflared
|
||||
|
||||
package include
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sagernet/sing-box/adapter"
|
||||
"github.com/sagernet/sing-box/adapter/inbound"
|
||||
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 registerCloudflaredInbound(registry *inbound.Registry) {
|
||||
inbound.Register[option.CloudflaredInboundOptions](registry, C.TypeCloudflared, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.CloudflaredInboundOptions) (adapter.Inbound, error) {
|
||||
return nil, E.New(`Cloudflared is not included in this build, rebuild with -tags with_cloudflared`)
|
||||
})
|
||||
}
|
||||
@@ -64,6 +64,7 @@ func InboundRegistry() *inbound.Registry {
|
||||
anytls.RegisterInbound(registry)
|
||||
|
||||
registerQUICInbounds(registry)
|
||||
registerCloudflaredInbound(registry)
|
||||
registerStubForRemovedInbounds(registry)
|
||||
|
||||
return registry
|
||||
|
||||
Reference in New Issue
Block a user