mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-04-11 17:47:20 +10:00
Add claude code multiplexer service
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`)
|
||||
})
|
||||
}
|
||||
@@ -134,6 +134,7 @@ func ServiceRegistry() *service.Registry {
|
||||
ssmapi.RegisterService(registry)
|
||||
|
||||
registerDERPService(registry)
|
||||
registerCCMService(registry)
|
||||
|
||||
return registry
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user