brutella / dnssd

This library implements Multicast DNS (mDNS) and DNS-Based Service Discovery (DNS-SD) for Zero Configuration Networking in Go.
MIT License
207 stars 33 forks source link

(#23) remove default listening responder #24

Closed ripienaar closed 3 years ago

ripienaar commented 3 years ago

Any program that uses this, or any code that depends on it, will by default and without any way to opt out open port 5353 and do some mdns communications over it.

I don't think this is useful since any real use will create a dedicated responder.

I also cannot find this default responder used in any code anywhere

Signed-off-by: R.I.Pienaar rip@devco.net

ripienaar commented 3 years ago

Another option, which wont change behaviour for anyone but allow us to opt out of this behaviour at build time is this:

var DefaultResponder Responder
var StartDefaultResponder = "true"

if StartDefaultResponder == "true" {
   var DefaultResponder, _ = NewResponder()
}

This way I can do go build -ldflags="-X 'github.com/brutella/dnssd.StartDefaultResponder=false'" to turn this off, though I think this is a bad default thing to do to any and all projects that happen to include this packge so would rather prefer the option to remove this behaviour entirely

ripienaar commented 3 years ago

@brutella any chance we can get this merged? this way I can at least refer to it in my go.mod and resolve this matter

brutella commented 3 years ago

Yeah, I think yours is a good temporary solution.