Add daemon support

This commit is contained in:
世界
2022-08-13 18:37:18 +08:00
parent a940703ae1
commit f48f8c5d1c
8 changed files with 667 additions and 1 deletions

View 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
}