diff --git a/cmd/mconnect-discover/main.go b/cmd/mconnect-discover/main.go new file mode 100644 index 0000000..8f46c11 --- /dev/null +++ b/cmd/mconnect-discover/main.go @@ -0,0 +1,32 @@ +package main + +import ( + "context" + "fmt" + "os" + + "github.com/bboozzoo/mconnect/discovery" + "github.com/bboozzoo/mconnect/logger" +) + +var Stderr = os.Stderr + +func main() { + ctx := context.Background() + ctx = logger.WithContext(ctx, logger.New()) + + log := logger.FromContext(ctx) + + log.Printf("setting up listener") + l, err := discovery.NewListener() + if err != nil { + fmt.Fprintf(Stderr, "error: failed to setup listener: %v\n", + err) + os.Exit(1) + } + + for { + log.Printf("receive wait") + l.Receive(ctx) + } +}