go-libp2p
go-libp2p copied to clipboard
Export mdnsService struct or rename the Service interface for mDNS
I would like to have my own struct, where I can assign mDNS service to mdns.NewMdnsService():
type MyStruct struct {
mdnsService *mdns.mdnsService // Error: name mdnsService not exported by package typesinternal#UnexportedName
}
// Meaning, this is currently NOT possible
MyStruct.mdnsService = mdns.NewMdnsService(p2pHost, "something", &mDNSNotifee{host: p2pHost})
if err := MyStruct.mdnsService.Start(); err != nil {
panic(err)
} else {
log.Println("mDNS service started")
}
If you would expose the mdns.mdnsService struct (just like you already do expose dht.IpfsDHT), I could assign it to my own struct.
Meaning it be much easier to later call a MyStruct.mdnsService.Close() on it for example. Maybe its just me, but I think it makes sense to export a struct that is getting returned by a public function.