terminal

package module
v0.6.1-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2021 License: MIT Imports: 70 Imported by: 0

README

Lightning Terminal (LiT)

CI

Lightning Terminal (LiT) is a browser-based interface for managing channel liquidity.

screenshot

Features

  • Visualize your channels and balances
  • Perform submarine swaps via the Lightning Loop service
  • Classify channels according to your node's operating mode
  • Run a single binary that integrates loopd, poold and faraday daemons all in one
  • Access a preview release of the Pool UI
  • Use Pool to earn sats by opening channels to those needing inbound liquidity

Installation

Download the latest binaries from the releases page.

Additionally, you can find detailed instructions on the docs.lightning.engineering page.

Execution

Run Lightning Terminal with a local lnd instance:

⛰  ./litd --uipassword=UP48lm4Vjqxy<change_this_or_you_will_get_robbed>

Visit https://localhost:8443 to access Terminal.

Note that a password with a minimum of 8 characters is required to run Lightning Terminal. In a production environment, it's recommended that you store this password as an environment variable to avoid it being recorded in the command history.

To use LiT with a remote lnd instance please follow these instructions. If you would like to replace your existing LND instance with the one integrated within LiT please see configuring Terminal.

LND

Note that LiT requires lnd to be built with all of its subservers and requires running at least v0.11.0. Download the latest official release binary or build lnd from source by following the installation instructions. If you choose to build lnd from source, use the following command to enable all the relevant subservers:

⛰  make install tags="signrpc walletrpc chainrpc invoicesrpc"

Interaction

If you plan to run LiT on a remote machine but access the web-interface from your computer you may not want to deal with self-signed certificate browser warnings. To avoid these warnings configure the HTTP server to use a certificate from Let's Encrypt. View the Let's Encrypt Configuration doc for instructions on how to configure this.

Upgrading

If you used command line arguments with previous versions then you don't need to change anything when upgrading.

To upgrade from v0.1.1-alpha or earlier simply create a lit.conf file in your LiT directory. The default location LiT uses depends on your operating system:

  • MacOS: ~/Library/Application Support/Lit/lit.conf
  • Linux: ~/.lit/lit.conf
  • Windows: ~/AppData/Roaming/Lit/lit.conf

Move all the configuration settings specific to LiT from lnd.conf to lit.conf and remove any previous LiT-specific customizations from the configuration settings in lnd.conf. Note that any section headers ([ Example ]) in lit.conf should be removed or changed to comments (# Example).

Usage

Read the walkthrough document to learn more about how to use LiT.

Troubleshooting

If you encounter any issues please see our troubleshooting guide.

Build from source

If you’d prefer to compile from source code please follow these instructions.

Compatibility

Lightning Terminal is backwards compatible with lnd back to version v0.13.3-beta.

LiT LND
v0.6.1-alpha v0.13.3-beta
v0.6.0-alpha v0.13.3-beta
v0.5.2-alpha v0.12.0-beta
v0.5.1-alpha v0.12.0-beta
v0.5.0-alpha v0.12.0-beta
v0.4.1-alpha v0.11.1-beta
v0.4.0-alpha v0.11.1-beta
v0.3.4-alpha v0.11.1-beta
v0.3.3-alpha v0.11.1-beta
v0.3.2-alpha v0.11.1-beta
v0.3.1-alpha v0.11.1-beta
v0.3.0-alpha v0.11.1-beta
v0.2.0-alpha v0.11.0-beta

Daemon Versions packaged with LiT

LiT LND Loop Faraday Pool
v0.6.1-alpha v0.14.1-beta v0.15.1-beta v0.2.7-alpha v0.5.2-alpha
v0.5.3-alpha v0.13.3-beta v0.14.1-beta v0.2.6-alpha v0.5.0-alpha
v0.5.2-alpha v0.13.3-beta v0.14.1-beta v0.2.6-alpha v0.5.0-alpha
v0.5.1-alpha v0.13.0-beta v0.14.1-beta v0.2.6-alpha v0.5.0-alpha
v0.5.0-alpha v0.13.0-beta v0.14.1-beta v0.2.6-alpha v0.5.0-alpha
v0.4.1-alpha v0.12.1-beta v0.11.4-beta v0.2.3-alpha v0.4.4-alpha
v0.4.0-alpha v0.12.0-beta v0.11.2-beta v0.2.3-alpha v0.4.3-alpha
v0.3.4-alpha v0.11.1-beta v0.11.2-beta v0.2.2-alpha v0.3.4-alpha
v0.3.3-alpha v0.11.1-beta v0.11.2-beta v0.2.2-alpha v0.3.4-alpha
v0.3.2-alpha v0.11.1-beta v0.11.1-beta v0.2.2-alpha v0.3.4-alpha
v0.3.1-alpha v0.11.1-beta v0.11.1-beta v0.2.2-alpha v0.3.3-alpha
v0.3.0-alpha v0.11.1-beta v0.11.0-beta v0.2.2-alpha v0.3.2-alpha
v0.2.0-alpha v0.11.1-beta v0.10.0-beta v0.2.1-alpha n/a
v0.1.1-alpha v0.11.0-beta v0.8.1-beta v0.2.0-alpha n/a
v0.1.0-alpha v0.10.3-beta v0.6.5-beta v0.2.0-alpha n/a

Documentation

Index

Constants

View Source
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
)
View Source
const (
	// Subsystem defines the logging code for this subsystem.
	Subsystem = "LITD"

	// GrpcLogSubsystem defines the logging code for the gRPC subsystem.
	GrpcLogSubsystem = "GRPC"
)
View Source
const (

	// HeaderMacaroon is the HTTP header field name that is used to send
	// the macaroon.
	HeaderMacaroon = "Macaroon"
)

Variables

View Source
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.

func UseLogger

func UseLogger(logger btclog.Logger)

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.

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

func (*ClientRouteWrapper) Open

func (i *ClientRouteWrapper) Open(name string) (http.File, error)

Open intercepts requests to open files. If the file does not exist and there is no file extension, then assume this is a client side route and return the contents of index.html

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

type GrpcLogLogger struct {
	btclog.Logger
}

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.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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