wtclientrpc

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: MIT Imports: 26 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 (

	// 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 PolicyType_name = map[int32]string{
	0: "LEGACY",
	1: "ANCHOR",
}
View Source
var PolicyType_value = map[string]int32{
	"LEGACY": 0,
	"ANCHOR": 1,
}

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.

func RegisterWatchtowerClientServer

func RegisterWatchtowerClientServer(s *grpc.Server, 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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*AddTowerRequest) Descriptor

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

func (*AddTowerRequest) GetAddress

func (m *AddTowerRequest) GetAddress() string

func (*AddTowerRequest) GetPubkey

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

func (*AddTowerRequest) ProtoMessage

func (*AddTowerRequest) ProtoMessage()

func (*AddTowerRequest) Reset

func (m *AddTowerRequest) Reset()

func (*AddTowerRequest) String

func (m *AddTowerRequest) String() string

func (*AddTowerRequest) XXX_DiscardUnknown

func (m *AddTowerRequest) XXX_DiscardUnknown()

func (*AddTowerRequest) XXX_Marshal

func (m *AddTowerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AddTowerRequest) XXX_Merge

func (m *AddTowerRequest) XXX_Merge(src proto.Message)

func (*AddTowerRequest) XXX_Size

func (m *AddTowerRequest) XXX_Size() int

func (*AddTowerRequest) XXX_Unmarshal

func (m *AddTowerRequest) XXX_Unmarshal(b []byte) error

type AddTowerResponse

type AddTowerResponse struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*AddTowerResponse) Descriptor

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

func (*AddTowerResponse) ProtoMessage

func (*AddTowerResponse) ProtoMessage()

func (*AddTowerResponse) Reset

func (m *AddTowerResponse) Reset()

func (*AddTowerResponse) String

func (m *AddTowerResponse) String() string

func (*AddTowerResponse) XXX_DiscardUnknown

func (m *AddTowerResponse) XXX_DiscardUnknown()

func (*AddTowerResponse) XXX_Marshal

func (m *AddTowerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AddTowerResponse) XXX_Merge

func (m *AddTowerResponse) XXX_Merge(src proto.Message)

func (*AddTowerResponse) XXX_Size

func (m *AddTowerResponse) XXX_Size() int

func (*AddTowerResponse) XXX_Unmarshal

func (m *AddTowerResponse) XXX_Unmarshal(b []byte) error

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

	// AnchorClient is the backing watchtower client for anchor channels that
	// we'll interact through the watchtower RPC subserver.
	AnchorClient 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

	// 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 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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetTowerInfoRequest) Descriptor

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

func (*GetTowerInfoRequest) GetIncludeSessions

func (m *GetTowerInfoRequest) GetIncludeSessions() bool

func (*GetTowerInfoRequest) GetPubkey

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

func (*GetTowerInfoRequest) ProtoMessage

func (*GetTowerInfoRequest) ProtoMessage()

func (*GetTowerInfoRequest) Reset

func (m *GetTowerInfoRequest) Reset()

func (*GetTowerInfoRequest) String

func (m *GetTowerInfoRequest) String() string

func (*GetTowerInfoRequest) XXX_DiscardUnknown

func (m *GetTowerInfoRequest) XXX_DiscardUnknown()

func (*GetTowerInfoRequest) XXX_Marshal

func (m *GetTowerInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetTowerInfoRequest) XXX_Merge

func (m *GetTowerInfoRequest) XXX_Merge(src proto.Message)

func (*GetTowerInfoRequest) XXX_Size

func (m *GetTowerInfoRequest) XXX_Size() int

func (*GetTowerInfoRequest) XXX_Unmarshal

func (m *GetTowerInfoRequest) XXX_Unmarshal(b []byte) error

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ListTowersRequest) Descriptor

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

func (*ListTowersRequest) GetIncludeSessions

func (m *ListTowersRequest) GetIncludeSessions() bool

func (*ListTowersRequest) ProtoMessage

func (*ListTowersRequest) ProtoMessage()

func (*ListTowersRequest) Reset

func (m *ListTowersRequest) Reset()

func (*ListTowersRequest) String

func (m *ListTowersRequest) String() string

func (*ListTowersRequest) XXX_DiscardUnknown

func (m *ListTowersRequest) XXX_DiscardUnknown()

func (*ListTowersRequest) XXX_Marshal

func (m *ListTowersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListTowersRequest) XXX_Merge

func (m *ListTowersRequest) XXX_Merge(src proto.Message)

func (*ListTowersRequest) XXX_Size

func (m *ListTowersRequest) XXX_Size() int

func (*ListTowersRequest) XXX_Unmarshal

func (m *ListTowersRequest) XXX_Unmarshal(b []byte) error

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ListTowersResponse) Descriptor

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

func (*ListTowersResponse) GetTowers

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

func (*ListTowersResponse) ProtoMessage

func (*ListTowersResponse) ProtoMessage()

func (*ListTowersResponse) Reset

func (m *ListTowersResponse) Reset()

func (*ListTowersResponse) String

func (m *ListTowersResponse) String() string

func (*ListTowersResponse) XXX_DiscardUnknown

func (m *ListTowersResponse) XXX_DiscardUnknown()

func (*ListTowersResponse) XXX_Marshal

func (m *ListTowersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListTowersResponse) XXX_Merge

func (m *ListTowersResponse) XXX_Merge(src proto.Message)

func (*ListTowersResponse) XXX_Size

func (m *ListTowersResponse) XXX_Size() int

func (*ListTowersResponse) XXX_Unmarshal

func (m *ListTowersResponse) XXX_Unmarshal(b []byte) error

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"`
	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
	XXX_unrecognized     []byte     `json:"-"`
	XXX_sizecache        int32      `json:"-"`
}

func (*PolicyRequest) Descriptor

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

func (*PolicyRequest) GetPolicyType

func (m *PolicyRequest) GetPolicyType() PolicyType

func (*PolicyRequest) ProtoMessage

func (*PolicyRequest) ProtoMessage()

func (*PolicyRequest) Reset

func (m *PolicyRequest) Reset()

func (*PolicyRequest) String

func (m *PolicyRequest) String() string

func (*PolicyRequest) XXX_DiscardUnknown

func (m *PolicyRequest) XXX_DiscardUnknown()

func (*PolicyRequest) XXX_Marshal

func (m *PolicyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PolicyRequest) XXX_Merge

func (m *PolicyRequest) XXX_Merge(src proto.Message)

func (*PolicyRequest) XXX_Size

func (m *PolicyRequest) XXX_Size() int

func (*PolicyRequest) XXX_Unmarshal

