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

Conversation

Projects
None yet
2 participants
@cfromknecht
Copy link
Collaborator

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 force-pushed the cfromknecht:watchtower-pkg branch 2 times, most recently from 6541aae to 9957ed3 Jan 10, 2019

@Roasbeef
Copy link
Member

Roasbeef left a comment

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.

Show resolved Hide resolved 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
"github.com/lightningnetwork/lnd/watchtower/wtserver"
)

// Watchtower encapsulates the server-side functionality required by watchtower

This comment has been minimized.

@Roasbeef

Roasbeef Jan 12, 2019

Member

watchtower.Watchtower 🙃

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

This comment has been minimized.

@cfromknecht

cfromknecht Jan 12, 2019

Author Collaborator

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

Show resolved Hide resolved watchtower/conf_experimental.go

@cfromknecht cfromknecht force-pushed the cfromknecht:watchtower-pkg branch 3 times, most recently from 7ec50be to 11049b0 Jan 12, 2019

@cfromknecht

This comment has been minimized.

Copy link
Collaborator Author

cfromknecht commented Jan 12, 2019

Comments addressed, @Roasbeef PTAL

cfromknecht added some commits Jan 12, 2019

@cfromknecht cfromknecht force-pushed the cfromknecht:watchtower-pkg branch from 11049b0 to b32afd9 Jan 15, 2019

@Roasbeef Roasbeef added this to the 0.6 milestone Jan 16, 2019

@Roasbeef
Copy link
Member

Roasbeef left a comment

LGTM 💎

@Roasbeef Roasbeef merged commit 5b2afaf into lightningnetwork:master Jan 16, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.02%) to 56.318%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment