wtclientrpc

package
v0.18.0-beta.rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 33 Imported by: 0

Documentation

Overview

Package wtclientrpc is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	PolicyType_name = map[int32]string{
		0: "LEGACY",
		1: "ANCHOR",
		2: "TAPROOT",
	}
	PolicyType_value = map[string]int32{
		"LEGACY":  0,
		"ANCHOR":  1,
		"TAPROOT": 2,
	}
)

Enum value maps for PolicyType.

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")
)
View Source
var File_wtclientrpc_wtclient_proto protoreflect.FileDescriptor
View Source
var WatchtowerClient_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "wtclientrpc.WatchtowerClient",
	HandlerType: (*WatchtowerClientServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "AddTower",
			Handler:    _WatchtowerClient_AddTower_Handler,
		},
		{
			MethodName: "RemoveTower",
			Handler:    _WatchtowerClient_RemoveTower_Handler,
		},
		{
			MethodName: "DeactivateTower",
			Handler:    _WatchtowerClient_DeactivateTower_Handler,
		},
		{
			MethodName: "TerminateSession",
			Handler:    _WatchtowerClient_TerminateSession_Handler,
		},
		{
			MethodName: "ListTowers",
			Handler:    _WatchtowerClient_ListTowers_Handler,
		},
		{
			MethodName: "GetTowerInfo",
			Handler:    _WatchtowerClient_GetTowerInfo_Handler,
		},
		{
			MethodName: "Stats",
			Handler:    _WatchtowerClient_Stats_Handler,
		},
		{
			MethodName: "Policy",
			Handler:    _WatchtowerClient_Policy_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "wtclientrpc/wtclient.proto",
}

WatchtowerClient_ServiceDesc is the grpc.ServiceDesc for WatchtowerClient service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterWatchtowerClientHandler

func RegisterWatchtowerClientHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterWatchtowerClientHandler registers the http handlers for service WatchtowerClient to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterWatchtowerClientHandlerClient

func RegisterWatchtowerClientHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WatchtowerClientClient) error

RegisterWatchtowerClientHandlerClient registers the http handlers for service WatchtowerClient to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WatchtowerClientClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WatchtowerClientClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "WatchtowerClientClient" to call the correct interceptors.

func RegisterWatchtowerClientHandlerFromEndpoint

func RegisterWatchtowerClientHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterWatchtowerClientHandlerFromEndpoint is same as RegisterWatchtowerClientHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterWatchtowerClientHandlerServer

func RegisterWatchtowerClientHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WatchtowerClientServer) error

RegisterWatchtowerClientHandlerServer registers the http handlers for service WatchtowerClient to "mux". UnaryRPC :call WatchtowerClientServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterWatchtowerClientHandlerFromEndpoint instead.

func RegisterWatchtowerClientJSONCallbacks

func RegisterWatchtowerClientJSONCallbacks(registry map[string]func(ctx context.Context,
	conn *grpc.ClientConn, reqJSON string, callback func(string, error)))

func RegisterWatchtowerClientServer

func RegisterWatchtowerClientServer(s grpc.ServiceRegistrar, srv WatchtowerClientServer)

Types

type AddTowerRequest

type AddTowerRequest struct {

	// The identifying public key of the watchtower to add.
	Pubkey []byte `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
	// A network address the watchtower is reachable over.
	Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
	// contains filtered or unexported fields
}

func (*AddTowerRequest) Descriptor deprecated

func (*AddTowerRequest) Descriptor() ([]byte, []int)

Deprecated: Use AddTowerRequest.ProtoReflect.Descriptor instead.

func (*AddTowerRequest) GetAddress

func (x *AddTowerRequest) GetAddress() string

func (*AddTowerRequest) GetPubkey

func (x *AddTowerRequest) GetPubkey() []byte

func (*AddTowerRequest) ProtoMessage

func (*AddTowerRequest) ProtoMessage()

func (*AddTowerRequest) ProtoReflect

func (x *AddTowerRequest) ProtoReflect() protoreflect.Message

func (*AddTowerRequest) Reset

func (x *AddTowerRequest) Reset()

func (*AddTowerRequest) String

func (x *AddTowerRequest) String() string

type AddTowerResponse

type AddTowerResponse struct {
	// contains filtered or unexported fields
}

func (*AddTowerResponse) Descriptor deprecated

func (*AddTowerResponse) Descriptor() ([]byte, []int)

Deprecated: Use AddTowerResponse.ProtoReflect.Descriptor instead.

func (*AddTowerResponse) ProtoMessage

func (*AddTowerResponse) ProtoMessage()

func (*AddTowerResponse) ProtoReflect

func (x *AddTowerResponse) ProtoReflect() protoreflect.Message

func (*AddTowerResponse) Reset

func (x *AddTowerResponse) Reset()

func (*AddTowerResponse) String

func (x *AddTowerResponse) String() string

type Config

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

	// ClientMgr is a tower client manager that manages a set of tower
	// clients.
	ClientMgr wtclient.ClientManager

	// 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

	// Log is the logger instance we should log output to.
	Log btclog.Logger
}

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 DeactivateTowerRequest

type DeactivateTowerRequest struct {

	// The identifying public key of the watchtower to deactivate.
	Pubkey []byte `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
	// contains filtered or unexported fields
}

func (*DeactivateTowerRequest) Descriptor deprecated

func (*DeactivateTowerRequest) Descriptor() ([]byte, []int)

Deprecated: Use DeactivateTowerRequest.ProtoReflect.Descriptor instead.

func (*DeactivateTowerRequest) GetPubkey

func (x *DeactivateTowerRequest) GetPubkey() []byte

func (*DeactivateTowerRequest) ProtoMessage

func (*DeactivateTowerRequest) ProtoMessage()

func (*DeactivateTowerRequest) ProtoReflect

func (x *DeactivateTowerRequest) ProtoReflect() protoreflect.Message

func (*DeactivateTowerRequest) Reset

func (x *DeactivateTowerRequest) Reset()

func (*DeactivateTowerRequest) String

func (x *DeactivateTowerRequest) String() string

type DeactivateTowerResponse

type DeactivateTowerResponse struct {

	// A string describing the action that took place.
	Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*DeactivateTowerResponse) Descriptor deprecated

func (*DeactivateTowerResponse) Descriptor() ([]byte, []int)

Deprecated: Use DeactivateTowerResponse.ProtoReflect.Descriptor instead.

func (*DeactivateTowerResponse) GetStatus

func (x *DeactivateTowerResponse) GetStatus() string

func (*DeactivateTowerResponse) ProtoMessage

func (*DeactivateTowerResponse) ProtoMessage()

func (*DeactivateTowerResponse) ProtoReflect

func (x *DeactivateTowerResponse) ProtoReflect() protoreflect.Message

func (*DeactivateTowerResponse) Reset

func (x *DeactivateTowerResponse) Reset()

func (*DeactivateTowerResponse) String

func (x *DeactivateTowerResponse) String() string

type GetTowerInfoRequest

type GetTowerInfoRequest struct {

	// The identifying public key of the watchtower to retrieve information for.
	Pubkey []byte `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
	// Whether we should include sessions with the watchtower in the response.
	IncludeSessions bool `protobuf:"varint,2,opt,name=include_sessions,json=includeSessions,proto3" json:"include_sessions,omitempty"`
	// Whether to exclude exhausted sessions in the response info. This option
	// is only meaningful if include_sessions is true.
	ExcludeExhaustedSessions bool `` /* 136-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*GetTowerInfoRequest) Descriptor deprecated

func (*GetTowerInfoRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetTowerInfoRequest.ProtoReflect.Descriptor instead.

func (*GetTowerInfoRequest) GetExcludeExhaustedSessions

func (x *GetTowerInfoRequest) GetExcludeExhaustedSessions() bool

func (*GetTowerInfoRequest) GetIncludeSessions

func (x *GetTowerInfoRequest) GetIncludeSessions() bool

func (*GetTowerInfoRequest) GetPubkey

func (x *GetTowerInfoRequest) GetPubkey() []byte

func (*GetTowerInfoRequest) ProtoMessage

func (*GetTowerInfoRequest) ProtoMessage()

func (*GetTowerInfoRequest) ProtoReflect

func (x *GetTowerInfoRequest) ProtoReflect() protoreflect.Message

func (*GetTowerInfoRequest) Reset

func (x *GetTowerInfoRequest) Reset()

func (*GetTowerInfoRequest) String

func (x *GetTowerInfoRequest) String() string

type ListTowersRequest

type ListTowersRequest struct {

	// Whether we should include sessions with the watchtower in the response.
	IncludeSessions bool `protobuf:"varint,1,opt,name=include_sessions,json=includeSessions,proto3" json:"include_sessions,omitempty"`
	// Whether to exclude exhausted sessions in the response info. This option
	// is only meaningful if include_sessions is true.
	ExcludeExhaustedSessions bool `` /* 136-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*ListTowersRequest) Descriptor deprecated

func (*ListTowersRequest) Descriptor() ([]byte, []int)

Deprecated: Use ListTowersRequest.ProtoReflect.Descriptor instead.

func (*ListTowersRequest) GetExcludeExhaustedSessions

func (x *ListTowersRequest) GetExcludeExhaustedSessions() bool

func (*ListTowersRequest) GetIncludeSessions

func (x *ListTowersRequest) GetIncludeSessions() bool

func (*ListTowersRequest) ProtoMessage

func (*ListTowersRequest) ProtoMessage()

func (*ListTowersRequest) ProtoReflect

func (x *ListTowersRequest) ProtoReflect() protoreflect.Message

func (*ListTowersRequest) Reset

func (x *ListTowersRequest) Reset()

func (*ListTowersRequest) String

func (x *ListTowersRequest) String() string

type ListTowersResponse

type ListTowersResponse struct {

	// The list of watchtowers available for new backups.
	Towers []*Tower `protobuf:"bytes,1,rep,name=towers,proto3" json:"towers,omitempty"`
	// contains filtered or unexported fields
}

func (*ListTowersResponse) Descriptor deprecated

func (*ListTowersResponse) Descriptor() ([]byte, []int)

Deprecated: Use ListTowersResponse.ProtoReflect.Descriptor instead.

func (*ListTowersResponse) GetTowers

func (x *ListTowersResponse) GetTowers() []*Tower

func (*ListTowersResponse) ProtoMessage

func (*ListTowersResponse) ProtoMessage()

func (*ListTowersResponse) ProtoReflect

func (x *ListTowersResponse) ProtoReflect() protoreflect.Message

func (*ListTowersResponse) Reset

func (x *ListTowersResponse) Reset()

func (*ListTowersResponse) String

func (x *ListTowersResponse) String() string

type PolicyRequest

type PolicyRequest struct {

	// The client type from which to retrieve the active offering policy.
	PolicyType PolicyType `protobuf:"varint,1,opt,name=policy_type,json=policyType,proto3,enum=wtclientrpc.PolicyType" json:"policy_type,omitempty"`
	// contains filtered or unexported fields
}

func (*PolicyRequest) Descriptor deprecated

func (*PolicyRequest) Descriptor() ([]byte, []int)

Deprecated: Use PolicyRequest.ProtoReflect.Descriptor instead.

func (*PolicyRequest) GetPolicyType

func (x *PolicyRequest) GetPolicyType() PolicyType

func (*PolicyRequest) ProtoMessage

func (*PolicyRequest) ProtoMessage()

func (*PolicyRequest) ProtoReflect

func (x *PolicyRequest) ProtoReflect() protoreflect.Message

func (*PolicyRequest) Reset

func (x *PolicyRequest) Reset()

func (*PolicyRequest) String

func (x *PolicyRequest) String() string

type PolicyResponse

type PolicyResponse struct {

	// The maximum number of updates each session we negotiate with watchtowers
	// should allow.
	MaxUpdates uint32 `protobuf:"varint,1,opt,name=max_updates,json=maxUpdates,proto3" json:"max_updates,omitempty"`
	// Deprecated, use sweep_sat_per_vbyte.
	// The fee rate, in satoshis per vbyte, that will be used by watchtowers for
	// justice transactions in response to channel breaches.
	//
	// Deprecated: Marked as deprecated in wtclientrpc/wtclient.proto.
	SweepSatPerByte uint32 `protobuf:"varint,2,opt,name=sweep_sat_per_byte,json=sweepSatPerByte,proto3" json:"sweep_sat_per_byte,omitempty"`
	// The fee rate, in satoshis per vbyte, that will be used by watchtowers for
	// justice transactions in response to channel breaches.
	SweepSatPerVbyte uint32 `protobuf:"varint,3,opt,name=sweep_sat_per_vbyte,json=sweepSatPerVbyte,proto3" json:"sweep_sat_per_vbyte,omitempty"`
	// contains filtered or unexported fields
}

func (*PolicyResponse) Descriptor deprecated

func (*PolicyResponse) Descriptor() ([]byte, []int)

Deprecated: Use PolicyResponse.ProtoReflect.Descriptor instead.

func (*PolicyResponse) GetMaxUpdates

func (x *PolicyResponse) GetMaxUpdates() uint32

func (*PolicyResponse) GetSweepSatPerByte deprecated

func (x *PolicyResponse) GetSweepSatPerByte() uint32

Deprecated: Marked as deprecated in wtclientrpc/wtclient.proto.

func (*PolicyResponse) GetSweepSatPerVbyte

func (x *PolicyResponse) GetSweepSatPerVbyte() uint32

func (*PolicyResponse) ProtoMessage

func (*PolicyResponse) ProtoMessage()

func (*PolicyResponse) ProtoReflect

func (x *PolicyResponse) ProtoReflect() protoreflect.Message

func (*PolicyResponse) Reset

func (x *PolicyResponse) Reset()

func (*PolicyResponse) String

func (x *PolicyResponse) String() string

type PolicyType

type PolicyType int32
const (
	// Selects the policy from the legacy tower client.
	PolicyType_LEGACY PolicyType = 0
	// Selects the policy from the anchor tower client.
	PolicyType_ANCHOR PolicyType = 1
	// Selects the policy from the taproot tower client.
	PolicyType_TAPROOT PolicyType = 2
)

func (PolicyType) Descriptor

func (PolicyType) Descriptor() protoreflect.EnumDescriptor

func (PolicyType) Enum

func (x PolicyType) Enum() *PolicyType

func (PolicyType) EnumDescriptor deprecated

func (PolicyType) EnumDescriptor() ([]byte, []int)

Deprecated: Use PolicyType.Descriptor instead.

func (PolicyType) Number

func (x PolicyType) Number() protoreflect.EnumNumber

func (PolicyType) String

func (x PolicyType) String() string

func (PolicyType) Type

type RemoveTowerRequest

type RemoveTowerRequest struct {

	// The identifying public key of the watchtower to remove.
	Pubkey []byte `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
	// If set, then the record for this address will be removed, indicating that is
	// is stale. Otherwise, the watchtower will no longer be used for future
	// session negotiations and backups.
	Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
	// contains filtered or unexported fields
}

