Add OpenAI Codex Multiplexer service

This commit is contained in:
世界
2025-12-16 22:09:02 +08:00
parent a89680fa2d
commit e8620587dd
24 changed files with 1673 additions and 8 deletions

12
include/ocm.go Normal file
View 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
View 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`)
})
}

View File

@@ -136,6 +136,7 @@ func ServiceRegistry() *service.Registry {
registerDERPService(registry)
registerCCMService(registry)
registerOCMService(registry)
return registry
}