1 Star 0 Fork 887

张耀心/goproxy

forked from 狂奔的蜗牛./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
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/zhang-yaoxin/proxy.git
git@gitee.com:zhang-yaoxin/proxy.git
zhang-yaoxin
proxy
goproxy
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385