ipisp icon indicating copy to clipboard operation
ipisp copied to clipboard

Allow providing a custom DNS resolver

Open gnuletik opened this issue 9 months ago • 1 comments

A new resolver is created at the start of the LookupIP and LookupASN functions.

https://github.com/ammario/ipisp/blob/a1960f6b8c8e16b3e91b7694d2cb480df3054582/dnsclient.go#L18

Would it be possible to provide a custom resolver in the following way?

client := ipisp.NewClient(&net.Resolver{})
client.LookupIP(...)
client.LookupASN(...)

gnuletik avatar Nov 17 '23 10:11 gnuletik

I see the value in that. We could follow suit of net/http and have package-level methods that use a DefaultDNSClient but then give users the ability to specify their own. Unfortunately I don't have time to work on this right now but I welcome contributions.

ammario avatar Nov 17 '23 18:11 ammario