Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watchtower pkg #2448

Merged
merged 8 commits into from Jan 16, 2019
Merged

watchtower pkg #2448

merged 8 commits into from Jan 16, 2019

Conversation

cfromknecht
Copy link
Contributor

@cfromknecht cfromknecht commented Jan 10, 2019

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 direclty.

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.

@cfromknecht cfromknecht added watchtower config Parameters/arguments/config file related issues/PRs labels Jan 10, 2019
@cfromknecht cfromknecht force-pushed the watchtower-pkg branch 2 times, most recently from 6541aae to 9957ed3 Compare January 10, 2019 21:30
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stoked to see the final server start to come together! Did an initial pass and things are looking pretty good to me, should be able to land soon after another pass.

watchtower/interface.go Show resolved Hide resolved
watchtower/config.go Show resolved Hide resolved
watchtower/config.go Outdated Show resolved Hide resolved
watchtower/config.go Show resolved Hide resolved
watchtower/config.go Show resolved Hide resolved
"github.com/lightningnetwork/lnd/watchtower/wtserver"
)

// Watchtower encapsulates the server-side functionality required by watchtower
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

watchtower.Watchtower 🙃

The redundancy...Server perhaps? Not a blocking comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a stab and went with Standalone, since it really couples a server and the breach monitoring services in one unit. In the future we could add the split implementations to this package, e.g. watchtower.Endpoint and watchtower.Monitor or something along those lines. Let me know what you think

watchtower/conf_experimental.go Show resolved Hide resolved
@cfromknecht cfromknecht force-pushed the watchtower-pkg branch 3 times, most recently from 7ec50be to 11049b0 Compare January 12, 2019 02:32
@cfromknecht
Copy link
Contributor Author

Comments addressed, @Roasbeef PTAL

Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 💎

@Roasbeef Roasbeef merged commit 5b2afaf into lightningnetwork:master Jan 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config Parameters/arguments/config file related issues/PRs watchtower
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants