Browse Source

Added Maxmind's TOS

* FIX: Maxmind now allows redistributing GeoLite2-ASN database if requirements are fulfilled (xicon/xtr#3)
 * ADD: Maxmind's TOS added as start-up message
master
XiCoN-FJS- 2 years ago
parent
commit
9e1bdea2ca
  1. 11
      README.md
  2. 45
      xtrd.pl

11
README.md

@ -1,9 +1,14 @@
# 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 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 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.
For now, only IPv4 clients are supported. This will change in the future.
This product includes GeoLite2 ASN data created by MaxMind, available from <a href="http://www.maxmind.com">http://www.maxmind.com</a>.

45
xtrd.pl

@ -6,7 +6,6 @@ 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);
@ -22,15 +21,21 @@ 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.
# For now, only IPv4 clients are supported. This will change in the future.
#
# 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 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.
#
# For now, only IPv4 clients are supported. This will change in the future.
#
# 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
@ -46,20 +51,27 @@ 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:
# libperlio-gzip-perl
# libdancer2-perl
# libdbi-perl
# libdbd-sqlite3-perl
# libdata-validate-ip-perl
# 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
#
######################################################################################################################################################
### 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://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN.tar.gz';
my $max_db_source = 'http://xtr.xicon.eu/GeoLite2-ASN.tar.gz';
my $server_protocol_version = 3;
my $min_client_version = 4;
set port => 12110;
@ -350,3 +362,14 @@ 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…
Cancel
Save