File: netspeed.pl

package info (click to toggle)
libgeo-ip-perl 1.51-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,000 kB
  • sloc: perl: 6,844; makefile: 3
file content (26 lines) | stat: -rwxr-xr-x 489 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/local/bin/perl

use strict;
use warnings;

use Geo::IP;

my $gi = Geo::IP->open(
    "/usr/local/share/GeoIP/GeoIPNetSpeed.dat",
    GEOIP_STANDARD
);

my $netspeed = $gi->id_by_name("24.24.24.24");

if ( $netspeed == GEOIP_UNKNOWN_SPEED ) {
    print "Unknown\n";
}
elsif ( $netspeed == GEOIP_DIALUP_SPEED ) {
    print "Dialup\n";
}
elsif ( $netspeed == GEOIP_CABLEDSL_SPEED ) {
    print "Cable/DSL\n";
}
elsif ( $netspeed == GEOIP_CORPORATE_SPEED ) {
    print "Corporate\n";
}