SDK add-on: How to perform DNS lookup

In an SDK-based add-on I need to handle resources that are not publicly available differently.
for file: and resource: etc. URLs its rather obvious that they are, for https?: It would be a very good approximation to know the host-ip of those resources.

So my question is: How can I obtain that?

You can use the nsIDNSService or implement your own strategy, either polling system DNS services or using a JS based DNS implementation.

1 Like

Very nice, thanks!

I have one more question: does record.getNextAddrAsString() always return IP adresses, or do I have to call resolve() recursively on the result unitl it is an IP address?

No idea, easiest way to find out is to see what you get when you query something defined with a CNAME pointing somewhere else. I would assume it always returns an IP, especially looking at the IDL definition of nsIDNSRecord.

Yes, it does look that way.
But it also can’t harm to have a fallback in place.
Thanks anyway!