johnsonjh/gfcptun

View on GitHub
server/signal.go

Summary

Maintainability
A
1 hr
Test Coverage
//go:build linux || darwin || freebsd
// +build linux darwin freebsd

package main

import (
    "log"
    "os"
    "os/signal"
    "syscall"

    kcp "github.com/johnsonjh/gfcp"
)

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("GFCP SNSI:%+v", kcp.DefaultSnsi.Copy())
        }
    }
}