1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-12 12:50:28 +08:00

fix(wg): stop signal handling

This commit is contained in:
源文雨
2024-07-12 00:25:49 +09:00
parent 02ad99abb2
commit da6ffcc283
6 changed files with 26 additions and 11 deletions

View File

@@ -6,7 +6,9 @@ import (
"flag"
"fmt"
"os"
"os/signal"
"strings"
"syscall"
base14 "github.com/fumiama/go-base16384"
curve "github.com/fumiama/go-x25519"
@@ -155,7 +157,12 @@ func main() {
os.Exit(0)
}
defer w.Stop()
mc := make(chan os.Signal, 1)
signal.Notify(mc, os.Interrupt, syscall.SIGQUIT, syscall.SIGTERM)
go func() {
<-mc
w.Stop()
}()
w.Run(upper.ServiceWireGold, upper.ServiceWireGold)
}