diff --git a/client.go b/client.go index 62f1176..5ff5454 100644 --- a/client.go +++ b/client.go @@ -15,7 +15,7 @@ import ( type Client struct { name string - uuid string + info map[string]string host net.IP port int conn *castnet.Connection @@ -59,12 +59,16 @@ func (c *Client) Name() string { return c.name } -func (c *Client) SetUuid(uuid string) { - c.uuid = uuid +func (c *Client) SetInfo(info map[string]string) { + c.info = info } func (c *Client) Uuid() string { - return c.uuid + return c.info["id"] +} + +func (c *Client) Device() string { + return c.info["md"] } func (c *Client) String() string { diff --git a/cmd/cast/main.go b/cmd/cast/main.go index 269f470..ac6f640 100644 --- a/cmd/cast/main.go +++ b/cmd/cast/main.go @@ -225,7 +225,7 @@ func discoverCommand(c *cli.Context) { discover := discovery.NewService(ctx) go func() { for client := range discover.Found() { - fmt.Printf("Found: %s:%d '%s'\n", client.IP(), client.Port(), client.Name()) + fmt.Printf("Found: %s:%d '%s' (%s)\n", client.IP(), client.Port(), client.Name(), client.Device()) } }() fmt.Printf("Running discovery for %s...\n", timeout) diff --git a/discovery/service.go b/discovery/service.go index dca86b4..50d48f4 100644 --- a/discovery/service.go +++ b/discovery/service.go @@ -81,7 +81,7 @@ func (d *Service) listener(ctx context.Context) { client.SetName(decodeDnsEntry(name[0])) info := decodeTxtRecord(entry.Info) - client.SetUuid(info["id"]) + client.SetInfo(info) select { case d.found <- client: