Corion has asked for the wisdom of the Perl Monks concerning the following question:

Is there any IPv6-capable "paranoid" DNS resolver like Net::DNS::Paranoid, except with support for IPv6?

I'm currently writing a "link preview" fetcher, using Mojo::UserAgent. As this preview fetcher mildly implies fetching user-generated and/or user-controlled links (even though the application is primarily for myself), I'm looking for something like LWPx::ParanoidAgent / LWP::UserAgent::Paranoid / HTTP::Tiny::Paranoid, but for Mojolicious.

I have already resolved (hah!) myself to writing Mojo::UserAgent::Paranoid, which delegates (as they all do) the DNS resolution to Net::DNS::Paranoid, a DNS resolver class that blocks hosts and IP addresses that are unlikely URLs for external services, especially localhost and other internal networks (192.168.*, 10.* and the multicast addresses).

This is all fine and good, if it weren't for IPv6. Net::DNS::Paranoid happily lets ::1 through, as the code mostly looks at IPv4 addresses and its DNS resolution also only speaks A records, not AAAA.

Simply adding ::1 (localhost in IPv6-speak) to the list of blocked hosts is a good start, but I would also want to block the multicast and link-local IPv6 addresses and some others. So, I'm mildly looking towards extending Net::DNS::Paranoid to also support IPv6, but maybe somebody has already done the work, or has links to an existing implementation in another language where I can crib the pitfalls and footguns from.

Replies are listed 'Best First'.
Re: Net::DNS::Paranoid and IPv6
by hippo (Archbishop) on Oct 23, 2025 at 09:44 UTC
    So, I'm mildly looking towards extending Net::DNS::Paranoid to also support IPv6

    That sounds like the best approach to me. Have you contacted Tokuhiro? He doesn't seem to be as active these days which is a real shame but maybe he would be open to a PR or co-maint if not to adding the extras himself. I don't see the point in there being another dist just for IPv6 - better to have one that covers both bases.


    🦛

      Pull request created.

      This was surprisingly simple, as all that was needed was querying for IPv6 addresses, and then adding the sanity checks for IPv6 addresses.