func (m *PolicyRequest) XXX_Unmarshal(b []byte) error

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"`
	//
	//The fee rate, in satoshis per vbyte, that will be used by watchtowers for
	//justice transactions in response to channel breaches.
	SweepSatPerByte      uint32   `protobuf:"varint,2,opt,name=sweep_sat_per_byte,json=sweepSatPerByte,proto3" json:"sweep_sat_per_byte,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*PolicyResponse) Descriptor

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

func (*PolicyResponse) GetMaxUpdates

func (m *PolicyResponse) GetMaxUpdates() uint32

func (*PolicyResponse) GetSweepSatPerByte

func (m *PolicyResponse) GetSweepSatPerByte() uint32

func (*PolicyResponse) ProtoMessage

func (*PolicyResponse) ProtoMessage()

func (*PolicyResponse) Reset

func (m *PolicyResponse) Reset()

func (*PolicyResponse) String

func (m *PolicyResponse) String() string

func (*PolicyResponse) XXX_DiscardUnknown

func (m *PolicyResponse) XXX_DiscardUnknown()

func (*PolicyResponse) XXX_Marshal

func (m *PolicyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PolicyResponse) XXX_Merge

func (m *PolicyResponse) XXX_Merge(src proto.Message)

func (*PolicyResponse) XXX_Size

func (m *PolicyResponse) XXX_Size() int

func (*PolicyResponse) XXX_Unmarshal

func (m *PolicyResponse) XXX_Unmarshal(b []byte) error

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
)

func (PolicyType) EnumDescriptor

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

func (PolicyType) String

func (x PolicyType) String() string

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*RemoveTowerRequest) Descriptor

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

func (*RemoveTowerRequest) GetAddress

func (m *RemoveTowerRequest) GetAddress() string

func (*RemoveTowerRequest) GetPubkey

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

func (*RemoveTowerRequest) ProtoMessage

func (*RemoveTowerRequest) ProtoMessage()

func (*RemoveTowerRequest) Reset

func (m *RemoveTowerRequest) Reset()

func (*RemoveTowerRequest) String

func (m *RemoveTowerRequest) String() string

func (*RemoveTowerRequest) XXX_DiscardUnknown

func (m *RemoveTowerRequest) XXX_DiscardUnknown()

func (*RemoveTowerRequest) XXX_Marshal

func (m *RemoveTowerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RemoveTowerRequest) XXX_Merge

func (m *RemoveTowerRequest) XXX_Merge(src proto.Message)

func (*RemoveTowerRequest) XXX_Size

func (m *RemoveTowerRequest) XXX_Size() int

func (*RemoveTowerRequest) XXX_Unmarshal

func (m *RemoveTowerRequest) XXX_Unmarshal(b []byte) error

type RemoveTowerResponse

type RemoveTowerResponse struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*RemoveTowerResponse) Descriptor

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

func (*RemoveTowerResponse) ProtoMessage

func (*RemoveTowerResponse) ProtoMessage()

func (*RemoveTowerResponse) Reset

func (m *RemoveTowerResponse) Reset()

func (*RemoveTowerResponse) String

func (m *RemoveTowerResponse) String() string

func (*RemoveTowerResponse) XXX_DiscardUnknown

func (m *RemoveTowerResponse) XXX_DiscardUnknown()

func (*RemoveTowerResponse) XXX_Marshal

func (m *RemoveTowerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RemoveTowerResponse) XXX_Merge

func (m *RemoveTowerResponse) XXX_Merge(src proto.Message)

func (*RemoveTowerResponse) XXX_Size

func (m *RemoveTowerResponse) XXX_Size() int

func (*RemoveTowerResponse) XXX_Unmarshal

func (m *RemoveTowerResponse) XXX_Unmarshal(b []byte) error

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 {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*StatsRequest) Descriptor

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

func (*StatsRequest) ProtoMessage

func (*StatsRequest) ProtoMessage()

func (*StatsRequest) Reset

func (m *StatsRequest) Reset()

func (*StatsRequest) String

func (m *StatsRequest) String() string

func (*StatsRequest) XXX_DiscardUnknown

func (m *StatsRequest) XXX_DiscardUnknown()

func (*StatsRequest) XXX_Marshal

func (m *StatsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StatsRequest) XXX_Merge

func (m *StatsRequest) XXX_Merge(src proto.Message)

func (*StatsRequest) XXX_Size

func (m *StatsRequest) XXX_Size() int

func (*StatsRequest) XXX_Unmarshal

func (m *StatsRequest) XXX_Unmarshal(b []byte) error

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*StatsResponse) Descriptor

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

func (*StatsResponse) GetNumBackups

func (m *StatsResponse) GetNumBackups() uint32

func (*StatsResponse) GetNumFailedBackups

func (m *StatsResponse) GetNumFailedBackups() uint32

func (*StatsResponse) GetNumPendingBackups

func (m *StatsResponse) GetNumPendingBackups() uint32

func (*StatsResponse) GetNumSessionsAcquired

func (m *StatsResponse) GetNumSessionsAcquired() uint32

func (*StatsResponse) GetNumSessionsExhausted

func (m *StatsResponse) GetNumSessionsExhausted() uint32

func (*StatsResponse) ProtoMessage

func (*StatsResponse) ProtoMessage()

func (*StatsResponse) Reset

func (m *StatsResponse) Reset()

func (*StatsResponse) String

func (m *StatsResponse) String() string

func (*StatsResponse) XXX_DiscardUnknown

func (m *StatsResponse) XXX_DiscardUnknown()

func (*StatsResponse) XXX_Marshal

func (m *StatsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StatsResponse) XXX_Merge

func (m *StatsResponse) XXX_Merge(src proto.Message)

func (*StatsResponse) XXX_Size

func (m *StatsResponse) XXX_Size() int

func (*StatsResponse) XXX_Unmarshal

func (m *StatsResponse) XXX_Unmarshal(b []byte) error

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"`
	// 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,4,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,5,rep,name=sessions,proto3" json:"sessions,omitempty"`
	XXX_NoUnkeyedLiteral struct{}        `json:"-"`
	XXX_unrecognized     []byte          `json:"-"`
	XXX_sizecache        int32           `json:"-"`
}

func (*Tower) Descriptor

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

func (*Tower) GetActiveSessionCandidate

func (m *Tower) GetActiveSessionCandidate() bool

func (*Tower) GetAddresses

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

func (*Tower) GetNumSessions

