mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-06-05 10:47:32 +03:00
Add daemon support
This commit is contained in:
20
experimental/daemon/interface.go
Normal file
20
experimental/daemon/interface.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package daemon
|
||||
|
||||
import "github.com/kardianos/service"
|
||||
|
||||
type Interface struct {
|
||||
server *Server
|
||||
}
|
||||
|
||||
func NewInterface(options Options) *Interface {
|
||||
return &Interface{NewServer(options)}
|
||||
}
|
||||
|
||||
func (d *Interface) Start(_ service.Service) error {
|
||||
return d.server.Start()
|
||||
}
|
||||
|
||||
func (d *Interface) Stop(_ service.Service) error {
|
||||
d.server.Close()
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user