2022-06-30 21:27:56 +08:00
|
|
|
package adapter
|
|
|
|
|
|
2025-03-29 17:24:34 +08:00
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
"github.com/sagernet/sing-box/log"
|
|
|
|
|
"github.com/sagernet/sing-box/option"
|
|
|
|
|
)
|
|
|
|
|
|
2022-07-21 21:03:41 +08:00
|
|
|
type Service interface {
|
2025-03-29 17:24:34 +08:00
|
|
|
Lifecycle
|
|
|
|
|
Type() string
|
|
|
|
|
Tag() string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ServiceRegistry interface {
|
|
|
|
|
option.ServiceOptionsRegistry
|
|
|
|
|
Create(ctx context.Context, logger log.ContextLogger, tag string, serviceType string, options any) (Service, error)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ServiceManager interface {
|
|
|
|
|
Lifecycle
|
|
|
|
|
Services() []Service
|
|
|
|
|
Get(tag string) (Service, bool)
|
|
|
|
|
Remove(tag string) error
|
|
|
|
|
Create(ctx context.Context, logger log.ContextLogger, tag string, serviceType string, options any) error
|
2022-06-30 21:27:56 +08:00
|
|
|
}
|