Documentation ¶
Index ¶
- Constants
- Variables
- func SetupLoggers(root *build.RotatingLogWriter, intercept signal.Interceptor)
- func UseLogger(logger btclog.Logger)
- 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
- type RemoteConfig
- type RemoteDaemonConfig
Constants ¶
const ( ModeIntegrated = "integrated" ModeRemote = "remote" 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 )
const ( // Subsystem defines the logging code for this subsystem. Subsystem = "LITD" // GrpcLogSubsystem defines the logging code for the gRPC subsystem. GrpcLogSubsystem = "GRPC" )
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, ) )
Functions ¶
func SetupLoggers ¶
func SetupLoggers(root *build.RotatingLogWriter, intercept signal.Interceptor)
SetupLoggers initializes all package-global logger variables.
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 { HTTPSListen string `long:"httpslisten" description:"The host:port to listen for incoming HTTP/2 connections on for the web UI only."` 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 `` /* 177-byte string literal not displayed */ UIPasswordFile string `` /* 144-byte string literal not displayed */ UIPasswordEnv string `` /* 159-byte string literal not displayed */ 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 */ LitDir string `` /* 222-byte string literal not displayed */ ConfigFile string `long:"configfile" description:"Path to LiT's configuration file."` // 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` and also for the other daemons. // That way only one global network flag is needed. Network string `` /* 144-byte string literal not displayed */ Remote *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"` FaradayMode string `` /* 408-byte string literal not displayed */ Faraday *faraday.Config `group:"Integrated faraday options (use when faraday-mode=integrated)" namespace:"faraday"` LoopMode string `` /* 392-byte string literal not displayed */ Loop *loopd.Config `group:"Integrated loop options (use when loop-mode=integrated)" namespace:"loop"` PoolMode string `` /* 392-byte string literal not displayed */ Pool *pool.Config `group:"Integrated pool options (use when pool-mode=integrated)" namespace:"pool"` // 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, 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.
type RemoteConfig ¶
type RemoteConfig struct { LitTLSCertPath string `` /* 177-byte string literal not displayed */ LitTLSKeyPath string `` /* 176-byte string literal not displayed */ 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"` }
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.