Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dns): Add zeroconf client options to DNS params #206

Closed
wants to merge 1 commit into from

Conversation

gabe565
Copy link
Contributor

@gabe565 gabe565 commented Dec 15, 2024

Hey! CastSponsorSkip dev here. I have some reports of errors due to zeroconf trying to bind to an IPv6 address when IPv6 is disabled in gabe565/CastSponsorSkip#54. I suspect zeroconf.SelectIPTraffic could help, so this PR adds support for variadic parameters. This also allows for selecting multiple interfaces, by leaving the iface param set to nil, then passing zeroconf.SelectIfaces directly.

Honestly, it would probably be best practice to remove the iface param, but that would be a breaking change. If you prefer, I could change this PR to do something like this:

func DiscoverCastDNSEntries(ctx context.Context, iface *net.Interface) (<-chan CastEntry, error) {
	var opts []zeroconf.ClientOption
	if iface != nil {
		opts = append(opts, zeroconf.SelectIfaces([]net.Interface{*iface}))
	}
	return DiscoverCastDNSEntriesV2(ctx, opts...)
}

func DiscoverCastDNSEntriesV2(ctx context.Context, opts ...zeroconf.ClientOption) (<-chan CastEntry, error) {
	resolver, err := zeroconf.NewResolver(opts...)
	if err != nil {
		return nil, fmt.Errorf("unable to create new zeroconf resolver: %w", err)
	}
        [...]

@gabe565 gabe565 closed this Dec 15, 2024
@vishen
Copy link
Owner

vishen commented Dec 15, 2024

@gabe565 Just wondering if this was meant to be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants