mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Several geoip changes/fixes as requested.
svn:r14780
This commit is contained in:
+1
-1
@@ -2598,7 +2598,7 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
|
||||
}
|
||||
|
||||
if (!strcmpstart(url,"/tor/server/") ||
|
||||
!strcmpstart(url,"/tor/extra/")) {
|
||||
(!options->BridgeAuthoritativeDir && !strcmpstart(url,"/tor/extra/"))) {
|
||||
int res;
|
||||
const char *msg;
|
||||
const char *request_type = NULL;
|
||||
|
||||
+8
-4
@@ -76,6 +76,10 @@ geoip_parse_entry(const char *line)
|
||||
geoip_entries = smartlist_create();
|
||||
country_idxplus1_by_lc_code = strmap_new();
|
||||
}
|
||||
while (TOR_ISSPACE(*line))
|
||||
++line;
|
||||
if (*line == '#')
|
||||
return 0;
|
||||
if (sscanf(line,"%u,%u,%2s", &low, &high, b) == 3) {
|
||||
geoip_add_entry(low, high, b);
|
||||
return 0;
|
||||
@@ -277,12 +281,12 @@ geoip_remove_old_clients(time_t cutoff)
|
||||
}
|
||||
|
||||
/** Do not mention any country from which fewer than this number of IPs have
|
||||
* connected. This avoids reporting information that could deanonymize
|
||||
* users. */
|
||||
#define MIN_IPS_TO_NOTE_COUNTRY 8
|
||||
* connected. This conceivably avoids reporting information that could
|
||||
* deanonymize users, though analysis is lacking. */
|
||||
#define MIN_IPS_TO_NOTE_COUNTRY 0
|
||||
/** Do not report any geoip data at all if we have fewer than this number of
|
||||
* IPs to report about. */
|
||||
#define MIN_IPS_TO_NOTE_ANYTHING 16
|
||||
#define MIN_IPS_TO_NOTE_ANYTHING 0
|
||||
/** When reporting geoip data about countries, round up to the nearest
|
||||
* multiple of this value. */
|
||||
#define IP_GRANULARITY 8
|
||||
|
||||
+8
-1
@@ -1823,7 +1823,14 @@ extrainfo_dump_to_string(char *s, size_t maxlen, extrainfo_t *extrainfo,
|
||||
return -1;
|
||||
|
||||
if (options->BridgeRelay && options->BridgeRecordUsageByCountry) {
|
||||
char *geoip_summary = geoip_get_client_history(time(NULL));
|
||||
static time_t last_purged_at = 0;
|
||||
char *geoip_summary;
|
||||
time_t now = time(NULL);
|
||||
if (now > last_purged_at+48*60*60) {
|
||||
geoip_remove_old_clients(now-48*60*60);
|
||||
last_purged_at = now;
|
||||
}
|
||||
geoip_summary = geoip_get_client_history(time(NULL));
|
||||
if (geoip_summary) {
|
||||
char geoip_start[ISO_TIME_LEN+1];
|
||||
format_iso_time(geoip_start, geoip_get_history_start());
|
||||
|
||||
Reference in New Issue
Block a user