mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-12-27 16:45:39 +08:00
42 lines
675 B
Go
42 lines
675 B
Go
|
package adapter
|
||
|
|
||
|
type StartStage uint8
|
||
|
|
||
|
const (
|
||
|
StartStateInitialize StartStage = iota
|
||
|
StartStateStart
|
||
|
StartStatePostStart
|
||
|
StartStateStarted
|
||
|
)
|
||
|
|
||
|
var ListStartStages = []StartStage{
|
||
|
StartStateInitialize,
|
||
|
StartStateStart,
|
||
|
StartStatePostStart,
|
||
|
StartStateStarted,
|
||
|
}
|
||
|
|
||
|
func (s StartStage) Action() string {
|
||
|
switch s {
|
||
|
case StartStateInitialize:
|
||
|
return "initialize"
|
||
|
case StartStateStart:
|
||
|
return "start"
|
||
|
case StartStatePostStart:
|
||
|
return "post-start"
|
||
|
case StartStateStarted:
|
||
|
return "start-after-started"
|
||
|
default:
|
||
|
panic("unknown stage")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
type NewService interface {
|
||
|
NewStarter
|
||
|
Close() error
|
||
|
}
|
||
|
|
||
|
type NewStarter interface {
|
||
|
Start(stage StartStage) error
|
||
|
}
|