Refactor ACME support to certificate provider system
This commit is contained in:
@@ -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)
|
||||
}
|
||||
@@ -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`)
|
||||
})
|
||||
}
|
||||
@@ -130,6 +130,7 @@ func ServiceRegistry() *service.Registry {
|
||||
|
||||
resolved.RegisterService(registry)
|
||||
ssmapi.RegisterService(registry)
|
||||
registerACMEService(registry)
|
||||
|
||||
registerDERPService(registry)
|
||||
registerCCMService(registry)
|
||||
|
||||
Reference in New Issue
Block a user