Files
p2p_tun/p2pserver/signal.go
T
2018-11-24 03:04:43 -08:00

30 lines
403 B
Go
Executable File

// +build linux darwin freebsd
package main
import (
"log"
"os"
"os/signal"
"syscall"
kcp "github.com/hikaricai/p2p_tun/kcp-go"
)
func init() {
go sigHandler()
}
func sigHandler() {
ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGUSR1)
signal.Ignore(syscall.SIGPIPE)
for {
switch <-ch {
case syscall.SIGUSR1:
log.Printf("KCP SNMP:%+v", kcp.DefaultSnmp.Copy())
}
}
}