mirror of
https://github.com/xtaci/kcptun.git
synced 2024-04-21 12:32:32 +00:00
30 lines
394 B
Go
30 lines
394 B
Go
// +build linux darwin freebsd
|
|
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
kcp "github.com/xtaci/kcp-go/v5"
|
|
)
|
|
|
|
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())
|
|
}
|
|
}
|
|
}
|