Joining the different fields into a single string is problematic when
the fields contain the separator character “|” themselves.
As an example, I’ve named my chromecast “Hendrix|test”, and this happens
when I print a ServiceEntry:
ServiceEntry: &{Name:Hendrix|test._googlecast._tcp.local. Host:Hendrix|test.local. AddrV4:10.0.0.184 AddrV6:<nil> Port:8009 Info:id=3fc948dbfebcf5d7ec77d7b043dce81e|ve=04|md=Chromecast Audio|ic=/setup/icon.png|fn=Hendrix|test|ca=4|st=0|bs=FA8FCA928304|rs= Addr:10.0.0.184 hasTXT:true sent:true}
When using strings.Split, I would not correctly parse the fn= field.
With the new InfoFields member, this problem can be avoided entirely.
- Add WantUnicastResponse to allow sending mDNS queries that desire unicast
responses (see section 5.4 in RFC6762).
- Listen for UDP packets sent to the mDNS multicast addresses ("ipv4:
224.0.0.251", ipv6: "ff02::fb")
- Fix bug on line 177 of client.go: Ignored error during sendQuery.
- Add TODO comments regarding unimplemented features of mDNS protocol.
- Add error logging statement when DNS packet parsing failed.