Refactor ACME support to certificate provider system

This commit is contained in:
世界
2026-03-14 22:43:20 +08:00
parent 7df171ff20
commit 734f3c9a21
15 changed files with 504 additions and 39 deletions
+12
View File
@@ -0,0 +1,12 @@
//go:build with_acme
package include
import (
"github.com/sagernet/sing-box/adapter/service"
"github.com/sagernet/sing-box/service/acme"
)
func registerACMEService(registry *service.Registry) {
acme.RegisterService(registry)
}
+20
View File
@@ -0,0 +1,20 @@
//go:build !with_acme
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 registerACMEService(registry *service.Registry) {
service.Register[option.ACMEServiceOptions](registry, C.TypeACME, func(ctx context.Context, logger log.ContextLogger, tag string, options option.ACMEServiceOptions) (adapter.Service, error) {
return nil, E.New(`ACME is not included in this build, rebuild with -tags with_acme`)
})
}
+1
View File
@@ -130,6 +130,7 @@ func ServiceRegistry() *service.Registry {
resolved.RegisterService(registry)
ssmapi.RegisterService(registry)
registerACMEService(registry)
registerDERPService(registry)
registerCCMService(registry)