You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.2 KiB
Go

package main
3 years ago
import (
"net/http"
_ "net/http/pprof"
"flag"
"log"
"os"
"fmt"
"FRMS/internal/pkg/logging"
3 years ago
"FRMS/internal/pkg/server"
3 years ago
)
type listener interface {
3 years ago
Start()
}
func NewListener(s string,ch chan error) (listener, error) {
return server.NewListener(s, ch)
}
3 years ago
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()
fmt.Println("Specify ifconfig interface. See man ifconfig for further information")
os.Exit(1)
}
ifconfig := string(flag.Arg(0))
3 years ago
ch := make(chan error)
l, err := NewListener(ifconfig,ch)
if err != nil {
log.Fatal(err)
}
go l.Start()
logging.Debug(logging.DStart, "CCO 01 Server started")
err = <-ch // blocking to wait for any errors and keep alive otherwise
if err != nil {
3 years ago
//fmt.Printf("ERROR: %v\n",err)
log.Fatal(err)
}
}