Documentation ¶
Index ¶
- Constants
- Variables
- func DisableLog()
- func UseLogger(logger btclog.Logger)
- type Config
- type WatchtowerClient
- func (c *WatchtowerClient) AddTower(ctx context.Context, req *wtclient2.AddTowerRequest) (*wtclient2.AddTowerResponse, error)
- func (c *WatchtowerClient) GetTowerInfo(ctx context.Context, req *wtclient2.GetTowerInfoRequest) (*wtclient2.Tower, error)
- func (c *WatchtowerClient) ListTowers(ctx context.Context, req *wtclient2.ListTowersRequest) (*wtclient2.ListTowersResponse, error)
- func (c *WatchtowerClient) Name() string
- func (c *WatchtowerClient) Policy(ctx context.Context, req *wtclient2.PolicyRequest) (*wtclient2.PolicyResponse, error)
- func (c *WatchtowerClient) RegisterWithRootServer(grpcServer *grpc.Server) error
- func (c *WatchtowerClient) RemoveTower(ctx context.Context, req *wtclient2.RemoveTowerRequest) (*wtclient2.RemoveTowerResponse, error)
- func (c *WatchtowerClient) Start() error
- func (c *WatchtowerClient) Stats(ctx context.Context, req *wtclient2.StatsRequest) (*wtclient2.StatsResponse, error)
- func (c *WatchtowerClient) Stop() error
Constants ¶
const Subsystem = "WTCL"
Subsystem defines the logging code for this subsystem.
Variables ¶
var ( // ErrWtclientNotActive signals that RPC calls cannot be processed // because the watchtower client is not active. ErrWtclientNotActive = errors.New("watchtower client not active") )
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by by default until UseLogger is called.
Types ¶
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 ¶
func New(cfg *Config) (*WatchtowerClient, lnrpc.MacaroonPerms, error)
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 ¶
func (c *WatchtowerClient) AddTower(ctx context.Context, req *wtclient2.AddTowerRequest) (*wtclient2.AddTowerResponse, error)
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 ¶
func (c *WatchtowerClient) GetTowerInfo(ctx context.Context, req *wtclient2.GetTowerInfoRequest) (*wtclient2.Tower, error)
GetTowerInfo retrieves information for a registered watchtower.
func (*WatchtowerClient) ListTowers ¶
func (c *WatchtowerClient) ListTowers(ctx context.Context, req *wtclient2.ListTowersRequest) (*wtclient2.ListTowersResponse, error)
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 ¶
func (c *WatchtowerClient) Policy(ctx context.Context, req *wtclient2.PolicyRequest) (*wtclient2.PolicyResponse, error)
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 ¶
func (c *WatchtowerClient) RemoveTower(ctx context.Context, req *wtclient2.RemoveTowerRequest) (*wtclient2.RemoveTowerResponse, error)
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 ¶
func (c *WatchtowerClient) Stats(ctx context.Context, req *wtclient2.StatsRequest) (*wtclient2.StatsResponse, error)
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.