| 1 | #! /usr/bin/cgi-fcgi-interp /usr/bin/perl |
| 2 | ### -*-perl-*- |
| 3 | ### |
| 4 | ### IP-address reporting webservice for Odin |
| 5 | ### |
| 6 | ### (c) 2017 Mark Wooding |
| 7 | ### |
| 8 | |
| 9 | ###----- Licensing notice --------------------------------------------------- |
| 10 | ### |
| 11 | ### This file is part of the `odin.gg' service, `odin-cgi'. |
| 12 | ### |
| 13 | ### `odin-cgi' is free software; you can redistribute it and/or modify |
| 14 | ### it under the terms of the GNU Affero General Public License as |
| 15 | ### published by the Free Software Foundation; either version 3 of the |
| 16 | ### License, or (at your option) any later version. |
| 17 | ### |
| 18 | ### `odin-cgi' is distributed in the hope that it will be useful, |
| 19 | ### but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 | ### GNU Affero General Public License for more details. |
| 22 | ### |
| 23 | ### You should have received a copy of the GNU Affero General Public |
| 24 | ### License along with `odin-cgi'; if not, see |
| 25 | ### <http://www.gnu.org/licenses/>. |
| 26 | |
| 27 | use lib 'lib'; |
| 28 | use Odin; |
| 29 | use CGI::Fast; |
| 30 | |
| 31 | while (my $cgi = CGI::Fast->new) { |
| 32 | my $addr = $cgi->remote_addr; |
| 33 | print <<EOF; |
| 34 | Content-type: text/plain; charset=us-ascii |
| 35 | X-AGPL-Source: $Odin::SRCURL |
| 36 | |
| 37 | $addr |
| 38 | EOF |
| 39 | } |