diff options
author | David Goulet <dgoulet@torproject.org> | 2017-04-19 11:06:19 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-08-08 20:29:33 -0400 |
commit | 06909cafef6aee9141541fc85cbea5de0b2e5f6a (patch) | |
tree | 599e332bb545a16c12c3ded1a09c47fef990c26b /src/or/hs_common.c | |
parent | 267bc7bc3b574f3e60d7836fde5a24652e3ac9c2 (diff) | |
download | tor-06909cafef6aee9141541fc85cbea5de0b2e5f6a.tar.gz tor-06909cafef6aee9141541fc85cbea5de0b2e5f6a.zip |
prop224: Add hsdir consensus parameters
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/hs_common.c')
-rw-r--r-- | src/or/hs_common.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/or/hs_common.c b/src/or/hs_common.c index 0e3562de87..4ea92aaeab 100644 --- a/src/or/hs_common.c +++ b/src/or/hs_common.c @@ -857,6 +857,36 @@ hs_get_previous_srv(uint64_t time_period_num) return sr_value; } +/* Return the number of replicas defined by a consensus parameter or the + * default value. */ +int32_t +hs_get_hsdir_n_replicas(void) +{ + /* The [1,16] range is a specification requirement. */ + return networkstatus_get_param(NULL, "hsdir_n_replicas", + HS_DEFAULT_HSDIR_N_REPLICAS, 1, 16); +} + +/* Return the spread fetch value defined by a consensus parameter or the + * default value. */ +int32_t +hs_get_hsdir_spread_fetch(void) +{ + /* The [1,128] range is a specification requirement. */ + return networkstatus_get_param(NULL, "hsdir_spread_fetch", + HS_DEFAULT_HSDIR_SPREAD_FETCH, 1, 128); +} + +/* Return the spread store value defined by a consensus parameter or the + * default value. */ +int32_t +hs_get_hsdir_spread_store(void) +{ + /* The [1,128] range is a specification requirement. */ + return networkstatus_get_param(NULL, "hsdir_spread_store", + HS_DEFAULT_HSDIR_SPREAD_STORE, 1, 128); +} + /* Initialize the entire HS subsytem. This is called in tor_init() before any * torrc options are loaded. Only for >= v3. */ void |