48 lines
650 B
Go
48 lines
650 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"flag"
|
||
|
"fmt"
|
||
|
"log"
|
||
|
"os"
|
||
|
"os/signal"
|
||
|
"syscall"
|
||
|
|
||
|
"git.loafle.net/commons_go/logging"
|
||
|
"git.loafle.net/overflow/overflow_probe_container_network/server"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
sockFile *string
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
sockFile = flag.String("sock", serverAddr, "Socket file")
|
||
|
flag.Parse()
|
||
|
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
|
defer logging.Logger().Sync()
|
||
|
|
||
|
s := server.New(*sockFile)
|
||
|
|
||
|
stop := make(chan os.Signal)
|
||
|
signal.Notify(stop, syscall.SIGINT)
|
||
|
|
||
|
go func() {
|
||
|
if err := s.Start(); nil != err {
|
||
|
log.Printf("Server: Start error %v", err)
|
||
|
return
|
||
|
}
|
||
|
}()
|
||
|
|
||
|
select {
|
||
|
case signal := <-stop:
|
||
|
fmt.Printf("Got signal: %v\n", signal)
|
||
|
}
|
||
|
|
||
|
s.Stop()
|
||
|
|
||
|
}
|