[tor-commits] [tor/master] prop224: Add hsdir consensus parameters
nickm at torproject.org
nickm at torproject.org
Wed Aug 9 00:36:37 UTC 2017
commit 06909cafef6aee9141541fc85cbea5de0b2e5f6a
Author: David Goulet <dgoulet at torproject.org>
Date: Wed Apr 19 11:06:19 2017 -0400
prop224: Add hsdir consensus parameters
Signed-off-by: David Goulet <dgoulet at torproject.org>
---
src/or/hs_common.c | 30 ++++++++++++++++++++++++++++++
src/or/hs_common.h | 11 +++++++++++
2 files changed, 41 insertions(+)
diff --git a/src/or/hs_common.c b/src/or/hs_common.c
index 0e3562de8..4ea92aaea 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
diff --git a/src/or/hs_common.h b/src/or/hs_common.h
index a70ddc68d..d367e815e 100644
--- a/src/or/hs_common.h
+++ b/src/or/hs_common.h
@@ -113,6 +113,13 @@
#define HS_SRV_DISASTER_PREFIX "shared-random-disaster"
#define HS_SRV_DISASTER_PREFIX_LEN (sizeof(HS_SRV_DISASTER_PREFIX) - 1)
+/* Default value of number of hsdir replicas (hsdir_n_replicas). */
+#define HS_DEFAULT_HSDIR_N_REPLICAS 2
+/* Default value of hsdir spread store (hsdir_spread_store). */
+#define HS_DEFAULT_HSDIR_SPREAD_STORE 3
+/* Default value of hsdir spread fetch (hsdir_spread_fetch). */
+#define HS_DEFAULT_HSDIR_SPREAD_FETCH 3
+
/* Type of authentication key used by an introduction point. */
typedef enum {
HS_AUTH_KEY_TYPE_LEGACY = 1,
@@ -203,6 +210,10 @@ void hs_build_hs_index(uint64_t replica,
const ed25519_public_key_t *blinded_pk,
uint64_t period_num, uint8_t *hs_index_out);
+int32_t hs_get_hsdir_n_replicas(void);
+int32_t hs_get_hsdir_spread_fetch(void);
+int32_t hs_get_hsdir_spread_store(void);
+
#ifdef HS_COMMON_PRIVATE
#ifdef TOR_UNIT_TESTS
More information about the tor-commits
mailing list