strip off AS prefix
This commit is contained in:
parent
f2eda74074
commit
54abd60239
@ -375,6 +375,9 @@ sub set_asn {
|
||||
return if ! $self->{GeoIPASNum};
|
||||
|
||||
my $asn = $self->{GeoIPASNum}->name_by_addr($ip) or return;
|
||||
if ('AS' eq substr($asn, 0, 2)) {
|
||||
$asn = substr($asn, 2);
|
||||
}
|
||||
$self->qp->connection->notes('geoip_asn', $asn);
|
||||
return $asn;
|
||||
}
|
||||
|
@ -176,10 +176,10 @@ sub test_set_asn {
|
||||
|
||||
$self->qp->connection->remote_ip('24.24.24.24');
|
||||
$asn = $self->set_asn();
|
||||
ok( $self->connection->notes('geoip_asn') =~ /^AS11351/, "note has: $asn");
|
||||
ok( $self->connection->notes('geoip_asn') =~ /^11351/, "note has: $asn");
|
||||
|
||||
$self->qp->connection->remote_ip('66.128.51.163');
|
||||
$asn = $self->set_asn();
|
||||
|
||||
ok( $self->connection->notes('geoip_asn') =~ /^AS7819/, "note has: $asn");
|
||||
ok( $self->connection->notes('geoip_asn') =~ /^7819/, "note has: $asn");
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user