func (*RemoveTowerRequest) Descriptor deprecated

func (*RemoveTowerRequest) Descriptor() ([]byte, []int)

Deprecated: Use RemoveTowerRequest.ProtoReflect.Descriptor instead.

func (*RemoveTowerRequest) GetAddress

func (x *RemoveTowerRequest) GetAddress() string

func (*RemoveTowerRequest) GetPubkey

func (x *RemoveTowerRequest) GetPubkey() []byte

func (*RemoveTowerRequest) ProtoMessage

func (*RemoveTowerRequest) ProtoMessage()

func (*RemoveTowerRequest) ProtoReflect

func (x *RemoveTowerRequest) ProtoReflect() protoreflect.Message

func (*RemoveTowerRequest) Reset

func (x *RemoveTowerRequest) Reset()

func (*RemoveTowerRequest) String

func (x *RemoveTowerRequest) String() string

type RemoveTowerResponse

type RemoveTowerResponse struct {
	// contains filtered or unexported fields
}

func (*RemoveTowerResponse) Descriptor deprecated

func (*RemoveTowerResponse) Descriptor() ([]byte, []int)

Deprecated: Use RemoveTowerResponse.ProtoReflect.Descriptor instead.

func (*RemoveTowerResponse) ProtoMessage

func (*RemoveTowerResponse) ProtoMessage()

func (*RemoveTowerResponse) ProtoReflect

func (x *RemoveTowerResponse) ProtoReflect() protoreflect.Message

func (*RemoveTowerResponse) Reset

func (x *RemoveTowerResponse) Reset()

func (*RemoveTowerResponse) String

func (x *RemoveTowerResponse) String() string

type ServerShell

type ServerShell struct {
	WatchtowerClientServer
}

ServerShell is a shell struct holding a reference to the actual sub-server. It is used to register the gRPC sub-server with the root server before we have the necessary dependencies to populate the actual sub-server.

func (*ServerShell) CreateSubServer

func (r *ServerShell) CreateSubServer(configRegistry lnrpc.SubServerConfigDispatcher) (
	lnrpc.SubServer, lnrpc.MacaroonPerms, error)

CreateSubServer populates the subserver's dependencies using the passed SubServerConfigDispatcher. This method should fully initialize the sub-server instance, making it ready for action. It returns the macaroon permissions that the sub-server wishes to pass on to the root server for all methods routed towards it.

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

func (*ServerShell) RegisterWithRestServer

func (r *ServerShell) RegisterWithRestServer(ctx context.Context,
	mux *runtime.ServeMux, dest string, opts []grpc.DialOption) error

RegisterWithRestServer will be called by the root REST mux to direct a sub RPC server to register itself with the main REST mux 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.GrpcHandler interface.

func (*ServerShell) RegisterWithRootServer

func (r *ServerShell) 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.GrpcHandler interface.

