Net-RDAP
view release on metacpan or search on metacpan
lib/Net/RDAP/Registry.pm view on Meta::CPAN
package Net::RDAP::Registry;
use Carp qw(croak);
use File::Basename qw(basename);
use File::Path qw(make_path);
use File::Slurp;
use File::Spec;
use File::stat;
use File::XDG;
use JSON;
use POSIX qw(getpwuid);
use Net::RDAP::UA;
use Net::RDAP::Registry::IANARegistry;
use vars qw($UA $REGISTRY $CACHE_DIR);
use constant {
IP4_URL => 'https://data.iana.org/rdap/ipv4.json',
IP6_URL => 'https://data.iana.org/rdap/ipv6.json',
DNS_URL => 'https://data.iana.org/rdap/dns.json',
ASN_URL => 'https://data.iana.org/rdap/asn.json',
TAG_URL => 'https://data.iana.org/rdap/object-tags.json',
CACHE_TTL => 86400,
};
use strict;
our $UA;
our $REGISTRY = {};
our $CACHE_DIR = File::XDG->new(path_class => 'File::Spec', name => __PACKAGE__)->cache_home;
#
# untaint $CACHE_DIR
#
if ($CACHE_DIR =~ /(.+)/) {
$CACHE_DIR = $1;
}
=pod
=head1 NAME
L<Net::RDAP::Registry> - a module which provides an interface to the IANA RDAP
registries.
=head1 SYNOPSIS
use Net::RDAP::Registry;
use Net::IP;
use Net::ASN;
$url = Net::RDAP::Registry->get_url(Net::DNS::Domain->new('example.com'));
$url = Net::RDAP::Registry->get_url(Net::IP->new('192.168.0.1'));
$url = Net::RDAP::Registry->get_url(Net::IP->new('2001:DB8::/32'));
$url = Net::RDAP::Registry->get_url(Net::ASN->new(65536));
$url = Net::RDAP::Registry->get_url('ABC123-TAG');
=head1 DESCRIPTION
RFC 7484 describes how RDAP clients can find the authoritative RDAP
service for a given internet resource using one of several IANA
registries.
This module provides an interface to these registries, and will return
a L<URI> object corresponding to the URL for a resource obtained from
them.
L<Net::RDAP::Registry> downloads the registry files from the IANA
website and will maintain up-to-date copies of those files locally.
=head1 METHODS
( run in 1.650 second using v1.01-cache-2.11-cpan-437f7b0c052 )