package main import ( "net/http" _ "net/http/pprof" "flag" "log" "os" "fmt" "FRMS/internal/pkg/server" "FRMS/internal/pkg/logging" ) type listener interface { Start() } func NewListener(s string,ch chan error) (listener, error) { return server.NewListener(s, ch) } func main() { // lets get this bread // all we need to do is call the reactor coordinator and thats it go func() { fmt.Println(http.ListenAndServe("localhost:6060",nil)) }() flag.Usage = func() { w := flag.CommandLine.Output() fmt.Fprintf(w,"Usage: %s [eth*,wlan*,etc.]\n",os.Args[0]) } flag.Parse() if flag.NArg() != 1 { flag.Usage() log.Fatal("Specify ifconfig interface. See man ifconfig for further information") } ifconfig := string(flag.Arg(0)) ch := make(chan error) l, err := NewListener(ifconfig,ch) if err != nil { log.Fatal(err) } go l.Start() logging.Debug(logging.DStart, "server starting") err = <-ch // blocking to wait for any errors and keep alive otherwise if err != nil { //fmt.Printf("ERROR: %v\n",err) log.Fatal(err) } }