type StatsRequest

type StatsRequest struct {
	// contains filtered or unexported fields
}

func (*StatsRequest) Descriptor deprecated

func (*StatsRequest) Descriptor() ([]byte, []int)

Deprecated: Use StatsRequest.ProtoReflect.Descriptor instead.

func (*StatsRequest) ProtoMessage

func (*StatsRequest) ProtoMessage()

func (*StatsRequest) ProtoReflect

func (x *StatsRequest) ProtoReflect() protoreflect.Message

func (*StatsRequest) Reset

func (x *StatsRequest) Reset()

func (*StatsRequest) String

func (x *StatsRequest) String() string

type StatsResponse

type StatsResponse struct {

	// The total number of backups made to all active and exhausted watchtower
	// sessions.
	NumBackups uint32 `protobuf:"varint,1,opt,name=num_backups,json=numBackups,proto3" json:"num_backups,omitempty"`
	// The total number of backups that are pending to be acknowledged by all
	// active and exhausted watchtower sessions.
	NumPendingBackups uint32 `protobuf:"varint,2,opt,name=num_pending_backups,json=numPendingBackups,proto3" json:"num_pending_backups,omitempty"`
	// The total number of backups that all active and exhausted watchtower
	// sessions have failed to acknowledge.
	NumFailedBackups uint32 `protobuf:"varint,3,opt,name=num_failed_backups,json=numFailedBackups,proto3" json:"num_failed_backups,omitempty"`
	// The total number of new sessions made to watchtowers.
	NumSessionsAcquired uint32 `protobuf:"varint,4,opt,name=num_sessions_acquired,json=numSessionsAcquired,proto3" json:"num_sessions_acquired,omitempty"`
	// The total number of watchtower sessions that have been exhausted.
	NumSessionsExhausted uint32 `protobuf:"varint,5,opt,name=num_sessions_exhausted,json=numSessionsExhausted,proto3" json:"num_sessions_exhausted,omitempty"`
	// contains filtered or unexported fields
}

func (*StatsResponse) Descriptor deprecated

func (*StatsResponse) Descriptor() ([]byte, []int)

Deprecated: Use StatsResponse.ProtoReflect.Descriptor instead.

func (*StatsResponse) GetNumBackups

func (x *StatsResponse) GetNumBackups() uint32

func (*StatsResponse) GetNumFailedBackups

func (x *StatsResponse) GetNumFailedBackups() uint32

func (*StatsResponse) GetNumPendingBackups

func (x *StatsResponse) GetNumPendingBackups() uint32

func (*StatsResponse) GetNumSessionsAcquired

func (x *StatsResponse) GetNumSessionsAcquired() uint32

func (*StatsResponse) GetNumSessionsExhausted

func (x *StatsResponse) GetNumSessionsExhausted() uint32

func (*StatsResponse) ProtoMessage

func (*StatsResponse) ProtoMessage()

func (*StatsResponse) ProtoReflect

func (x *StatsResponse) ProtoReflect() protoreflect.Message

func (*StatsResponse) Reset

func (x *StatsResponse) Reset()

func (*StatsResponse) String

func (x *StatsResponse) String() string

type TerminateSessionRequest

