|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
"fmt"
|
|
|
|
"FRMS/internal/pkg/server"
|
|
|
|
)
|
|
|
|
|
|
|
|
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
|
|
|
|
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()
|
|
|
|
err = <-ch // blocking to wait for any errors and keep alive otherwise
|
|
|
|
if err != nil {
|
|
|
|
//fmt.Printf("ERROR: %v\n",err)
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|