tor+server: add OnionStore to AddOnionConfig with file-based impl

In this commit, we modify the AddOnionConfig struct to include an
abstract OnionStore, which will be responsible for storing all relevant
information of an onion service. We also add a file-based implementation
of the interface to maintain the same behavior of storing an onion
service's private key in a file.
This commit is contained in:
Wilmer Paulino committed 2020-03-06 17:44:29 -08:00
1 parent 46f4da0b6b
commit 2dfd6a7a3e
3 files changed
+145 -26

No files matched your search

+3 -3
View File
@@ -1965,9 +1965,9 @@ func (s *server) initTorController() error {
// create our onion service. The service's private key will be saved to
// disk in order to regain access to this service when restarting `lnd`.
onionCfg := tor.AddOnionConfig{
VirtualPort: defaultPeerPort,
TargetPorts: listenPorts,
PrivateKeyPath: cfg.Tor.PrivateKeyPath,
VirtualPort: defaultPeerPort,
TargetPorts: listenPorts,
Store: tor.NewOnionFile(cfg.Tor.PrivateKeyPath, 0600),
}
switch {