type TerminateSessionRequest struct {

	// The ID of the session that should be terminated.
	SessionId []byte `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
	// contains filtered or unexported fields
}

func (*TerminateSessionRequest) Descriptor deprecated

func (*TerminateSessionRequest) Descriptor() ([]byte, []int)

Deprecated: Use TerminateSessionRequest.ProtoReflect.Descriptor instead.

func (*TerminateSessionRequest) GetSessionId

func (x *TerminateSessionRequest) GetSessionId() []byte

func (*TerminateSessionRequest) ProtoMessage

func (*TerminateSessionRequest) ProtoMessage()

func (*TerminateSessionRequest) ProtoReflect

func (x *TerminateSessionRequest) ProtoReflect() protoreflect.Message

func (*TerminateSessionRequest) Reset

func (x *TerminateSessionRequest) Reset()

func (*TerminateSessionRequest) String

func (x *TerminateSessionRequest) String() string

type TerminateSessionResponse

type TerminateSessionResponse struct {

	// A string describing the action that took place.
	Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*TerminateSessionResponse) Descriptor deprecated

func (*TerminateSessionResponse) Descriptor() ([]byte, []int)

Deprecated: Use TerminateSessionResponse.ProtoReflect.Descriptor instead.

func (*TerminateSessionResponse) GetStatus

func (x *TerminateSessionResponse) GetStatus() string

func (*TerminateSessionResponse) ProtoMessage

func (*TerminateSessionResponse) ProtoMessage()

func (*TerminateSessionResponse) ProtoReflect

func (x *TerminateSessionResponse) ProtoReflect() protoreflect.Message

func (*TerminateSessionResponse) Reset

func (x *TerminateSessionResponse) Reset()

func (*TerminateSessionResponse) String

func (x *TerminateSessionResponse) String() string

type Tower

type Tower struct {

	// The identifying public key of the watchtower.
	Pubkey []byte `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
	// The list of addresses the watchtower is reachable over.
	Addresses []string `protobuf:"bytes,2,rep,name=addresses,proto3" json:"addresses,omitempty"`
	// Deprecated, use the active_session_candidate field under the
	// correct identifier in the client_type map.
	// Whether the watchtower is currently a candidate for new sessions.
	//
	// Deprecated: Marked as deprecated in wtclientrpc/wtclient.proto.
	ActiveSessionCandidate bool `` /* 130-byte string literal not displayed */
	// Deprecated, use the num_sessions field under the correct identifier
	// in the client_type map.
	// The number of sessions that have been negotiated with the watchtower.
	//
	// Deprecated: Marked as deprecated in wtclientrpc/wtclient.proto.
	NumSessions uint32 `protobuf:"varint,4,opt,name=num_sessions,json=numSessions,proto3" json:"num_sessions,omitempty"`
	// Deprecated, use the sessions field under the correct identifier in the
	// client_type map.
	// The list of sessions that have been negotiated with the watchtower.
	//
	// Deprecated: Marked as deprecated in wtclientrpc/wtclient.proto.
	Sessions []*TowerSession `protobuf:"bytes,5,rep,name=sessions,proto3" json:"sessions,omitempty"`
	// A list sessions held with the tower.
	SessionInfo []*TowerSessionInfo `protobuf:"bytes,6,rep,name=session_info,json=sessionInfo,proto3" json:"session_info,omitempty"`
	// contains filtered or unexported fields
}

func (*Tower) Descriptor deprecated

func (*Tower) Descriptor() ([]byte, []int)

Deprecated: Use Tower.ProtoReflect.Descriptor instead.

func (*Tower) GetActiveSessionCandidate deprecated

func (x *Tower) GetActiveSessionCandidate() bool

Deprecated: Marked as deprecated in wtclientrpc/wtclient.proto.

func (*Tower) GetAddresses

func (x *Tower) GetAddresses() []string

func (*Tower) GetNumSessions deprecated

func (x *Tower) GetNumSessions() uint32

Deprecated: Marked as deprecated in wtclientrpc/wtclient.proto.

func (*Tower) GetPubkey

func (x *Tower) GetPubkey() []byte

func (*Tower) GetSessionInfo

func (x *Tower) GetSessionInfo() []*TowerSessionInfo

func (*Tower) GetSessions deprecated

func (x *Tower) GetSessions() []*TowerSession

Deprecated: Marked as deprecated in wtclientrpc/wtclient.proto.

func (*Tower) ProtoMessage

func (*Tower) ProtoMessage()

func (*Tower) ProtoReflect

func (x *Tower) ProtoReflect() protoreflect.Message

func (*Tower) Reset

func (x *Tower) Reset()

func (*Tower) String

func (x *Tower) String() string

type TowerSession

