diff --git a/obfsshd/server.go b/obfsshd/server.go index dc665c8..ad4168a 100644 --- a/obfsshd/server.go +++ b/obfsshd/server.go @@ -9,6 +9,8 @@ import ( "io/ioutil" "net" "os" + "os/signal" + "syscall" "github.com/fangdingjun/go-log" "github.com/fangdingjun/obfssh" @@ -154,6 +156,12 @@ func main() { } }(lst) } - select {} + + ch := make(chan os.Signal, 2) + signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM) + select { + case s := <-ch: + log.Printf("received signal %s, exit.", s) + } }