Compare commits
No commits in common. "master" and "change/switch_to_maxmind" have entirely different histories.
master
...
change/swi
11
README.md
11
README.md
@ -1,14 +1,9 @@
|
||||
# xtr
|
||||
|
||||
This is the server for the XTR (XiCoN Trace Route). It's more of a master browser for the clients, so an web frontend can get a list of all the
|
||||
available clients combined from one auto-updated source. It opens a port and listening to HTTP requests (GET and PUT). It can list all online and
|
||||
offline clients. It also accepts new client entries via a PUT request (target client address in database has to be the request ip).
|
||||
This is the server for the XTR (XiCoN Trace Route). It's more of a master browser for the clients, so an web frontend can get a list of all the available clients combined from one auto-updated source. It opens a port and listening to HTTP requests (GET and PUT). It can list all online and offline clients. It also accepts new client entries via a PUT request (target client address in database has to be the request ip).
|
||||
|
||||
The server keeps the list of clients up2date with checking their availablity with each request of all online clients.
|
||||
For now, only IPv4 clients are supported. This will change in the future.
|
||||
|
||||
This software uses the MaxMind GeoLite2 database (https://www.maxmind.com) to determine the AS for each hop. To lookup the AS information the script
|
||||
uses the MaxMind perl module which uses the MaxMind DB library.
|
||||
This software uses the iptoasn database (https://iptoasn.com/) to determine the AS for each client. To keep track of all ip to asn relations, this software creates a local database file "ip2asn.db", which is a simple SQLite3 database with an index for faster searches.
|
||||
|
||||
|
||||
This product includes GeoLite2 ASN data created by MaxMind, available from <a href="http://www.maxmind.com">http://www.maxmind.com</a>.
|
||||
For now, only IPv4 clients are supported. This will change in the future.
|
47
xtrd.pl
47
xtrd.pl
@ -6,6 +6,7 @@ use Dancer2;
|
||||
use Socket;
|
||||
use DBI;
|
||||
use File::Fetch;
|
||||
use PerlIO::gzip;
|
||||
use HTTP::Tiny;
|
||||
use HTTP::Request;
|
||||
use Data::Validate::Domain qw(is_domain);
|
||||
@ -21,21 +22,15 @@ use Data::Dumper;
|
||||
# offline clients. It also accepts new client entries via a PUT request (target client address in database has to be the request ip).
|
||||
#
|
||||
# The server keeps the list of clients up2date with checking their availablity with each request of all online clients.
|
||||
#
|
||||
# This software uses the iptoasn database (https://iptoasn.com/) to determine the AS for each client. To keep track of all ip to asn relations,
|
||||
# this software creates a local database file "ip2asn.db", which is a simple SQLite3 database with an index for faster searches.
|
||||
#
|
||||
# For now, only IPv4 clients are supported. This will change in the future.
|
||||
#
|
||||
# This software uses the MaxMind GeoLite2 database (https://www.maxmind.com) to determine the AS for each hop. To lookup the AS information the script
|
||||
# uses the MaxMind perl module which uses the MaxMind DB library.
|
||||
#
|
||||
#
|
||||
# This product includes GeoLite2 ASN data created by MaxMind, available from <a href="http://www.maxmind.com">http://www.maxmind.com</a>.
|
||||
######################################################################################################################################################
|
||||
|
||||
|
||||
### CHANGELOG ######################################################################################################################################
|
||||
# v0.5 (2020-04-14)
|
||||
# * FIX: Maxmind now allows redistributing GeoLite2-ASN database if requirements are fulfilled (https://git.xicon.eu/xicon/xtr/issues/3)
|
||||
# * ADD: Maxmind's TOS added as start-up message
|
||||
#
|
||||
# v0.4 (2019-08-22)
|
||||
# * ADD: added better documentation
|
||||
# * ADD: list of API commands via API
|
||||
@ -51,27 +46,20 @@ use Data::Dumper;
|
||||
# Either install all listed modules with "cpan -i <module>" or use your system's package manager (apt, yum, yast).
|
||||
#
|
||||
# On Debian just install there packages:
|
||||
# screen
|
||||
# libperlio-gzip-perl
|
||||
# libdancer2-perl
|
||||
# libdbi-perl
|
||||
# libdbd-sqlite3-perl
|
||||
# libdata-validate-ip-perl
|
||||
# build-essential
|
||||
# cpanminus
|
||||
# libmaxminddb0
|
||||
# libmaxminddb-dev
|
||||
#
|
||||
# After that, execute this command to install maxmind database reader module:
|
||||
# cpanm -q -n MaxMind::DB::Reader::XS
|
||||
# libperlio-gzip-perl
|
||||
# libdancer2-perl
|
||||
# libdbi-perl
|
||||
# libdbd-sqlite3-perl
|
||||
# libdata-validate-ip-perl
|
||||
#
|
||||
######################################################################################################################################################
|
||||
|
||||
|
||||
### VARS #############################################################################################################################################
|
||||
my $dbfile = 'xtrd.db';
|
||||
my $ip2asn_csv_url = 'http://iptoasn.com/data/ip2asn-v4-u32.tsv.gz';
|
||||
my $max_dbfile = 'GeoLite2-ASN.mmdb';
|
||||
my $max_db_source = 'http://xtr.xicon.eu/GeoLite2-ASN.tar.gz';
|
||||
my $max_db_source = 'http://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN.tar.gz';
|
||||
my $server_protocol_version = 3;
|
||||
my $min_client_version = 4;
|
||||
set port => 12110;
|
||||
@ -362,14 +350,3 @@ sub create_db_table
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
sub print_maxmind_tos
|
||||
{
|
||||
print qq{ --------------------------------------------------------------------------------------------------------------------------------------- };
|
||||
print "\n";
|
||||
print qq{ This product includes GeoLite2 ASN data created by MaxMind, available from <a href="http://www.maxmind.com">http://www.maxmind.com</a>. };
|
||||
print "\n";
|
||||
print qq{ --------------------------------------------------------------------------------------------------------------------------------------- };
|
||||
print "\n";
|
||||
print "\n";
|
||||
}
|
Loading…
Reference in New Issue
Block a user