lnrpc/watchtowerrpc: add WatchtowerBackend configs

This commit is contained in:
Conner Fromknecht 2019-06-20 16:53:25 -07:00
parent 72e4fbff97
commit 0db39d4fe6
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7
3 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,13 @@
// +build watchtowerrpc
package watchtowerrpc
// Config is the primary configuration struct for the watchtower RPC server. It
// contains all items required for the RPC server to carry out its duties. The
// fields with struct tags are meant to parsed as normal configuration options,
// while if able to be populated, the latter fields MUST also be specified.
type Config struct {
// Tower is the active watchtower which serves as the primary source for
// information presented via RPC.
Tower WatchtowerBackend
}

View File

@ -0,0 +1,6 @@
// +build !watchtowerrpc
package watchtowerrpc
// Config is empty for non-watchtowerrpc builds.
type Config struct{}

View File

@ -0,0 +1,23 @@
package watchtowerrpc
import (
"net"
"github.com/btcsuite/btcd/btcec"
)
// WatchtowerBackend abstracts access to the watchtower information that is
// served via RPC connections.
type WatchtowerBackend interface {
// PubKey returns the public key for the watchtower used to
// authentication and encrypt traffic with clients.
PubKey() *btcec.PublicKey
// ListeningAddrs returns the listening addresses where the watchtower
// server can accept client connections.
ListeningAddrs() []net.Addr
// ExternalIPs returns the addresses where the watchtower can be reached
// by clients externally.
ExternalIPs() []net.Addr
}