Version: v0.5.1 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2020 License: MIT Imports: 16 Imported by: 0




View Source
const Subsystem = "WTCL"

Subsystem defines the logging code for this subsystem.


View Source
var (

	// ErrWtclientNotActive signals that RPC calls cannot be processed
	// because the watchtower client is not active.
	ErrWtclientNotActive = errors.New("watchtower client not active")


func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by by default until UseLogger is called.

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.


type Config

type Config struct {
	// Active indicates if the watchtower client is enabled.
	Active bool

	// Client is the backing watchtower client that we'll interact with
	// through the watchtower RPC subserver.
	Client wtclient.Client

	// Resolver is a custom resolver that will be used to resolve watchtower
	// addresses to ensure we don't leak any information when running over
	// non-clear networks, e.g. Tor, etc.
	Resolver lncfg.TCPResolver

Config is the primary configuration struct for the watchtower RPC server. It contains all the items required for the RPC server to carry out its duties. The fields with struct tags are meant to be parsed as normal configuration options, while if able to be populated, the latter fields MUST also be specified.

type WatchtowerClient

type WatchtowerClient struct {
	// contains filtered or unexported fields

WatchtowerClient is the RPC server we'll use to interact with the backing active watchtower client.

TODO(wilmer): better name?

func New

New returns a new instance of the wtclientrpc WatchtowerClient sub-server. We also return the set of permissions for the macaroons that we may create within this method. If the macaroons we need aren't found in the filepath, then we'll create them on start up. If we're unable to locate, or create the macaroons we need, then we'll return with an error.

func (*WatchtowerClient) AddTower

AddTower adds a new watchtower reachable at the given address and considers it for new sessions. If the watchtower already exists, then any new addresses included will be considered when dialing it for session negotiations and backups.

func (*WatchtowerClient) GetTowerInfo

GetTowerInfo retrieves information for a registered watchtower.

func (*WatchtowerClient) ListTowers

ListTowers returns the list of watchtowers registered with the client.

func (*WatchtowerClient) Name

func (c *WatchtowerClient) Name() string

Name returns a unique string representation of the sub-server. This can be used to identify the sub-server and also de-duplicate them.

NOTE: This is part of the lnrpc.SubServer interface.

func (*WatchtowerClient) Policy

Policy returns the active watchtower client policy configuration.

func (*WatchtowerClient) RegisterWithRootServer

func (c *WatchtowerClient) RegisterWithRootServer(grpcServer *grpc.Server) error

RegisterWithRootServer will be called by the root gRPC server to direct a sub RPC server to register itself with the main gRPC root server. Until this is called, each sub-server won't be able to have requests routed towards it.

NOTE: This is part of the lnrpc.SubServer interface.

func (*WatchtowerClient) RemoveTower

RemoveTower removes a watchtower from being considered for future session negotiations and from being used for any subsequent backups until it's added again. If an address is provided, then this RPC only serves as a way of removing the address from the watchtower instead.

func (*WatchtowerClient) Start

func (c *WatchtowerClient) Start() error

Start launches any helper goroutines required for the WatchtowerClient to function.

NOTE: This is part of the lnrpc.SubWatchtowerClient interface.

func (*WatchtowerClient) Stats

Stats returns the in-memory statistics of the client since startup.

func (*WatchtowerClient) Stop

func (c *WatchtowerClient) Stop() error

Stop signals any active goroutines for a graceful closure.

NOTE: This is part of the lnrpc.SubServer interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL