return -2;
}
- /* Stub that should be replaced with the #17178 version of the function
- * when merging. */
+ /* Are HiddenServiceSingleHopMode and HiddenServiceNonAnonymousMode consistent?
+ */
+ static int
+ rend_service_non_anonymous_mode_consistent(const or_options_t *options)
+ {
+ /* !! is used to make these options boolean */
+ return (!! options->HiddenServiceSingleHopMode ==
+ !! options->HiddenServiceNonAnonymousMode);
+ }
+
+ /* Do the options allow onion services to make direct (non-anonymous)
+ * connections to introduction or rendezvous points?
+ * Must only be called after options_validate_single_onion() has successfully
+ * checked onion service option consistency.
+ * Returns true if tor is in HiddenServiceSingleHopMode. */
int
- rend_service_allow_direct_connection(const or_options_t *options)
+ rend_service_allow_non_anonymous_connection(const or_options_t *options)
{
- (void)options;
- return 0;
+ tor_assert(rend_service_non_anonymous_mode_consistent(options));
+ return options->HiddenServiceSingleHopMode ? 1 : 0;
+ }
+
+ /* Do the options allow us to reveal the exact startup time of the onion
+ * service?
+ * Single Onion Services prioritise availability over hiding their
+ * startup time, as their IP address is publicly discoverable anyway.
+ * Must only be called after options_validate_single_onion() has successfully
+ * checked onion service option consistency.
+ * Returns true if tor is in non-anonymous hidden service mode. */
+ int
+ rend_service_reveal_startup_time(const or_options_t *options)
+ {
+ tor_assert(rend_service_non_anonymous_mode_consistent(options));
+ return rend_service_non_anonymous_mode_enabled(options);
+ }
+
+ /* Is non-anonymous mode enabled using the HiddenServiceNonAnonymousMode
+ * config option?
+ * Must only be called after options_validate_single_onion() has successfully
+ * checked onion service option consistency.
+ */
+ int
+ rend_service_non_anonymous_mode_enabled(const or_options_t *options)
+ {
+ tor_assert(rend_service_non_anonymous_mode_consistent(options));
+ return options->HiddenServiceNonAnonymousMode ? 1 : 0;
}
+