Rename cloudflare-tunnel type to cloudflared

This commit is contained in:
世界
2026-03-24 16:40:21 +08:00
parent af2afc529b
commit 2cf2ff3f33
43 changed files with 83 additions and 82 deletions

View File

@@ -1,20 +0,0 @@
//go:build !with_cloudflare_tunnel
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 registerCloudflareTunnelInbound(registry *inbound.Registry) {
inbound.Register[option.CloudflareTunnelInboundOptions](registry, C.TypeCloudflareTunnel, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.CloudflareTunnelInboundOptions) (adapter.Inbound, error) {
return nil, E.New(`Cloudflare Tunnel is not included in this build, rebuild with -tags with_cloudflare_tunnel`)
})
}

View File

@@ -1,4 +1,4 @@
//go:build with_cloudflare_tunnel
//go:build with_cloudflared
package include
@@ -7,6 +7,6 @@ import (
"github.com/sagernet/sing-box/protocol/cloudflare"
)
func registerCloudflareTunnelInbound(registry *inbound.Registry) {
func registerCloudflaredInbound(registry *inbound.Registry) {
cloudflare.RegisterInbound(registry)
}

View 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`)
})
}

View File

@@ -66,7 +66,7 @@ func InboundRegistry() *inbound.Registry {
anytls.RegisterInbound(registry)
registerQUICInbounds(registry)
registerCloudflareTunnelInbound(registry)
registerCloudflaredInbound(registry)
registerStubForRemovedInbounds(registry)
return registry