Net::IRR(3pm)
π Net::IRR π
okay bestie, so this is Net::IRR β it's the Perl interface to the Internet Route Registry Daemon, and it lives in the User Contributed Perl Documentation section of your man pages. we're about to make friends with an IRRd server and it's gonna be a whole vibe. π¦
β¨ SYNOPSIS β¨
no notes, this is the whole flex right here:
use Net::IRR;
my $host = 'whois.radb.net';
my $i = Net::IRR->connect( host => $host )
or die "can't connect to $host\n";
my $version = $i->get_irrd_version();
print "IRRd version: $version\n" unless $i->error();
print "routes by origin AS5650\n";
my @routes = $i->get_routes_by_origin("AS5650");
print "found " . scalar(@routes) . " routes\n";
print "AS-SET for AS5650\n";
if (my @ases = $i->get_as_set("AS-ELI", 1)) {
print "found " . scalar(@ases) . " AS's\n";
print "@ases\n";
}
else {
print "none found\n";
}
my $aut_num = $i->match("aut-num","as5650")
or warn("can't find object: " . $i->error . "\n");
print $i->route_search("208.186.0.0/15", Net::IRR::EXACT_MATCH)
. " originates 208.186.0.0/15\n";
print $i->get_sync_info(), "\n";
$i->disconnect();
like. look at her go. π
π DESCRIPTION π
So this module hands you an object oriented perl interface to the Internet Route Registry. The interface uses the RIPE/RPSL Tool Query Language, which is defined in Appendix B of the IRRd User Guide. That guide lives at http://www.irrd.net/ β but lowkey? you do not need to understand the query language to use this module. she handles it. periodt. π
Net::IRR supports IRRd's multiple-command mode. Multiple-command mode is giving main character energy for intensive queries, because only one TCP connection needs to be made for multiple queries. The interface also allows for additional queries that aren't supported by standard UNIX whois utitilies. π (yes, that's how the original spells it, we don't touch the details bestie)
Hopefully this module will stimulate development of new Route Registry tools written in Perl. An example of Route Registry tools can be found by googling for RAToolset, which is now known as the IRRToolset. The RAToolset was originally developed by ISI, http://www.isi.edu/, and is now maintained by RIPE, http://www.ripe.net/. slay, legacy code that's still thriving. π
π METHODS π
π Net::IRR->connect( host => $hostname, port => $port_number )
This class method is what you use to connect to a route registry server. Net::IRR->connect() is also the constructor for the Net::IRR class. The constructor hands you back a Net::IRR object once it's connected to the IRR server, or undef if it fails. so like, check that return value. don't be messy. π
π $whois->disconnect()
This method closes the connection to the route registry server. bye bestie π«Ά
π $whois->quit()
Same as $whois->disconnect(). literally the same. twin behavior.
π $whois->get_routes_by_origin('AS5650')
Get routes with a specified origin AS. This method takes an autonomous system number and returns the set of routes it originates. Upon success this method returns a list of routes in list context or a string of space separated routes. undef is returned upon failure. π
π $whois->get_ipv6_routes_by_origin('AS5650')
Same as $whois->get_routes_by_origin(), but returns IPv6 instead of IPv4 routes. glow up.
π $whois->get_routes_by_community($community_name)
β οΈ This method is for RIPE-181 only. It is not supported by RPSL.
This method takes a community object name and returns the set of routes it originates. Upon success this method returns a list of routes in list context or a string of space separated routes. undef is returned upon failure.
π $whois->get_sync_info()
This method provides database synchronization information. This makes it possible to view the mirror status of a database. This method optionally takes the name of a database such as RADB. If no argument is given the method will return information about all databases originating from and mirrored by the registry server. If the optional argument is given the database specified will be checked and it's status returned. This method returns undef if no database exists or if access is denied. π«
π $whois->get_as_set("AS-ELI", 1)
This method takes an AS-SET object name and returns the ASNs registered for the AS-SET object. The method takes an optional second argument which enables AS-SET key expansion, since an AS-SET can contain both ASNs and AS-SET keys. undef is returned upon failure.
π $whois->get_route_set("ROUTES-ELI", 1)
This method takes an ROUTE-SET object name and returns the ROUTEs registered for the ROUTE-SET object. The method takes an optional second argument which enables ROUTE-SET key expansion, since a ROUTE-SET can contain both ROUTEs and ROUTE-SET keys. undef is returned upon failure.
π $whois->match('aut-num', 'AS5650'); β get RPSL objects registered in the database
The example above will retrieve the aut-num object with the key AS5650. This method will return the first RPSL object matching the object type and name specified as parameters to $whois->match(). undef is returned upon failure.
π $whois->get_irrd_version()
This methods takes no arguments and returns the version of the IRRd server that was specified as the hostname to the connect() method. no cap, that's it. β
π $whois->route_search("208.186.0.0/15", EXACT_MATCH)
The method is used to search for route objects. The method takes two arguments, a route and an optional flag. The flag can be one of four values: EXACT_MATCH, LEVEL_ONE, LESS_SPECIFIC, MORE_SPECIFIC. These constants can be imported into your namespace by using the :all or :route export tag when importing the Net::IRR module.
use Net::IRR qw( :route );
print "EXACT_MATCH = " . EXACT_MATCH . "\n";
π $whois->sources()
This method is used to both get and set the databases used for Internet Route Registry queries. The $whois->sources() method accepts a list of databases in the order they should be searched. If no arguments are given the method will return a list of all the databases mirrored by the route registry you are connected to. she's versatile. π
π $whois->update($database, 'ADD', $rpsl_rr_object)
This method is used to add or delete a database object. This method takes three arguments. The first argument is the database to update. The second argument is the action, which can be either "ADD" or "DEL". The third and final required argument is a route object in RPSL format. all three. required. don't skip one. π
π $whois->error()
Most Net::IRR methods set an error message when errors occur. These errors can only be accessed by using the error() method. so if something's giving nothing back, check here first bestie. π₯
π AUTHOR π
Todd Caine <todd.caine@gmail.com>
π¦ SEE ALSO π¦
- Main IRRd Site
- RIPE/RPSL Tool Query Language
http://www.irrd.net/irrd-user.pdf, Appendix B
πΈ COPYRIGHT πΈ
Copyright 2002-2010 by Todd Caine. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page bestie!! this one ships with perl v5.38.2 and it's dated 2024-02-24, so go forth and query some routes πβ¨π
π¦ where this page comes from
- debian trixie: libnet-irr-perl 0.10-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libnet-irr-perl 0.10-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libnet-irr-perl 0.10-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libnet-irr-perl 0.10-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms