summaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-12-17 22:44:16 +0000
committerNick Mathewson <nickm@torproject.org>2007-12-17 22:44:16 +0000
commit25f78498f91ba9f482bc654d3af8905b600d4f7f (patch)
tree4b72b48bf0bfd5006ebbf1b03b3e32d82ca144b1 /src/or/router.c
parent820159cac540b4777fb639de663d72f04690e2a2 (diff)
downloadtor-25f78498f91ba9f482bc654d3af8905b600d4f7f.tar.gz
tor-25f78498f91ba9f482bc654d3af8905b600d4f7f.zip
r15531@tombo: nickm | 2007-12-17 17:19:24 -0500
Support raw IP-to-country as well as postprocessed format. Include GEOIP summary in extrainfo of bridges. svn:r12846
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 37f34439f5..30b307dc40 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -1694,6 +1694,7 @@ int
extrainfo_dump_to_string(char *s, size_t maxlen, extrainfo_t *extrainfo,
crypto_pk_env_t *ident_key)
{
+ or_options_t *options = get_options();
char identity[HEX_DIGEST_LEN+1];
char published[ISO_TIME_LEN+1];
char digest[DIGEST_LEN];
@@ -1708,14 +1709,32 @@ extrainfo_dump_to_string(char *s, size_t maxlen, extrainfo_t *extrainfo,
result = tor_snprintf(s, maxlen,
"extra-info %s %s\n"
- "published %s\n%s"
- "router-signature\n",
+ "published %s\n%s",
extrainfo->nickname, identity,
published, bandwidth_usage);
tor_free(bandwidth_usage);
if (result<0)
return -1;
+
+ if (options->BridgeRelay && options->BridgeRecordUsageByCountry) {
+ char *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());
+ result = tor_snprintf(s+strlen(s), maxlen-strlen(s),
+ "geoip-start-time %s\n"
+ "geoip-client-origins %s\n",
+ geoip_start, geoip_summary);
+ tor_free(geoip_summary);
+ if (result<0)
+ return -1;
+ }
+ }
+
+
len = strlen(s);
+ strlcat(s+len, "router-signature\n", maxlen-len);
+ len += strlen(s+len);
if (router_get_extrainfo_hash(s, digest)<0)
return -1;
if (router_append_dirobj_signature(s+len, maxlen-len, digest, ident_key)<0)