aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-04-02 22:06:46 +0000
committerNick Mathewson <nickm@torproject.org>2004-04-02 22:06:46 +0000
commit4cb21bab4811090ca7f39bd422eed5184c58e5bf (patch)
tree53497d28270b19db7cabf1c9388de85397f50602 /src
parenta981c4099af25e8e38ca1fbe4870d09c54d0d20b (diff)
downloadtor-4cb21bab4811090ca7f39bd422eed5184c58e5bf.tar
tor-4cb21bab4811090ca7f39bd422eed5184c58e5bf.tar.gz
Make preferred/excluded intro points configurable
svn:r1440
Diffstat (limited to 'src')
-rw-r--r--src/or/config.c6
-rw-r--r--src/or/rendservice.c30
2 files changed, 27 insertions, 9 deletions
diff --git a/src/or/config.c b/src/or/config.c
index e5e5fc9c8..ad121d3cc 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -215,8 +215,10 @@ static int config_assign(or_options_t *options, struct config_line_t *list) {
config_compare(list, "User", CONFIG_TYPE_STRING, &options->User) ||
config_compare(list, "RunTesting", CONFIG_TYPE_BOOL, &options->RunTesting) ||
- config_compare(list, "HiddenServiceDir", CONFIG_TYPE_LINELIST, &options->RendConfigLines) ||
- config_compare(list, "HiddenServicePort", CONFIG_TYPE_LINELIST, &options->RendConfigLines)
+ config_compare(list, "HiddenServiceDir", CONFIG_TYPE_LINELIST, &options->RendConfigLines)||
+ config_compare(list, "HiddenServicePort", CONFIG_TYPE_LINELIST, &options->RendConfigLines)||
+ config_compare(list, "HiddenServiceNodes", CONFIG_TYPE_LINELIST, &options->RendConfigLines)||
+ config_compare(list, "HiddenServiceExcludeNodes", CONFIG_TYPE_LINELIST, &options->RendConfigLines)
) {
/* then we're ok. it matched something. */
} else {
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 4bb48f4fd..7e75827c0 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -22,6 +22,8 @@ typedef struct rend_service_t {
/* Fields specified in config file */
char *directory;
smartlist_t *ports;
+ char *intro_nodes;
+ char *intro_exclude_nodes;
/* Other fields */
crypto_pk_env_t *private_key;
char service_id[REND_SERVICE_ID_LEN+1];
@@ -165,19 +167,33 @@ int rend_config_services(or_options_t *options)
service = tor_malloc_zero(sizeof(rend_service_t));
service->directory = tor_strdup(line->value);
service->ports = smartlist_create();
- } else {
- assert(!strcasecmp(line->key, "HiddenServicePort"));
- if (!service) {
- log_fn(LOG_WARN, "HiddenServicePort with no preceeding HiddenServiceDir directive");
- rend_service_free(service);
- return -1;
- }
+ continue;
+ }
+ if (!service) {
+ log_fn(LOG_WARN, "HiddenServicePort with no preceeding HiddenServiceDir directive");
+ rend_service_free(service);
+ return -1;
+ }
+ if (!strcasecmp(line->key, "HiddenServicePort")) {
portcfg = parse_port_config(line->value);
if (!portcfg) {
rend_service_free(service);
return -1;
}
smartlist_add(service->ports, portcfg);
+ } else if (!strcasecmp(line->key, "HiddenServiceNodes")) {
+ if (service->intro_nodes) {
+ log_fn(LOG_WARN, "Got multiple HiddenServiceNodes lines for a single service");
+ return -1;
+ }
+ service->intro_nodes = tor_strdup(line->value);
+ } else {
+ assert(!strcasecmp(line->key, "HiddenServiceExcludeNodes"));
+ if (service->intro_exclude_nodes) {
+ log_fn(LOG_WARN, "Got multiple HiddenServiceExcludedNodes lines for a single service");
+ return -1;
+ }
+ service->intro_exclude_nodes = tor_strdup(line->value);
}
}
if (service)