501 Star 3.1K Fork 870

GVP狂奔的蜗牛. / goproxy

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.go 636 Bytes
一键复制 编辑 原始数据 按行查看 历史
snail007 提交于 2021-05-21 23:37 . add go mod
package main
import (
"fmt"
"github.com/snail007/goproxy/services"
"log"
"os"
"os/signal"
"syscall"
)
const APP_VERSION = "3.0"
func main() {
err := initConfig()
if err != nil {
log.Fatalf("err : %s", err)
}
Clean(&service.S)
}
func Clean(s *services.Service) {
signalChan := make(chan os.Signal, 1)
cleanupDone := make(chan bool)
signal.Notify(signalChan,
os.Interrupt,
syscall.SIGHUP,
syscall.SIGINT,
syscall.SIGTERM,
syscall.SIGQUIT)
go func() {
for _ = range signalChan {
fmt.Println("\nReceived an interrupt, stopping services...")
(*s).Clean()
cleanupDone <- true
}
}()
<-cleanupDone
}
Go
1
https://gitee.com/snail/proxy.git
git@gitee.com:snail/proxy.git
snail
proxy
goproxy
master

搜索帮助