From c63ea6cf49daacd51a77f9c2bbcf9856f686a0f7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Peter=20M=C3=BCller?= Date: Tue, 3 Nov 2020 12:50:18 +0100 Subject: [PATCH] tor.cgi: look up Tor relay country codes using libloc MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Tor provides a function to resolve a relay's IP address into a country code by taking advantage of a (heavily outdated) GeoIP database shipped with it. We should consequently use libloc for doing this, since it can be confusing if those results differ from active connections in the connection tracking CGI (where we _use_ libloc) and such tasks are why we invented libloc in the first place. :-) Signed-off-by: Peter Müller Signed-off-by: Michael Tremer --- html/cgi-bin/tor.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/cgi-bin/tor.cgi b/html/cgi-bin/tor.cgi index 7447bd7916..14bfcfe900 100644 --- a/html/cgi-bin/tor.cgi +++ b/html/cgi-bin/tor.cgi @@ -912,7 +912,7 @@ sub TorNodeDescription() { $node->{'address'} = $3; $node->{'port'} = $4; - my $country_code = &TorGetInfo($tor, "ip-to-country/$node->{'address'}"); + my $country_code = &Location::Functions::lookup_country_code($db_handle, $node->{'address'}); $node->{'country_code'} = $country_code; # Flags -- 2.39.5