certificate_provider.go 966 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package adapter
  2. import (
  3. "context"
  4. "crypto/tls"
  5. "github.com/sagernet/sing-box/log"
  6. "github.com/sagernet/sing-box/option"
  7. )
  8. type CertificateProvider interface {
  9. GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)
  10. }
  11. type ACMECertificateProvider interface {
  12. CertificateProvider
  13. GetACMENextProtos() []string
  14. }
  15. type CertificateProviderService interface {
  16. Lifecycle
  17. Type() string
  18. Tag() string
  19. CertificateProvider
  20. }
  21. type CertificateProviderRegistry interface {
  22. option.CertificateProviderOptionsRegistry
  23. Create(ctx context.Context, logger log.ContextLogger, tag string, providerType string, options any) (CertificateProviderService, error)
  24. }
  25. type CertificateProviderManager interface {
  26. Lifecycle
  27. CertificateProviders() []CertificateProviderService
  28. Get(tag string) (CertificateProviderService, bool)
  29. Remove(tag string) error
  30. Create(ctx context.Context, logger log.ContextLogger, tag string, providerType string, options any) error
  31. }