package main import ( "context" "flag" "log" "time" "forge.cadoles.com/Pyxis/orion/emlid" ) var ( timeout = 10 * time.Second ) func init() { flag.DurationVar(&timeout, "timeout", timeout, "mDNS scan timeout") } func main() { flag.Parse() log.Println("Searching for ReachRS services on network...") ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() services, err := emlid.Discover(ctx) if err != nil { log.Fatal(err) } for _, s := range services { log.Println("Found:") log.Printf(" Name: '%s'", s.Name) log.Printf(" Hosts: %s", s.AddrV4) log.Printf(" Port: '%d'", s.Port) } }