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

Custom DNS resolver #31

Closed
jesusprubio opened this issue Apr 21, 2024 · 6 comments
Closed

Custom DNS resolver #31

jesusprubio opened this issue Apr 21, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@jesusprubio
Copy link
Owner

No description provided.

@jesusprubio jesusprubio added enhancement New feature or request good first issue Good for newcomers labels Apr 21, 2024
@mohitsethia
Copy link
Contributor

Hi @jesusprubio , I would like to contribute to this if you could help me a bit by adding more description to the issue, and what needs to be done.

@jesusprubio
Copy link
Owner Author

Hi @mohitsethia , I appreciate it.

The idea is to use a custom DNS resolver here. Similar to this example: https://stackoverflow.com/a/59889883.

We also need to add a new option in the CLI here. For example: flag.StringVar(&opts.DNSResolver, "r", "", "DNS resolution server")

By default, the one defined in the operating system should be used (like now).

@mohitsethia
Copy link
Contributor

mohitsethia commented Jul 11, 2024

Thanks for sharing.
So, there are 2 ways of doing it, adding another protocol with "customDNSProbe" key and use it based on the input received from options DNSResolver flag while getting GetProtocolByIDWithCustomDNSResolver(id, dnsResolver) *pkg.Protocol or ProtocolByID(opts Options) *pkg.Protocol that returns the customDNSProbe(domain, timeout) and implements the custom resolver.
Or pass the opts struct to the dnsProbe (have to keep it consistent for all Probe implementations) methods to be able to check if we have custom dns resolver not empty then proceed with the custom dns resolver otherwise the default one.
How would you suggest passing this info that we have a custom DNS resolver to the dnsProbe function?

@mohitsethia
Copy link
Contributor

mohitsethia commented Jul 12, 2024

@jesusprubio Just an sample of how we can do additionally by adding WithDNSResolver method over Protocol. PR. If this look fine to you, maybe I can add tests too for this.

@jesusprubio jesusprubio removed the good first issue Good for newcomers label Jul 13, 2024
@jesusprubio
Copy link
Owner Author

My fault, probably this is not the best good first issue. It implies more changes than I initially thought.

@mohitsethia
Copy link
Contributor

mohitsethia commented Jul 13, 2024

Hey @jesusprubio , sorry to bother you. I have added another way of doing this change, this solution is better & more simple. To keep it consistent I have added the other Probes (http & tcp) under receiver method too. How does this look?

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

No branches or pull requests

2 participants