func (m *Tower) GetNumSessions() uint32

func (*Tower) GetPubkey

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

func (*Tower) GetSessions

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

func (*Tower) ProtoMessage

func (*Tower) ProtoMessage()

func (*Tower) Reset

func (m *Tower) Reset()

func (*Tower) String

func (m *Tower) String() string

func (*Tower) XXX_DiscardUnknown

func (m *Tower) XXX_DiscardUnknown()

func (*Tower) XXX_Marshal

func (m *Tower) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Tower) XXX_Merge

func (m *Tower) XXX_Merge(src proto.Message)

func (*Tower) XXX_Size

func (m *Tower) XXX_Size() int

func (*Tower) XXX_Unmarshal

func (m *Tower) XXX_Unmarshal(b []byte) error

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"`
	//
	//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.
	SweepSatPerByte      uint32   `protobuf:"varint,4,opt,name=sweep_sat_per_byte,json=sweepSatPerByte,proto3" json:"sweep_sat_per_byte,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*TowerSession) Descriptor

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

func (*TowerSession) GetMaxBackups

func (m *TowerSession) GetMaxBackups() uint32

func (*TowerSession) GetNumBackups

func (m *TowerSession) GetNumBackups() uint32

func (*TowerSession) GetNumPendingBackups

func (m *TowerSession) GetNumPendingBackups() uint32

func (*TowerSession) GetSweepSatPerByte

func (m *TowerSession) GetSweepSatPerByte() uint32

func (*TowerSession) ProtoMessage

func (*TowerSession) ProtoMessage()

func (*TowerSession) Reset

func (m *TowerSession) Reset()

func (*TowerSession) String

func (m *TowerSession) String() string

func (*TowerSession) XXX_DiscardUnknown

func (m *TowerSession) XXX_DiscardUnknown()

func (*TowerSession) XXX_Marshal

func (m *TowerSession) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TowerSession) XXX_Merge

func (m *TowerSession) XXX_Merge(src proto.Message)

func (*TowerSession) XXX_Size

func (m *TowerSession) XXX_Size() int

func (*TowerSession) XXX_Unmarshal

func (m *TowerSession) XXX_Unmarshal(b []byte) error

type UnimplementedWatchtowerClientServer

type UnimplementedWatchtowerClientServer struct {
}

UnimplementedWatchtowerClientServer can be embedded to have forward compatible implementations.

func (*UnimplementedWatchtowerClientServer) AddTower

func (*UnimplementedWatchtowerClientServer) GetTowerInfo

func (*UnimplementedWatchtowerClientServer) ListTowers

func (*UnimplementedWatchtowerClientServer) Policy

func (*UnimplementedWatchtowerClientServer) RemoveTower

func (*UnimplementedWatchtowerClientServer) Stats

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

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.

type WatchtowerClientClient

type WatchtowerClientClient interface {
	//
	//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)
	//
	//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)
	// ListTowers returns the list of watchtowers registered with the client.
	ListTowers(ctx context.Context, in *ListTowersRequest, opts ...grpc.CallOption) (*ListTowersResponse, error)
	// GetTowerInfo retrieves information for a registered watchtower.
	GetTowerInfo(ctx context.Context, in *GetTowerInfoRequest, opts ...grpc.CallOption) (*Tower, error)
	// Stats returns the in-memory statistics of the client since startup.
	Stats(ctx context.Context, in *StatsRequest, opts ...grpc.CallOption) (*StatsResponse, error)
	// 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://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewWatchtowerClientClient

func NewWatchtowerClientClient(cc *grpc.ClientConn) WatchtowerClientClient

type WatchtowerClientServer

type WatchtowerClientServer interface {
	//
	//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)
	//
	//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)
	// ListTowers returns the list of watchtowers registered with the client.
	ListTowers(context.Context, *ListTowersRequest) (*ListTowersResponse, error)
	// GetTowerInfo retrieves information for a registered watchtower.
	GetTowerInfo(context.Context, *GetTowerInfoRequest) (*Tower, error)
	// Stats returns the in-memory statistics of the client since startup.
	Stats(context.Context, *StatsRequest) (*StatsResponse, error)
	// Policy returns the active watchtower client policy configuration.
	Policy(context.Context, *PolicyRequest) (*PolicyResponse, error)
}

WatchtowerClientServer is the server API for WatchtowerClient service.

Jump to

Keyboard shortcuts

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