Skip to content

Commit

Permalink
Removes "asnroots" profile parameter - zonemaster#1052
Browse files Browse the repository at this point in the history
This profile parameter was deprecated in 2020.1.

- Remove code
- Remove documentation
- Replace unitary tests from "asnroots" to "asn_db.style" and "asn_db.sources"
  • Loading branch information
tgreenx committed Nov 7, 2023
1 parent 05bb73f commit ba76a5b
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 128 deletions.
20 changes: 3 additions & 17 deletions lib/Zonemaster/Engine/ASNLookup.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,9 @@ sub get_with_prefix {
my ( $class, $ip ) = @_;

if ( not @db_sources ) {
#
# Backward compatibility in case asnroots is still configured in profile
# but we prefer new model if present
#
my @roots;
if ( Zonemaster::Engine::Profile->effective->get( q{asnroots} ) ) {
@roots = map { name( $_ ) } @{ Zonemaster::Engine::Profile->effective->get( q{asnroots} ) };
}
if ( scalar @roots ) {
@db_sources = @roots;
$db_style = q{cymru};
}
else {
$db_style = Zonemaster::Engine::Profile->effective->get( q{asn_db.style} );
my %db_sources = %{ Zonemaster::Engine::Profile->effective->get( q{asn_db.sources} ) };
@db_sources = map { name( $_ ) } @{ $db_sources{ $db_style } };
}
$db_style = Zonemaster::Engine::Profile->effective->get( q{asn_db.style} );
my %db_sources = %{ Zonemaster::Engine::Profile->effective->get( q{asn_db.sources} ) };
@db_sources = map { name( $_ ) } @{ $db_sources{ $db_style } };
}

if ( not ref( $ip ) or not $ip->isa( 'Net::IP::XS' ) ) {
Expand Down
22 changes: 0 additions & 22 deletions lib/Zonemaster/Engine/Profile.pm
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,6 @@ my %profile_properties_details = (
q{no_network} => {
type => q{Bool}
},
q{asnroots} => {
type => q{ArrayRef},
test => sub {
foreach my $ndd ( @{$_[0]} ) {
die "Property asnroots has a NULL item" if not defined $ndd;
die "Property asnroots has a non scalar item" if not defined ref($ndd);
die "Property asnroots has an item too long" if length($ndd) > 255;
foreach my $label ( split /[.]/, $ndd ) {
die "Property asnroots has a non domain name item" if $label !~ /^[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?$/;
}
}
}
},
q{asn_db.style} => {
type => q{Str},
test => sub {
Expand Down Expand Up @@ -740,15 +727,6 @@ A boolean. If true, network traffic is forbidden. Default false.
Use when you want to be sure that any data is only taken from a preloaded
cache.
=head2 asnroots (DEPRECATED)
An arrayref of domain names. Default C<["asnlookup.zonemaster.net",
"asnlookup.iis.se", "asn.cymru.com"]>.
The domains will be assumed to be Cymru-style AS lookup zones.
Normally only the first name in the list will be used, the rest are
backups in case the earlier ones don't work.
=head2 asn_db.style
A string that is either C<"Cymru"> or C<"RIPE">. Defines which method will
Expand Down
Loading

0 comments on commit ba76a5b

Please sign in to comment.