service.go 600 B

123456789101112131415161718192021222324252627
  1. package adapter
  2. import (
  3. "context"
  4. "github.com/sagernet/sing-box/log"
  5. "github.com/sagernet/sing-box/option"
  6. )
  7. type Service interface {
  8. Lifecycle
  9. Type() string
  10. Tag() string
  11. }
  12. type ServiceRegistry interface {
  13. option.ServiceOptionsRegistry
  14. Create(ctx context.Context, logger log.ContextLogger, tag string, serviceType string, options any) (Service, error)
  15. }
  16. type ServiceManager interface {
  17. Lifecycle
  18. Services() []Service
  19. Get(tag string) (Service, bool)
  20. Remove(tag string) error
  21. Create(ctx context.Context, logger log.ContextLogger, tag string, serviceType string, options any) error
  22. }