Closed jesusprubio closed 1 week ago
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).
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?
@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.
My fault, probably this is not the best good first issue
. It implies more changes than I initially thought.
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?
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.