type TowerSession struct {

	// The total number of successful backups that have been made to the
	// watchtower session.
	NumBackups uint32 `protobuf:"varint,1,opt,name=num_backups,json=numBackups,proto3" json:"num_backups,omitempty"`
	// The total number of backups in the session that are currently pending to be
	// acknowledged by the watchtower.
	NumPendingBackups uint32 `protobuf:"varint,2,opt,name=num_pending_backups,json=numPendingBackups,proto3" json:"num_pending_backups,omitempty"`
	// The maximum number of backups allowed by the watchtower session.
	MaxBackups uint32 `protobuf:"varint,3,opt,name=max_backups,json=maxBackups,proto3" json:"max_backups,omitempty"`
	// Deprecated, use sweep_sat_per_vbyte.
	// The fee rate, in satoshis per vbyte, that will be used by the watchtower for
	// the justice transaction in the event of a channel breach.
	//
	// Deprecated: Marked as deprecated in wtclientrpc/wtclient.proto.
	SweepSatPerByte uint32 `protobuf:"varint,4,opt,name=sweep_sat_per_byte,json=sweepSatPerByte,proto3" json:"sweep_sat_per_byte,omitempty"`
	// The fee rate, in satoshis per vbyte, that will be used by the watchtower for
	// the justice transaction in the event of a channel breach.
	SweepSatPerVbyte uint32 `protobuf:"varint,5,opt,name=sweep_sat_per_vbyte,json=sweepSatPerVbyte,proto3" json:"sweep_sat_per_vbyte,omitempty"`
	// The ID of the session.
	Id []byte `protobuf:"bytes,6,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*TowerSession) Descriptor deprecated

func (*TowerSession) Descriptor() ([]byte, []int)

Deprecated: Use TowerSession.ProtoReflect.Descriptor instead.

func (*TowerSession) GetId

func (x *TowerSession) GetId() []byte

func (*TowerSession) GetMaxBackups

func (x *TowerSession) GetMaxBackups() uint32

func (*TowerSession) GetNumBackups

func (x *TowerSession) GetNumBackups() uint32

func (*TowerSession) GetNumPendingBackups

func (x *TowerSession) GetNumPendingBackups() uint32

func (*TowerSession) GetSweepSatPerByte deprecated

func (x *TowerSession) GetSweepSatPerByte() uint32

Deprecated: Marked as deprecated in wtclientrpc/wtclient.proto.

func (*TowerSession) GetSweepSatPerVbyte

func (x *TowerSession) GetSweepSatPerVbyte() uint32

func (*TowerSession) ProtoMessage

func (*TowerSession) ProtoMessage()

func (*TowerSession) ProtoReflect

func (x *TowerSession) ProtoReflect() protoreflect.Message

func (*TowerSession) Reset

func (x *TowerSession) Reset()

func (*TowerSession) String

func (x *TowerSession) String() string

type TowerSessionInfo

type TowerSessionInfo struct {

	// Whether the watchtower is currently a candidate for new sessions.
	ActiveSessionCandidate bool `` /* 130-byte string literal not displayed */
	// The number of sessions that have been negotiated with the watchtower.
	NumSessions uint32 `protobuf:"varint,2,opt,name=num_sessions,json=numSessions,proto3" json:"num_sessions,omitempty"`
	// The list of sessions that have been negotiated with the watchtower.
	Sessions []*TowerSession `protobuf:"bytes,3,rep,name=sessions,proto3" json:"sessions,omitempty"`
	// The session's policy type.
	PolicyType PolicyType `protobuf:"varint,4,opt,name=policy_type,json=policyType,proto3,enum=wtclientrpc.PolicyType" json:"policy_type,omitempty"`
	// contains filtered or unexported fields
}

func (*TowerSessionInfo) Descriptor deprecated

func (*TowerSessionInfo) Descriptor() ([]byte, []int)

Deprecated: Use TowerSessionInfo.ProtoReflect.Descriptor instead.

func (*TowerSessionInfo) GetActiveSessionCandidate

func (x *TowerSessionInfo) GetActiveSessionCandidate() bool

func (*TowerSessionInfo) GetNumSessions

func (x *TowerSessionInfo) GetNumSessions() uint32

func (*TowerSessionInfo) GetPolicyType

func (x *TowerSessionInfo) GetPolicyType() PolicyType

func (*TowerSessionInfo) GetSessions

func (x *TowerSessionInfo) GetSessions() []*TowerSession

func (*TowerSessionInfo) ProtoMessage

func (*TowerSessionInfo) ProtoMessage()

func (*TowerSessionInfo) ProtoReflect

func (x *TowerSessionInfo) ProtoReflect() protoreflect.Message

func (*TowerSessionInfo) Reset

func (x *TowerSessionInfo) Reset()

func (*TowerSessionInfo) String

func (x *TowerSessionInfo) String() string

type UnimplementedWatchtowerClientServer

type UnimplementedWatchtowerClientServer struct {
}

UnimplementedWatchtowerClientServer must be embedded to have forward compatible implementations.

func (UnimplementedWatchtowerClientServer) AddTower

func (UnimplementedWatchtowerClientServer) DeactivateTower

func (UnimplementedWatchtowerClientServer) GetTowerInfo

func (UnimplementedWatchtowerClientServer) ListTowers

func (UnimplementedWatchtowerClientServer) Policy

func (UnimplementedWatchtowerClientServer) RemoveTower

func (UnimplementedWatchtowerClientServer) Stats

func (UnimplementedWatchtowerClientServer) TerminateSession

type UnsafeWatchtowerClientServer

type UnsafeWatchtowerClientServer interface {
	// contains filtered or unexported methods
}

UnsafeWatchtowerClientServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to WatchtowerClientServer will result in compilation errors.

type WatchtowerClient

type WatchtowerClient struct {
	// Required by the grpc-gateway/v2 library for forward compatibility.
	UnimplementedWatchtowerClientServer
	// 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) DeactivateTower

DeactivateTower sets the given tower's status to inactive so that it is not considered for session negotiation. Its sessions will also not be used while the tower is inactive.

func (*WatchtowerClient) GetTowerInfo

func (c *WatchtowerClient) GetTowerInfo(ctx context.Context,
	req *GetTowerInfoRequest) (*Tower, error)

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) 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.

func (*WatchtowerClient) TerminateSession

TerminateSession terminates the given session and marks it as terminal so that it is never used again.

type WatchtowerClientClient

type WatchtowerClientClient interface {
	// lncli: `wtclient add`
	// 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.
	AddTower(ctx context.Context, in *AddTowerRequest, opts ...grpc.CallOption) (*AddTowerResponse, error)
	// lncli: `wtclient remove`
	// 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.
	RemoveTower(ctx context.Context, in *RemoveTowerRequest, opts ...grpc.CallOption) (*RemoveTowerResponse, error)
	// lncli: `wtclient deactivate`
	// DeactivateTower sets the given tower's status to inactive so that it
	// is not considered for session negotiation. Its sessions will also not
	// be used while the tower is inactive.
	DeactivateTower(ctx context.Context, in *DeactivateTowerRequest, opts ...grpc.CallOption) (*DeactivateTowerResponse, error)
	// lncli: `wtclient session terminate`
	// Terminate terminates the given session and marks it as terminal so that
	// it is not used for backups anymore.
	TerminateSession(ctx context.Context, in *TerminateSessionRequest, opts ...grpc.CallOption) (*TerminateSessionResponse, error)
	// lncli: `wtclient towers`
	// ListTowers returns the list of watchtowers registered with the client.
	ListTowers(ctx context.Context, in *ListTowersRequest, opts ...grpc.CallOption) (*ListTowersResponse, error)
	// lncli: `wtclient tower`
	// GetTowerInfo retrieves information for a registered watchtower.
	GetTowerInfo(ctx context.Context, in *GetTowerInfoRequest, opts ...grpc.CallOption) (*Tower, error)
	// lncli: `wtclient stats`
	// Stats returns the in-memory statistics of the client since startup.
	Stats(ctx context.Context, in *StatsRequest, opts ...grpc.CallOption) (*StatsResponse, error)
	// lncli: `wtclient policy`
	// Policy returns the active watchtower client policy configuration.
	Policy(ctx context.Context, in *PolicyRequest, opts ...grpc.CallOption) (*PolicyResponse, error)
}

WatchtowerClientClient is the client API for WatchtowerClient service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type WatchtowerClientServer

type WatchtowerClientServer interface {
	// lncli: `wtclient add`
	// 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.
	AddTower(context.Context, *AddTowerRequest) (*AddTowerResponse, error)
	// lncli: `wtclient remove`
	// 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.
	RemoveTower(context.Context, *RemoveTowerRequest) (*RemoveTowerResponse, error)
	// lncli: `wtclient deactivate`
	// DeactivateTower sets the given tower's status to inactive so that it
	// is not considered for session negotiation. Its sessions will also not
	// be used while the tower is inactive.
	DeactivateTower(context.Context, *DeactivateTowerRequest) (*DeactivateTowerResponse, error)
	// lncli: `wtclient session terminate`
	// Terminate terminates the given session and marks it as terminal so that
	// it is not used for backups anymore.
	TerminateSession(context.Context, *TerminateSessionRequest) (*TerminateSessionResponse, error)
	// lncli: `wtclient towers`
	// ListTowers returns the list of watchtowers registered with the client.
	ListTowers(context.Context, *ListTowersRequest) (*ListTowersResponse, error)
	// lncli: `wtclient tower`
	// GetTowerInfo retrieves information for a registered watchtower.
	GetTowerInfo(context.Context, *GetTowerInfoRequest) (*Tower, error)
	// lncli: `wtclient stats`
	// Stats returns the in-memory statistics of the client since startup.
	Stats(context.Context, *StatsRequest) (*StatsResponse, error)
	// lncli: `wtclient policy`
	// Policy returns the active watchtower client policy configuration.
	Policy(context.Context, *PolicyRequest) (*PolicyResponse, error)
	// contains filtered or unexported methods
}

WatchtowerClientServer is the server API for WatchtowerClient service. All implementations must embed UnimplementedWatchtowerClientServer for forward compatibility

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL