Documentation ¶
Index ¶
- Constants
- func UseLogger(logger btclog.Logger)
- type Manager
- func (s *Manager) AddServer(ss SubServer, enable bool) error
- func (s *Manager) ConnectRemoteSubServers()
- func (s *Manager) GetRemoteConn(uri string) (bool, *grpc.ClientConn, error)
- func (s *Manager) GetServer(name string) (SubServer, bool)
- func (s *Manager) Handles(uri string) (bool, string)
- func (s *Manager) MacaroonPath(uri string) (bool, string)
- func (s *Manager) ReadRemoteMacaroon(uri string) (bool, []byte, error)
- func (s *Manager) RegisterRPCServices(server grpc.ServiceRegistrar)
- func (s *Manager) RegisterRestServices(ctx context.Context, mux *restProxy.ServeMux, endpoint string, ...) error
- func (s *Manager) StartIntegratedServers(lndClient lnrpc.LightningClient, lndGrpc *lndclient.GrpcLndServices, ...)
- func (s *Manager) Stop() error
- func (s *Manager) ValidateMacaroon(ctx context.Context, requiredPermissions []bakery.Op, uri string) (bool, error)
- type RemoteConfig
- type RemoteDaemonConfig
- type SubServer
- func NewFaradaySubServer(cfg *faraday.Config, rpcCfg *frdrpcserver.Config, ...) SubServer
- func NewLoopSubServer(cfg *loopd.Config, remoteCfg *RemoteDaemonConfig, remote bool) SubServer
- func NewPoolSubServer(cfg *pool.Config, remoteCfg *RemoteDaemonConfig, remote bool) SubServer
- func NewTaprootAssetsSubServer(network string, cfg *tapcfg.Config, remoteCfg *RemoteDaemonConfig, ...) SubServer
Constants ¶
const ( LND string = "lnd" LIT string = "lit" LOOP string = "loop" POOL string = "pool" TAP string = "taproot-assets" FARADAY string = "faraday" ACCOUNTS string = "accounts" )
const Subsystem = "SSVR"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages a set of subServer objects.
func NewManager ¶
NewManager constructs a new Manager.
func (*Manager) ConnectRemoteSubServers ¶
func (s *Manager) ConnectRemoteSubServers()
ConnectRemoteSubServers creates connections to all the manager's sub-servers that are running remotely.
func (*Manager) GetRemoteConn ¶
GetRemoteConn checks if any of the manager's sub-servers owns the given uri and if so, the remote connection to that sub-server is returned. The bool return value indicates if the uri is managed by one of the sub-servers running in remote mode.
func (*Manager) Handles ¶
Handles returns true if one of its sub-servers owns the given URI along with the name of the service.
func (*Manager) MacaroonPath ¶
MacaroonPath checks if any of the manager's sub-servers owns the given uri and if so, the appropriate macaroon path is returned for that sub-server.
func (*Manager) ReadRemoteMacaroon ¶
ReadRemoteMacaroon checks if any of the manager's sub-servers running in remote mode owns the given uri and if so, the appropriate macaroon path is returned for that sub-server.
func (*Manager) RegisterRPCServices ¶
func (s *Manager) RegisterRPCServices(server grpc.ServiceRegistrar)
RegisterRPCServices registers all the manager's sub-servers with the given grpc registrar.
func (*Manager) RegisterRestServices ¶
func (s *Manager) RegisterRestServices(ctx context.Context, mux *restProxy.ServeMux, endpoint string, dialOpts []grpc.DialOption) error
RegisterRestServices registers all the manager's sub-servers REST handlers with the given endpoint.
func (*Manager) StartIntegratedServers ¶
func (s *Manager) StartIntegratedServers(lndClient lnrpc.LightningClient, lndGrpc *lndclient.GrpcLndServices, withMacaroonService bool)
StartIntegratedServers starts all the manager's sub-servers that should be started in integrated mode.
func (*Manager) ValidateMacaroon ¶
func (s *Manager) ValidateMacaroon(ctx context.Context, requiredPermissions []bakery.Op, uri string) (bool, error)
ValidateMacaroon checks if any of the manager's sub-servers owns the given uri and if so, if it is running in remote mode, then true is returned since the macaroon will be validated by the remote subserver itself when the request arrives. Otherwise, the integrated sub-server's validator validates the macaroon.
type RemoteConfig ¶
type RemoteConfig struct { LitLogDir string `long:"lit-logdir" description:"For lnd remote mode only: Directory to log output."` LitMaxLogFiles int `long:"lit-maxlogfiles" description:"For lnd remote mode only: Maximum logfiles to keep (0 for no rotation)"` LitMaxLogFileSize int `long:"lit-maxlogfilesize" description:"For lnd remote mode only: Maximum logfile size in MB"` LitDebugLevel string `` /* 255-byte string literal not displayed */ Lnd *RemoteDaemonConfig `group:"Remote lnd (use when lnd-mode=remote)" namespace:"lnd"` Faraday *RemoteDaemonConfig `group:"Remote faraday (use when faraday-mode=remote)" namespace:"faraday"` Loop *RemoteDaemonConfig `group:"Remote loop (use when loop-mode=remote)" namespace:"loop"` Pool *RemoteDaemonConfig `group:"Remote pool (use when pool-mode=remote)" namespace:"pool"` TaprootAssets *RemoteDaemonConfig `group:"Remote taproot-assets (use when taproot-assets-mode=remote)" namespace:"taproot-assets"` }
RemoteConfig holds the configuration parameters that are needed when running LiT in the "remote" lnd mode.
type RemoteDaemonConfig ¶
type RemoteDaemonConfig struct { // RPCServer is host:port that the remote daemon's RPC server is // listening on. RPCServer string `long:"rpcserver" description:"The host:port that the remote daemon is listening for RPC connections on."` // MacaroonPath is the path to the single macaroon that should be used // instead of needing to specify the macaroon directory that contains // all of the daemon's macaroons. The specified macaroon MUST have all // permissions that all the subservers use, otherwise permission errors // will occur. MacaroonPath string `` /* 272-byte string literal not displayed */ // TLSCertPath is the path to the tls cert of the remote daemon that // should be used to verify the TLS identity of the remote RPC server. TLSCertPath string `long:"tlscertpath" description:"The full path to the remote daemon's TLS cert to use for RPC connection verification."` }
RemoteDaemonConfig holds the configuration parameters that are needed to connect to a remote daemon like lnd for example.
type SubServer ¶
type SubServer interface { macaroons.MacaroonValidator // Name returns the name of the sub-server. Name() string // Remote returns true if the sub-server is running remotely and so // should be connected to instead of spinning up an integrated server. Remote() bool // RemoteConfig returns the config required to connect to the sub-server // if it is running in remote mode. RemoteConfig() *RemoteDaemonConfig // Start starts the sub-server in integrated mode. Start(lnrpc.LightningClient, *lndclient.GrpcLndServices, bool) error // Stop stops the sub-server in integrated mode. Stop() error // RegisterGrpcService must register the sub-server's GRPC server with // the given registrar. RegisterGrpcService(grpc.ServiceRegistrar) // RegisterRestService registers the sub-server's REST handlers with the // given endpoint. RegisterRestService(context.Context, *restProxy.ServeMux, string, []grpc.DialOption) error // ServerErrChan returns an error channel that should be listened on // after starting the sub-server to listen for any runtime errors. It // is optional and may be set to nil. This only applies in integrated // mode. ServerErrChan() chan error // MacPath returns the path to the sub-server's macaroon if it is not // running in remote mode. MacPath() string // Permissions returns a map of all RPC methods and their required // macaroon permissions to access the sub-server. Permissions() map[string][]bakery.Op // WhiteListedURLs returns a map of all the sub-server's URLs that can // be accessed without a macaroon. WhiteListedURLs() map[string]struct{} // Impl returns the actual implementation of the sub-server. This might // not be set if the sub-server is running in remote mode. Impl() fn.Option[any] }
SubServer defines an interface that should be implemented by any sub-server that the subServer manager should manage. A sub-server can be run in either integrated or remote mode. A sub-server is considered non-fatal to LiT meaning that if a sub-server fails to start, LiT can safely continue with its operations and other sub-servers can too.
func NewFaradaySubServer ¶
func NewFaradaySubServer(cfg *faraday.Config, rpcCfg *frdrpcserver.Config, remoteCfg *RemoteDaemonConfig, remote bool) SubServer
NewFaradaySubServer returns a new faraday implementation of the SubServer interface.
func NewLoopSubServer ¶
func NewLoopSubServer(cfg *loopd.Config, remoteCfg *RemoteDaemonConfig, remote bool) SubServer
NewLoopSubServer returns a new loop implementation of the SubServer interface.
func NewPoolSubServer ¶
func NewPoolSubServer(cfg *pool.Config, remoteCfg *RemoteDaemonConfig, remote bool) SubServer
NewPoolSubServer returns a new pool implementation of the SubServer interface.
func NewTaprootAssetsSubServer ¶
func NewTaprootAssetsSubServer(network string, cfg *tapcfg.Config, remoteCfg *RemoteDaemonConfig, remote, lndRemote bool) SubServer
NewTaprootAssetsSubServer returns a new tap implementation of the SubServer interface.