lnd+server+watchtower: allow Standalone access to the tor controller

This commit lets the watchtower automatically create hidden services
by giving it a pointer to a TorController. The server was also slightly
refactored so that it was not the sole owner of the TorController.
This commit is contained in:
nsa committed 2020-03-29 12:36:54 -04:00
1 parent f1fd5e86c0
commit ada0b78dfc
4 files changed
+107 -28

No files matched your search

+14 -2
View File
@@ -34,8 +34,8 @@ var (
)
// Config defines the resources and parameters used to configure a Watchtower.
// All nil-able elements with the Config must be set in order for the Watchtower
// to function properly.
// All nil-able elements besides tor-related ones must be set in order for the
// Watchtower to function properly.
type Config struct {
// ChainHash identifies the chain that the watchtower will be monitoring
// for breaches and that will be advertised in the server's Init message
@@ -89,4 +89,16 @@ type Config struct {
// message from the other end, if the connection has stopped buffering
// the server's replies.
WriteTimeout time.Duration
// TorController allows the watchtower to optionally setup an onion hidden
// service.
TorController *tor.Controller
// WatchtowerKeyPath allows the watchtower to specify where the private key
// for a watchtower hidden service should be stored.
WatchtowerKeyPath string
// Type specifies the hidden service type (V2 or V3) that the watchtower
// will create.
Type tor.OnionType
}