Documentation ¶
Index ¶
- Constants
- Variables
- func BakeSuperMacaroon(ctx context.Context, lnd lnrpc.LightningClient, rootKeyID uint64, ...) (string, error)
- func SetupLoggers(root *build.RotatingLogWriter, intercept signal.Interceptor)
- func UseLogger(logger btclog.Logger)
- func Version() string
- type ClientRouteWrapper
- type Config
- type GrpcLogLogger
- func (l GrpcLogLogger) Errorln(args ...interface{})
- func (l GrpcLogLogger) Fatal(args ...interface{})
- func (l GrpcLogLogger) Fatalf(format string, args ...interface{})
- func (l GrpcLogLogger) Fatalln(args ...interface{})
- func (l GrpcLogLogger) Info(args ...interface{})
- func (l GrpcLogLogger) Infof(format string, args ...interface{})
- func (l GrpcLogLogger) Infoln(args ...interface{})
- func (l GrpcLogLogger) V(level int) bool
- func (l GrpcLogLogger) Warning(args ...interface{})
- func (l GrpcLogLogger) Warningf(format string, args ...interface{})
- func (l GrpcLogLogger) Warningln(args ...interface{})
- type LightningTerminal
- func (g *LightningTerminal) BuildWalletConfig(ctx context.Context, dbs *lnd.DatabaseInstances, ...) (*chainreg.PartialChainControl, *btcwallet.Config, func(), error)
- func (g *LightningTerminal) Permissions() map[string][]bakery.Op
- func (g *LightningTerminal) RegisterGrpcSubserver(server *grpc.Server) error
- func (g *LightningTerminal) RegisterRestSubserver(ctx context.Context, mux *restProxy.ServeMux, endpoint string, ...) error
- func (g *LightningTerminal) Run() error
- func (g *LightningTerminal) ValidateMacaroon(ctx context.Context, requiredPermissions []bakery.Op, fullMethod string) error
Constants ¶
const ( ModeIntegrated = "integrated" ModeRemote = "remote" ModeDisable = "disable" DefaultLndMode = ModeRemote DefaultTLSCertFilename = "tls.cert" DefaultTLSKeyFilename = "tls.key" DefaultNetwork = "mainnet" // DefaultAutogenValidity is the default validity of a self-signed // certificate. The value corresponds to 14 months // (14 months * 30 days * 24 hours). DefaultAutogenValidity = 14 * 30 * 24 * time.Hour // DefaultMacaroonFilename is the default file name for the // autogenerated lit macaroon. DefaultMacaroonFilename = "lit.macaroon" )
const ( // Subsystem defines the logging code for this subsystem. Subsystem = "LITD" // GrpcLogSubsystem defines the logging code for the gRPC subsystem. GrpcLogSubsystem = "GRPC" )
const ( MainnetServer = "autopilot.lightning.finance:12010" TestnetServer = "test.autopilot.lightning.finance:12010" )
const ( // HeaderMacaroon is the HTTP header field name that is used to send // the macaroon. HeaderMacaroon = "Macaroon" )
Variables ¶
var ( // DefaultLitDir is the default directory where LiT tries to find its // configuration file and store its data (in remote lnd node). This is a // directory in the user's application data, for example: // C:\Users\<username>\AppData\Local\Lit on Windows // ~/.lit on Linux // ~/Library/Application Support/Lit on MacOS DefaultLitDir = btcutil.AppDataDir("lit", false) // DefaultTLSCertPath is the default full path of the autogenerated TLS // certificate that is created in remote lnd mode. DefaultTLSCertPath = filepath.Join( DefaultLitDir, DefaultTLSCertFilename, ) // DefaultRemoteLndMacaroonPath is the default path we assume for a // local lnd node to store its admin.macaroon file at. DefaultRemoteLndMacaroonPath = filepath.Join( lndDefaultConfig.DataDir, defaultLndChainSubDir, defaultLndChain, DefaultNetwork, defaultLndMacaroon, ) // DefaultMacaroonPath is the default full path of the base lit // macaroon. DefaultMacaroonPath = filepath.Join( DefaultLitDir, DefaultNetwork, DefaultMacaroonFilename, ) )
var ( // ErrWaitingToStart is returned if Lit's rpcProxy is not yet ready to // handle calls. ErrWaitingToStart = fmt.Errorf("waiting for the RPC server to start") // ErrUnknownRequest is an error returned when the request URI is // unknown if the permissions for the request are unknown. ErrUnknownRequest = fmt.Errorf("unknown request") )
var Commit string
Commit stores the current commit hash of this build, this should be set using the -ldflags during compilation.
Functions ¶
func BakeSuperMacaroon ¶
func BakeSuperMacaroon(ctx context.Context, lnd lnrpc.LightningClient, rootKeyID uint64, perms []bakery.Op, caveats []macaroon.Caveat) (string, error)
BakeSuperMacaroon uses the lnd client to bake a macaroon that can include permissions for multiple daemons.
func SetupLoggers ¶
func SetupLoggers(root *build.RotatingLogWriter, intercept signal.Interceptor)
SetupLoggers initializes all package-global logger variables.
func UseLogger ¶
UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.
func Version ¶
func Version() string
Version returns the application version as a properly formed string per the semantic versioning 2.0.0 spec (http://semver.org/).
Types ¶
type ClientRouteWrapper ¶
type ClientRouteWrapper struct {
// contains filtered or unexported fields
}
ClientRouteWrapper is a wrapper around a FileSystem which properly handles URL routes that are defined in the client app but unknown to the backend http server
type Config ¶
type Config struct { ShowVersion bool `long:"version" description:"Display version information and exit."` HTTPSListen string `` /* 248-byte string literal not displayed */ HTTPListen string `` /* 257-byte string literal not displayed */ EnableREST bool `long:"enablerest" description:"Also allow REST requests to be made to the main HTTP(s) port(s) configured above."` RestCORS []string `long:"restcors" description:"Add an ip:port/hostname to allow cross origin access from. To allow all origins, set as \"*\"."` UIPassword string `` /* 172-byte string literal not displayed */ UIPasswordFile string `` /* 144-byte string literal not displayed */ UIPasswordEnv string `` /* 159-byte string literal not displayed */ DisableUI bool `long:"disableui" description:"If set to true, no web UI will be served and so the uipassword will also not need to be set."` LetsEncrypt bool `` /* 221-byte string literal not displayed */ LetsEncryptHost string `long:"letsencrypthost" description:"The host name to create a Let's Encrypt certificate for."` LetsEncryptDir string `long:"letsencryptdir" description:"The directory where the Let's Encrypt library will store its key and certificate."` LetsEncryptListen string `` /* 471-byte string literal not displayed */ TLSCertPath string `` /* 190-byte string literal not displayed */ TLSKeyPath string `` /* 189-byte string literal not displayed */ TLSExtraIPs []string `long:"tlsextraip" description:"Adds an extra ip to the generated LiT TLS certificate (if Let's Encrypt is not used)"` TLSExtraDomains []string `long:"tlsextradomain" description:"Adds an extra domain to the generated LiT TLS certificate (if Let's Encrypt is not used)"` LitDir string `` /* 222-byte string literal not displayed */ ConfigFile string `long:"configfile" description:"Path to LiT's configuration file."` MacaroonPath string `long:"macaroonpath" description:"Path to write the macaroon for litd's RPC and REST services if it doesn't exist."` FirstLNCConnDeadline time.Duration `` /* 212-byte string literal not displayed */ // Network is the Bitcoin network we're running on. This will be parsed // before the configuration is loaded and will set the correct flag on // `lnd.bitcoin.mainnet|testnet|regtest|signet` and also for the other // daemons. That way only one global network flag is needed. Network string `` /* 160-byte string literal not displayed */ Remote *subservers.RemoteConfig `group:"Remote mode options (use when lnd-mode=remote)" namespace:"remote"` // LndMode is the selected mode to run lnd in. The supported modes are // 'integrated' and 'remote'. We only use a string instead of a bool // here (and for all the other daemons) to make the CLI more user // friendly. Because then we can reference the explicit modes in the // help descriptions of the section headers. We'll parse the mode into // a bool for internal use for better code readability. LndMode string `` /* 515-byte string literal not displayed */ Lnd *lnd.Config `group:"Integrated lnd (use when lnd-mode=integrated)" namespace:"lnd"` LndRPCTimeout time.Duration `` /* 301-byte string literal not displayed */ LndConnectInterval time.Duration `` /* 169-byte string literal not displayed */ FaradayMode string `` /* 489-byte string literal not displayed */ Faraday *faraday.Config `group:"Integrated faraday options (use when faraday-mode=integrated)" namespace:"faraday"` LoopMode string `` /* 470-byte string literal not displayed */ Loop *loopd.Config `group:"Integrated loop options (use when loop-mode=integrated)" namespace:"loop"` PoolMode string `` /* 470-byte string literal not displayed */ Pool *pool.Config `group:"Integrated pool options (use when pool-mode=integrated)" namespace:"pool"` TaprootAssetsMode string `` /* 496-byte string literal not displayed */ TaprootAssets *tapcfg.Config `group:"Integrated taproot assets options (use when taproot-assets=integrated)" namespace:"taproot-assets"` RPCMiddleware *mid.Config `group:"RPC middleware options" namespace:"rpcmiddleware"` Autopilot *autopilotserver.Config `group:"Autopilot server options" namespace:"autopilot"` Firewall *firewall.Config `group:"Firewall options" namespace:"firewall"` Accounts *accounts.Config `group:"Accounts options" namespace:"accounts"` // contains filtered or unexported fields }
Config is the main configuration struct of lightning-terminal. It contains all config items of its enveloping subservers, each prefixed with their daemon's short name.
type GrpcLogLogger ¶
GrpcLogLogger is a wrapper around a btclog logger to make it compatible with the grpclog logger package. By default we downgrade the info level to debug to reduce the verbosity of the logger.
func NewGrpcLogLogger ¶
func NewGrpcLogLogger(root *build.RotatingLogWriter, intercept signal.Interceptor, subsystem string) *GrpcLogLogger
NewGrpcLogLogger creates a new grpclog compatible logger and attaches it as a sub logger to the passed root logger.
func (GrpcLogLogger) Errorln ¶
func (l GrpcLogLogger) Errorln(args ...interface{})
func (GrpcLogLogger) Fatal ¶
func (l GrpcLogLogger) Fatal(args ...interface{})
func (GrpcLogLogger) Fatalf ¶
func (l GrpcLogLogger) Fatalf(format string, args ...interface{})
func (GrpcLogLogger) Fatalln ¶
func (l GrpcLogLogger) Fatalln(args ...interface{})
func (GrpcLogLogger) Info ¶
func (l GrpcLogLogger) Info(args ...interface{})
func (GrpcLogLogger) Infof ¶
func (l GrpcLogLogger) Infof(format string, args ...interface{})
func (GrpcLogLogger) Infoln ¶
func (l GrpcLogLogger) Infoln(args ...interface{})
func (GrpcLogLogger) V ¶
func (l GrpcLogLogger) V(level int) bool
func (GrpcLogLogger) Warning ¶
func (l GrpcLogLogger) Warning(args ...interface{})
func (GrpcLogLogger) Warningf ¶
func (l GrpcLogLogger) Warningf(format string, args ...interface{})
func (GrpcLogLogger) Warningln ¶
func (l GrpcLogLogger) Warningln(args ...interface{})
type LightningTerminal ¶
type LightningTerminal struct {
// contains filtered or unexported fields
}
LightningTerminal is the main grand unified binary instance. Its task is to start an lnd node then start and register external subservers to it.
func New ¶
func New() *LightningTerminal
New creates a new instance of the lightning-terminal daemon.
func (*LightningTerminal) BuildWalletConfig ¶
func (g *LightningTerminal) BuildWalletConfig(ctx context.Context, dbs *lnd.DatabaseInstances, auxComponents *lnd.AuxComponents, interceptorChain *rpcperms.InterceptorChain, grpcListeners []*lnd.ListenerWithSignal) (*chainreg.PartialChainControl, *btcwallet.Config, func(), error)
BuildWalletConfig is responsible for creating or unlocking and then fully initializing a wallet.
NOTE: This is only implemented in order for us to intercept the setup call and store a reference to the interceptor chain.
NOTE: This is part of the lnd.WalletConfigBuilder interface.
func (*LightningTerminal) Permissions ¶
func (g *LightningTerminal) Permissions() map[string][]bakery.Op
Permissions returns all permissions for which the external validator of the terminal is responsible.
NOTE: This is part of the lnd.ExternalValidator interface.
func (*LightningTerminal) RegisterGrpcSubserver ¶
func (g *LightningTerminal) RegisterGrpcSubserver(server *grpc.Server) error
RegisterGrpcSubserver is a callback on the lnd.SubserverConfig struct that is called once lnd has initialized its main gRPC server instance. It gives the daemons (or external subservers) the possibility to register themselves to the same server instance.
NOTE: This is part of the lnd.GrpcRegistrar interface.
func (*LightningTerminal) RegisterRestSubserver ¶
func (g *LightningTerminal) RegisterRestSubserver(ctx context.Context, mux *restProxy.ServeMux, endpoint string, dialOpts []grpc.DialOption) error
RegisterRestSubserver is a callback on the lnd.SubserverConfig struct that is called once lnd has initialized its main REST server instance. It gives the daemons (or external subservers) the possibility to register themselves to the same server instance.
NOTE: This is part of the lnd.RestRegistrar interface.
func (*LightningTerminal) Run ¶
func (g *LightningTerminal) Run() error
Run starts everything and then blocks until either the application is shut down or a critical error happens.
func (*LightningTerminal) ValidateMacaroon ¶
func (g *LightningTerminal) ValidateMacaroon(ctx context.Context, requiredPermissions []bakery.Op, fullMethod string) error
ValidateMacaroon extracts the macaroon from the context's gRPC metadata, checks its signature, makes sure all specified permissions for the called method are contained within and finally ensures all caveat conditions are met. A non-nil error is returned if any of the checks fail.
NOTE: This is part of the lnd.ExternalValidator interface.