Skip to content

Unify torrc templates

Jim Newsome requested to merge jnewsome/chutney:rework-torrc-v2 into main

Previously some configuration for a node was specified via a template name (e.g. "client.tmpl"), and others via finer grained options. In practice, the built-in networks typically set finer grained options that conveyed the same information as the template name (e.g. setting both client=1 and torrc="client.tmpl").

This MR removes the need to set torrc at all. When we generate the torrc file for a node, we now use a single unified template function.

This is progress towards generalizing NodeConfig such that it can also be used to configure arti-based nodes.

In cases where the template name did convey information that wasn't already being conveyed through other options, this MR adds other options so that it can be conveyed without the template. e.g. this adds NodeConfig.hs_singlehop to convey that a node's hidden service should be configured as a single-hop service, where this was previously conveyed by setting the torrc to one that includes "single-onion-common.i", which was one of either "single-onion-v3.tmpl" or "single-onion-v3-only-v6-md.tmpl".

For this MR, we avoid updating the built-in network scripts (e.g. "basic-min"), and instead keep them working through a compatibility layer that looks at the template name, and adds any missing options. This should help preserve compatibility with non-built-in network scripts as well.

The individual templates now all just end up invoking the unified "common.i" template, and then asserting that the parts previously inserted by the current template have actually been inserted. Failing one of these assertions typically indicates that the other configuration options are missing some options that were previously set implicitly by the template name.

Edited by Jim Newsome

Merge request reports

Loading