Documentation ¶
Index ¶
- Variables
- type InterceptorChain
- func (r *InterceptorChain) AddMacaroonService(svc *macaroons.Service)
- func (r *InterceptorChain) AddPermission(method string, ops []bakery.Op) error
- func (r *InterceptorChain) CreateServerOpts() []grpc.ServerOption
- func (r *InterceptorChain) GetState(_ context.Context, req *lnrpc.GetStateRequest) (*lnrpc.GetStateResponse, error)
- func (r *InterceptorChain) MacaroonStreamServerInterceptor() grpc.StreamServerInterceptor
- func (r *InterceptorChain) MacaroonUnaryServerInterceptor() grpc.UnaryServerInterceptor
- func (r *InterceptorChain) Permissions() map[string][]bakery.Op
- func (r *InterceptorChain) SetRPCActive()
- func (r *InterceptorChain) SetWalletLocked()
- func (r *InterceptorChain) SetWalletNotCreated()
- func (r *InterceptorChain) SetWalletUnlocked()
- func (r *InterceptorChain) Start() error
- func (r *InterceptorChain) Stop() error
- func (r *InterceptorChain) SubscribeState(req *lnrpc.SubscribeStateRequest, stream lnrpc.State_SubscribeStateServer) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrWaitingToStart is returned if LND is still wating to start, // possibly blocked until elected as the leader. ErrWaitingToStart = fmt.Errorf("waiting to start, RPC services not " + "available") // ErrNoWallet is returned if the wallet does not exist. ErrNoWallet = fmt.Errorf("wallet not created, create one to enable " + "full RPC access") // ErrWalletLocked is returned if the wallet is locked and any service // other than the WalletUnlocker is called. ErrWalletLocked = fmt.Errorf("wallet locked, unlock it to enable " + "full RPC access") // ErrWalletUnlocked is returned if the WalletUnlocker service is // called when the wallet already has been unlocked. ErrWalletUnlocked = fmt.Errorf("wallet already unlocked, " + "WalletUnlocker service is no longer available") // ErrRPCStarting is returned if the wallet has been unlocked but the // RPC server is not yet ready to accept calls. ErrRPCStarting = fmt.Errorf("the RPC server is in the process of " + "starting up, but not yet ready to accept calls") )
Functions ¶
This section is empty.
Types ¶
type InterceptorChain ¶
InterceptorChain is a struct that can be added to the running GRPC server, intercepting API calls. This is useful for logging, enforcing permissions etc.
func NewInterceptorChain ¶
func NewInterceptorChain(log btclog.Logger, noMacaroons bool) *InterceptorChain
NewInterceptorChain creates a new InterceptorChain.
func (*InterceptorChain) AddMacaroonService ¶
func (r *InterceptorChain) AddMacaroonService(svc *macaroons.Service)
AddMacaroonService adds a macaroon service to the interceptor. After this is done every RPC call made will have to pass a valid macaroon to be accepted.
func (*InterceptorChain) AddPermission ¶
func (r *InterceptorChain) AddPermission(method string, ops []bakery.Op) error
AddPermission adds a new macaroon rule for the given method.
func (*InterceptorChain) CreateServerOpts ¶
func (r *InterceptorChain) CreateServerOpts() []grpc.ServerOption
CreateServerOpts creates the GRPC server options that can be added to a GRPC server in order to add this InterceptorChain.
func (*InterceptorChain) GetState ¶
func (r *InterceptorChain) GetState(_ context.Context, req *lnrpc.GetStateRequest) (*lnrpc.GetStateResponse, error)
GetState returns he current wallet state.
func (*InterceptorChain) MacaroonStreamServerInterceptor ¶
func (r *InterceptorChain) MacaroonStreamServerInterceptor() grpc.StreamServerInterceptor
MacaroonStreamServerInterceptor is a GRPC interceptor that checks whether the request is authorized by the included macaroons.
func (*InterceptorChain) MacaroonUnaryServerInterceptor ¶
func (r *InterceptorChain) MacaroonUnaryServerInterceptor() grpc.UnaryServerInterceptor
MacaroonUnaryServerInterceptor is a GRPC interceptor that checks whether the request is authorized by the included macaroons.
func (*InterceptorChain) Permissions ¶
func (r *InterceptorChain) Permissions() map[string][]bakery.Op
Permissions returns the current set of macaroon permissions.
func (*InterceptorChain) SetRPCActive ¶
func (r *InterceptorChain) SetRPCActive()
SetRPCActive moves the RPC state from walletUnlocked to rpcActive.
func (*InterceptorChain) SetWalletLocked ¶
func (r *InterceptorChain) SetWalletLocked()
SetWalletLocked moves the RPC state from either walletNotCreated to walletLocked.
func (*InterceptorChain) SetWalletNotCreated ¶
func (r *InterceptorChain) SetWalletNotCreated()
SetWalletNotCreated moves the RPC state from either waitingToStart to walletNotCreated.
func (*InterceptorChain) SetWalletUnlocked ¶
func (r *InterceptorChain) SetWalletUnlocked()
SetWalletUnlocked moves the RPC state from either walletNotCreated or walletLocked to walletUnlocked.
func (*InterceptorChain) Start ¶
func (r *InterceptorChain) Start() error
Start starts the InterceptorChain, which is needed to start the state subscription server it powers.
func (*InterceptorChain) Stop ¶
func (r *InterceptorChain) Stop() error
Stop stops the InterceptorChain and its internal state subscription server.
func (*InterceptorChain) SubscribeState ¶
func (r *InterceptorChain) SubscribeState(req *lnrpc.SubscribeStateRequest, stream lnrpc.State_SubscribeStateServer) error
SubscribeState subscribes to the state of the wallet. The current wallet state will always be delivered immediately.
NOTE: Part of the StateService interface.