summaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2020-10-20 10:57:24 -0400
committerDavid Goulet <dgoulet@torproject.org>2020-10-27 10:43:42 -0400
commit4f5cea1f592d9e9e6c69fc0e772dd46a0fa43799 (patch)
treead94055219fcf1db9f0445f584283a5af397ef00 /src/app
parenta882d1bf0abbbcf2bc4f8c039f9b82262462292c (diff)
downloadtor-4f5cea1f592d9e9e6c69fc0e772dd46a0fa43799.tar.gz
tor-4f5cea1f592d9e9e6c69fc0e772dd46a0fa43799.zip
conn: New Metrics listener port
If MetricsPort is defined, listen on it and handle the incoming request. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/app')
-rw-r--r--src/app/config/config.c7
-rw-r--r--src/app/config/or_options_st.h6
2 files changed, 13 insertions, 0 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c
index 6c17bb0d8c..e14437aa6f 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -91,6 +91,7 @@
#include "feature/dirclient/dirclient_modes.h"
#include "feature/hibernate/hibernate.h"
#include "feature/hs/hs_config.h"
+#include "feature/metrics/metrics.h"
#include "feature/nodelist/dirlist.h"
#include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nickname.h"
@@ -560,6 +561,8 @@ static const config_var_t option_vars_[] = {
OBSOLETE("MaxOnionsPending"),
V(MaxOnionQueueDelay, MSEC_INTERVAL, "1750 msec"),
V(MaxUnparseableDescSizeToLog, MEMUNIT, "10 MB"),
+ VPORT(MetricsPort),
+ V(MetricsPortPolicy, LINELIST, NULL),
VAR("MyFamily", LINELIST, MyFamily_lines, NULL),
V(NewCircuitPeriod, INTERVAL, "30 seconds"),
OBSOLETE("NamingAuthoritativeDirectory"),
@@ -6461,6 +6464,10 @@ parse_ports(or_options_t *options, int validate_only,
*msg = tor_strdup("Invalid HTTPTunnelPort configuration");
goto err;
}
+ if (metrics_parse_ports(options, ports, msg) < 0) {
+ goto err;
+ }
+
{
unsigned control_port_flags = CL_PORT_NO_STREAM_OPTIONS |
CL_PORT_WARN_NONLOCAL;
diff --git a/src/app/config/or_options_st.h b/src/app/config/or_options_st.h
index 3ccd2c9761..7a72547fd3 100644
--- a/src/app/config/or_options_st.h
+++ b/src/app/config/or_options_st.h
@@ -164,6 +164,8 @@ struct or_options_t {
struct config_line_t *ORPort_lines;
/** Ports to listen on for extended OR connections. */
struct config_line_t *ExtORPort_lines;
+ /** Ports to listen on for Metrics connections. */
+ struct config_line_t *MetricsPort_lines;
/** Ports to listen on for SOCKS connections. */
struct config_line_t *SocksPort_lines;
/** Ports to listen on for transparent pf/netfilter connections. */
@@ -223,6 +225,7 @@ struct or_options_t {
unsigned int DNSPort_set : 1;
unsigned int ExtORPort_set : 1;
unsigned int HTTPTunnelPort_set : 1;
+ unsigned int MetricsPort_set : 1;
/**@}*/
/** Whether to publish our descriptor regardless of all our self-tests
@@ -1076,6 +1079,9 @@ struct or_options_t {
**/
int DormantCanceledByStartup;
+ /** List of policy allowed to query the Metrics port. */
+ struct config_line_t *MetricsPortPolicy;
+
/**
* Configuration objects for individual modules.
*