Multiple Answer RRs are not sent as separate entries
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 225
- Avg merge
- 15h 34m
- Merged PRs (30d)
- 3
Description
Hello,
Thank you for the library!
I am using library to discover specific services on local network by querying service type. There can be multiple services of the same type from same machine/device. There is an issue I have encountered, query responses that have multiple answers are not reported as separate entries.
Checkout wireshark screenshot:

Here `192.168.80.92` is the address of device running the client code. `192.168.80.182` is the server which responds to mdns queries (it is windows machine, uses bonjour service).
As you can see from screenshot, the are 2 services of type `_itxpt_http._tcp`. The `Answer` section contains 2 records, + additional records for each of these 2 answers.
The client code:
```go
package main
import (
"context"
"fmt"
"os"
"os/signal"
"time"
"github.com/hashicorp/mdns"
)
func main() {
timeout := 2 * time.Second
ctx, _ := signal.NotifyContext(context.Background(), os.Interrupt, os.Kill)
ctx, cancel := context.WithTimeout(ctx, timeout)
defer cancel()
entriesCh := make(chan *mdns.ServiceEntry, 4)
go mdns.Query(&mdns.QueryParam{
Service: "_itxpt_http._tcp",
Entries: entriesCh,
DisableIPv6: true,
Domain: "local",
Timeout: timeout,
})
for {
select {
case entry := <-entriesCh:
fmt.Println("Got new entry:", entry.Name)
case <-ctx.Done():
fmt.Println("done")
return
}
}
}
```
Client only registers 1 entry, with values of second answer:
```sh
$ go run client.go
Got new entry: vehicle-1000_inventory._itxpt_http._tcp.local.
done
```
Is there a way to get these values as two separate entries?
Like:
```sh
Got new entry: vehicle-1000_avms._itxpt_http._tcp.local.
Got new entry: vehicle-1000_inventory._itxpt_http._tcp.local.
```
It seems like the entry gets overwritten with the data from last answer in this loop: https://github.com/hashicorp/mdns/blob/v1.0.5/client.go#L272
Contributor guide
Assessment
This issue has not been assessed yet.