In this PR, we introduce the watchtower package used to configure and run a watchtower. The top level watchtower.Standalone
struct couples the lookout and wtserver subsystems, enabling the full server-side protocol and breach monitoring. It also initializes the WTWR subsystem logger, which will be inherited by both the lookout and wtserver packages.
In order to facilitate the package's use as an extension to LND or a standalone daemon, the watchtower.Config
provides a common interface for all of the towers resources and configurable parameters. These resources are then passed down to the appropriate subsystems so that they can faithfully perform their duties. Some of these options are to be configured from the command line, which leads us to:
Considerations for CLI Configuration
As these parameters begin to be exposed as CLI flags or config file options, we introduce the watchtower.Conf
which exports the configurable parameters. This struct is meant to be embedded into a higher-level config struct and can be grouped according to the applications needs.
For example, LND will use a small sub-config with an Active flag and be grouped under a "watchtower" prefix. If the watchtower is to run in a standalone daemon, the watchtower.Conf
can be embedded directly into the primary config, as it is already assumed that the tower is to be active. As more parameters are exposed, this will provide a common interface to users of the package.
Assuming all other resources have been provided to a watchtower.Config
, any parameters parsed into a watchtower.Conf
can then be applied to a Config to generate the final config that should be passed to watchtower.New
. If no CLI configuration is necessary, users of the package can set the values in their watchtower.Config
Note: This PR does not expose the watchtower configuration options in LND's config, it only adds the struct that will later be embedded. Further, the configuration options are only available in experimental builds as there are few moving parts of the protocol that should be solidified before attempting to operate a tower.