|
@@ -4808,12 +4808,18 @@ struct routerset_t {
|
|
|
* a router belongs to the set if it is _rejected_ by this policy. */
|
|
|
smartlist_t *policies;
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+ * log messages. */
|
|
|
char *description;
|
|
|
|
|
|
-
|
|
|
+
|
|
|
smartlist_t *country_names;
|
|
|
+
|
|
|
int n_countries;
|
|
|
+
|
|
|
+ * country is a member of this routerset. Note that we MUST call
|
|
|
+ * routerset_refresh_countries() whenever the geoip country list is
|
|
|
+ * reloaded. */
|
|
|
bitarray_t *countries;
|
|
|
};
|
|
|
|
|
@@ -4830,7 +4836,8 @@ routerset_new(void)
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+ * string holding the "cc" part. Else, return NULL. */
|
|
|
static char *
|
|
|
routerset_get_countryname(const char *c)
|
|
|
{
|
|
@@ -4981,14 +4988,15 @@ routerset_is_list(const routerset_t *set)
|
|
|
smartlist_len(set->policies) == 0;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+ * <b>set</b>. */
|
|
|
int
|
|
|
routerset_needs_geoip(const routerset_t *set)
|
|
|
{
|
|
|
return set && smartlist_len(set->country_names);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
static int
|
|
|
routerset_is_empty(const routerset_t *set)
|
|
|
{
|
|
@@ -4996,8 +5004,12 @@ routerset_is_empty(const routerset_t *set)
|
|
|
}
|
|
|
|
|
|
|
|
|
- * provided fields. Return higher values for more specific subentries.
|
|
|
- (If country is -1, then we take the country from addr.) */
|
|
|
+ * provided fields. Return higher values for more specific subentries: a
|
|
|
+ * single router is more specific than an address range of routers, which is
|
|
|
+ * more specific in turn than a country code.
|
|
|
+ *
|
|
|
+ * (If country is -1, then we take the country
|
|
|
+ * from addr.) */
|
|
|
static int
|
|
|
routerset_contains(const routerset_t *set, const tor_addr_t *addr,
|
|
|
uint16_t orport,
|
|
@@ -5102,9 +5114,10 @@ routerset_get_all_routers(smartlist_t *out, const routerset_t *routerset,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- * <b>include</b> not excluded in a more specific fashion by
|
|
|
- * <b>exclude</b>. DOCDOC */
|
|
|
+
|
|
|
+ * <b>include</b>, but not excluded in a more specific fashion by
|
|
|
+ * <b>exclude</b>. If <b>running_only</b>, only include running routers.
|
|
|
+ */
|
|
|
void
|
|
|
routersets_get_disjunction(smartlist_t *target,
|
|
|
const smartlist_t *source,
|
|
@@ -5217,14 +5230,15 @@ routerset_free(routerset_t *routerset)
|
|
|
tor_free(routerset);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+ * each router when the GeoIP database is reloaded, and on all new routers. */
|
|
|
void
|
|
|
routerinfo_set_country(routerinfo_t *ri)
|
|
|
{
|
|
|
ri->country = geoip_get_country_by_ip(ri->addr);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
void
|
|
|
routerlist_refresh_countries(void)
|
|
|
{
|