From 8bbbbaf87b5ab3c0a5918d2bc8d1d7f22cf54f53 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 25 Sep 2008 20:21:35 +0000 Subject: Add country-code support to configured node lists to implement the ever-popular "no exits in Monaco" feature (ExcludeExitNodes {MC}). Also allow country codes and IP ranges in ExitNodes. (EntryNodes needs more work.) Based on code by Robert Hogan. Needs more testing. svn:r16966 --- src/or/or.h | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'src/or/or.h') diff --git a/src/or/or.h b/src/or/or.h index e4fc7c2909..da1be00142 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1321,6 +1321,9 @@ typedef struct signed_descriptor_t { unsigned int send_unencrypted : 1; } signed_descriptor_t; +/** A signed integer representing a country code. */ +typedef int16_t country_t; + /** Information about another onion router in the network. */ typedef struct { signed_descriptor_t cache_info; @@ -1394,7 +1397,8 @@ typedef struct { time_t last_reachable; /** When did we start testing reachability for this OR? */ time_t testing_since; - + /** According to the geoip db what country is this router in? */ + country_t country; } routerinfo_t; /** Information needed to keep and cache a signed extra-info document. */ @@ -2070,6 +2074,8 @@ typedef struct config_line_t { struct config_line_t *next; } config_line_t; +typedef struct routerset_t routerset_t; + /** Configuration options for a Tor process. */ typedef struct { uint32_t _magic; @@ -2090,17 +2096,22 @@ typedef struct { char *Address; /**< OR only: configured address for this onion router. */ char *PidFile; /**< Where to store PID of Tor process. */ - char *ExitNodes; /**< Comma-separated list of nicknames of ORs to consider - * as exits. */ - char *EntryNodes; /**< Comma-separated list of nicknames of ORs to consider - * as entry points. */ + routerset_t *ExitNodes; /**< Structure containing nicknames, digests, + * country codes and IP address patterns of ORs to + * consider as exits. */ + routerset_t *EntryNodes;/**< Structure containing nicknames, digests, + * country codes and IP address patterns of ORs to + * consider as entry points. */ int StrictExitNodes; /**< Boolean: When none of our ExitNodes are up, do we * stop building circuits? */ int StrictEntryNodes; /**< Boolean: When none of our EntryNodes are up, do we * stop building circuits? */ - struct routerset_t *ExcludeNodes; /**< Comma-separated list of nicknames of - * ORs not to use in circuits. */ - struct routerset_t *ExcludeExitNodes; /**