-
Notifications
You must be signed in to change notification settings - Fork 221
Open
Description
The mdns.Lookup returns random results, when target service type is not found.
This is an undocumented and random response, which makes this library useless for service lookup.
github.com/hashicorp/mdns v1.0.5
import (
"fmt"
"io/ioutil"
"net"
"os"
"time"
"github.com/hashicorp/mdns"
)
func main() {
// Make a channel for results and start listening
entriesCh := make(chan *mdns.ServiceEntry, 4)
go func() {
for entry := range entriesCh {
fmt.Printf("Got new entry: %v\n", entry)
}
}()
// Start the lookup
mdns.Lookup("_pcm._tcp", entriesCh)
close(entriesCh)
}
Got new entry: &{PCM-Sink._pcm._tcp.local. mdns-C78.local. 192.168.1.66 <nil> 3333 path=/foobar|board=esp32 [path=/foobar board=esp32] 192.168.1.66 true true}
2023/03/01 11:52:10 [INFO] mdns: Closing client {true true 0xc000128038 0xc000128040 0xc000128048 0xc000128050 1 0xc00010e120}
alex@ubuntu:~/eclipse-workspace/mdns$ ./mdns
Got new entry: &{PCM-Sink._pcm._tcp.local. mdns-C78.local. 192.168.1.66 <nil> 3333 path=/foobar|board=esp32 [path=/foobar board=esp32] 192.168.1.66 true true}
2023/03/01 11:52:13 [INFO] mdns: Closing client {true true 0xc000014048 0xc000014050 0xc000014058 0xc000014060 1 0xc00001c1e0}
alex@ubuntu:~/eclipse-workspace/mdns$ ./mdns
2023/03/01 11:52:25 [INFO] mdns: Closing client {true true 0xc000014048 0xc000014050 0xc000014058 0xc000014060 1 0xc00001c1e0}
alex@ubuntu:~/eclipse-workspace/mdns$ ./mdns
Got new entry: &{mac-address-id._googlezone._tcp.local. mac-address-id.local. 192.168.1.42 ***}
Got new entry: &{mac-address-id._agentdvr._tcp.local. mac-address-id.agentdvr.local. 192.168.1.221 ***}
Got new entry: &{Chromecast-Ultra._googlecast._tcp.local. mac-address-id.local. 192.168.1.42 ***}
Got new entry: &{spotify._spotify-connect._tcp.local. 521797894248-0.local. 192.168.1.15 ***}
Got new entry: &{mac-address-id._googlezone._tcp.local. mac-address-id.local. 192.168.1.27 ***}
Got new entry: &{mac-address-id._googlezone._tcp.local. mac-address-id.local. 192.168.1.25 ***}
Got new entry: &{OctoPrint\ instance\ on\ octoprint._octoprint._tcp.local. octoprint.local. 192.168.1.53 ***}
Got new entry: &{mac._googlezone._tcp.local. mac.local. 192.168.1.26 ***}
Got new entry: &{mac._googlezone._tcp.local. mac.local. 192.168.1.28 ***}
Got new entry: &{iPhone._rdlink._tcp.local. iPhone.local. 192.168.1.55 ***}
Got new entry: &{Family\ Room\ TV._viziocast._tcp.local. CastTV.local. 192.168.1.103 ***}
Got new entry: &{xxx::windows11._oculusal_sp._tcp.local. windows11.local. 192.168.1.221 ***}
2023/03/01 11:52:27 [INFO] mdns: Closing client {true true 0xc000014048 0xc000014050 0xc000014058 0xc000014060 1 0xc00001c1e0}
Metadata
Metadata
Assignees
Labels
No labels