diff --git a/lnrpc/watchtowerrpc/config_active.go b/lnrpc/watchtowerrpc/config_active.go new file mode 100644 index 000000000..985b49bff --- /dev/null +++ b/lnrpc/watchtowerrpc/config_active.go @@ -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 +} diff --git a/lnrpc/watchtowerrpc/config_default.go b/lnrpc/watchtowerrpc/config_default.go new file mode 100644 index 000000000..ac40e0bf1 --- /dev/null +++ b/lnrpc/watchtowerrpc/config_default.go @@ -0,0 +1,6 @@ +// +build !watchtowerrpc + +package watchtowerrpc + +// Config is empty for non-watchtowerrpc builds. +type Config struct{} diff --git a/lnrpc/watchtowerrpc/interface.go b/lnrpc/watchtowerrpc/interface.go new file mode 100644 index 000000000..aafe3e06f --- /dev/null +++ b/lnrpc/watchtowerrpc/interface.go @@ -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 +}