Export mdnsService struct or rename the Service interface for mDNS
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.9k
- Forks
- 1.3k
- Avg merge
- 13d 21h
- Merged PRs (30d)
- 1
Description
I would like to have my own struct, where I can assign mDNS service to [`mdns.NewMdnsService()`](https://github.com/libp2p/go-libp2p/blob/578af0c651a61549cc51a08c70f611c8977ae75e/p2p/discovery/mdns/mdns.go#L53):
```go
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in p2p/discovery/mdns/mdns.go at NewMdnsService and inspect the returned service's lifecycle methods, especially Start and Close. Compare the requested exported struct with the existing public API and determine which naming or exposure approach preserves usable mDNS startup and shutdown behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100