broln

package module
v0.0.0-...-bd4bb24 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: MIT Imports: 133 Imported by: 0

README

Lightning Network Daemon

Build Status MIT licensed Irc Godoc

The Lightning Network Daemon (broln) - is a complete implementation of a Lightning Network node. broln has several pluggable back-end chain services including brond (a full-node), brocoind, and neutrino (a new experimental light client). The project's codebase uses the brsuite set of Brocoin libraries, and also exports a large set of isolated re-usable Lightning Network related libraries within it. In the current state broln is capable of:

  • Creating channels.
  • Closing channels.
  • Completely managing all channel states (including the exceptional ones!).
  • Maintaining a fully authenticated+validated channel graph.
  • Performing path finding within the network, passively forwarding incoming payments.
  • Sending outgoing onion-encrypted payments through the network.
  • Updating advertised fee schedules.
  • Automatic channel management (autopilot).

Lightning Network Specification Compliance

broln fully conforms to the Lightning Network specification (BOLTs). BOLT stands for: Basis of Lightning Technology. The specifications are currently being drafted by several groups of implementers based around the world including the developers of broln. The set of specification documents as well as our implementation of the specification are still a work-in-progress. With that said, the current status of broln's BOLT compliance is:

  • BOLT 1: Base Protocol
  • BOLT 2: Peer Protocol for Channel Management
  • BOLT 3: Brocoin Transaction and Script Formats
  • BOLT 4: Onion Routing Protocol
  • BOLT 5: Recommendations for On-chain Transaction Handling
  • BOLT 7: P2P Node and Channel Discovery
  • BOLT 8: Encrypted and Authenticated Transport
  • BOLT 9: Assigned Feature Flags
  • BOLT 10: DNS Bootstrap and Assisted Node Location
  • BOLT 11: Invoice Protocol for Lightning Payments

Developer Resources

The daemon has been designed to be as developer friendly as possible in order to facilitate application development on top of broln. Two primary RPC interfaces are exported: an HTTP REST API, and a gRPC service. The exported API's are not yet stable, so be warned: they may change drastically in the near future.

An automatically generated set of documentation for the RPC APIs can be found at api.lightning.community. A set of developer resources including guides, articles, example applications and community resources can be found at: docs.lightning.engineering.

Finally, we also have an active Slack where protocol developers, application developers, testers and users gather to discuss various aspects of broln and also Lightning in general.

Installation

In order to build from source, please see the installation instructions.

Docker

To run broln from Docker, please see the main Docker instructions

IRC

  • irc.libera.chat
  • channel #broln
  • webchat

Safety

When operating a mainnet broln node, please refer to our operational safety guidelines. It is important to note that broln is still beta software and that ignoring these operational guidelines can lead to loss of funds.

Security

The developers of broln take security very seriously. The disclosure of security vulnerabilities helps us secure the health of broln, privacy of our users, and also the health of the Lightning Network as a whole. If you find any issues regarding security or privacy, please disclose the information responsibly by sending an email to security at lightning dot engineering, preferably encrypted using our designated PGP key (91FE464CD75101DA6B6BAB60555C6465E5BCB3AF) which can be found here.

Further reading

broln

broln1

broln

broln

broln

broln

broln

Documentation

Index

Constants

View Source
const UnassignedConnID uint64 = 0

UnassignedConnID is the default connection ID that a request can have before it actually is submitted to the connmgr. TODO(conner): move into connmgr package, or better, add connmgr method for generating atomic IDs

Variables

View Source
var (
	// DefaultBrolnDir is the default directory where broln tries to find its
	// configuration file and store its data. This is a directory in the
	// user's application data, for example:
	//   C:\Users\<username>\AppData\Local\broln on Windows
	//   ~/.broln on Linux
	//   ~/Library/Application Support/broln on MacOS
	DefaultBrolnDir = bronutil.AppDataDir("broln", false)

	// DefaultConfigFile is the default full path of broln's configuration
	// file.
	DefaultConfigFile = filepath.Join(DefaultBrolnDir, lncfg.DefaultConfigFilename)
)
View Source
var (
	// ErrPeerNotConnected signals that the server has no connection to the
	// given peer.
	ErrPeerNotConnected = errors.New("peer is not connected")

	// ErrServerNotActive indicates that the server has started but hasn't
	// fully finished the startup process.
	ErrServerNotActive = errors.New("server is still in the process of " +
		"starting")

	// ErrServerShuttingDown indicates that the server is in the process of
	// gracefully exiting.
	ErrServerShuttingDown = errors.New("server is shutting down")

	// MaxFundingAmount is a soft-limit of the maximum channel size
	// currently accepted within the Lightning Protocol. This is
	// defined in BOLT-0002, and serves as an initial precautionary limit
	// while implementations are battle tested in the real world.
	//
	// At the moment, this value depends on which chain is active. It is set
	// to the value under the Brocoin chain as default.
	//
	// TODO(roasbeef): add command line param to modify
	MaxFundingAmount = funding.MaxBronFundingAmount
)

Functions

func AddSubLogger

func AddSubLogger(root *build.RotatingLogWriter, subsystem string,
	interceptor signal.Interceptor, useLoggers ...func(bronlog.Logger))

AddSubLogger is a helper method to conveniently create and register the logger of one or more sub systems.

func AdminAuthOptions

func AdminAuthOptions(cfg *Config, skipMacaroons bool) ([]grpc.DialOption,
	error)

AdminAuthOptions returns a list of DialOptions that can be used to authenticate with the RPC server with admin capabilities. skipMacaroons=true should be set if we don't want to include macaroons with the auth options. This is needed for instance for the WalletUnlocker service, which must be usable also before macaroons are created.

NOTE: This should only be called after the RPCListener has signaled it is ready.

func CleanAndExpandPath

func CleanAndExpandPath(path string) string

CleanAndExpandPath expands environment variables and leading ~ in the passed path, cleans the result, and returns it. This function is taken from https://github.com/brsuite/brond

func GetAllPermissions

func GetAllPermissions() []bakery.Op

GetAllPermissions returns all the permissions required to interact with broln.

func Main

func Main(cfg *Config, lisCfg ListenerCfg, implCfg *ImplementationCfg,
	interceptor signal.Interceptor) error

Main is the true entry point for broln. It accepts a fully populated and validated main configuration struct and an optional listener config struct. This function starts all main system components then blocks until a signal is received on the shutdownChan at which point everything is shut down again.

func MainRPCServerPermissions

func MainRPCServerPermissions() map[string][]bakery.Op

MainRPCServerPermissions returns a mapping of the main RPC server calls to the permissions they require.

func SetSubLogger

func SetSubLogger(root *build.RotatingLogWriter, subsystem string,
	logger bronlog.Logger, useLoggers ...func(bronlog.Logger))

SetSubLogger is a helper method to conveniently register the logger of a sub system.

func SetupLoggers

func SetupLoggers(root *build.RotatingLogWriter, interceptor signal.Interceptor)

SetupLoggers initializes all package-global logger variables.

Types

type ChainControlBuilder

type ChainControlBuilder interface {
	// BuildChainControl is responsible for creating a fully populated chain
	// control instance from a wallet.
	BuildChainControl(*chainreg.PartialChainControl,
		*bronwallet.Config) (*chainreg.ChainControl, func(), error)
}

ChainControlBuilder is an interface that must be satisfied by a custom wallet implementation.

type Config

type Config struct {
	ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`

	BrolnDir     string `long:"brolndir" description:"The base directory that contains broln's data, logs, configuration file, etc."`
	ConfigFile   string `short:"C" long:"configfile" description:"Path to configuration file"`
	DataDir      string `short:"b" long:"datadir" description:"The directory to store broln's data within"`
	SyncFreelist bool   `` /* 235-byte string literal not displayed */

	TLSCertPath        string        `long:"tlscertpath" description:"Path to write the TLS certificate for broln's RPC and REST services"`
	TLSKeyPath         string        `long:"tlskeypath" description:"Path to write the TLS private key for broln's RPC and REST services"`
	TLSExtraIPs        []string      `long:"tlsextraip" description:"Adds an extra ip to the generated certificate"`
	TLSExtraDomains    []string      `long:"tlsextradomain" description:"Adds an extra domain to the generated certificate"`
	TLSAutoRefresh     bool          `long:"tlsautorefresh" description:"Re-generate TLS certificate and key if the IPs or domains are changed"`
	TLSDisableAutofill bool          `` /* 173-byte string literal not displayed */
	TLSCertDuration    time.Duration `long:"tlscertduration" description:"The duration for which the auto-generated TLS certificate will be valid for"`

	NoMacaroons     bool          `` /* 133-byte string literal not displayed */
	AdminMacPath    string        `long:"adminmacaroonpath" description:"Path to write the admin macaroon for broln's RPC and REST services if it doesn't exist"`
	ReadMacPath     string        `` /* 132-byte string literal not displayed */
	InvoiceMacPath  string        `` /* 128-byte string literal not displayed */
	LogDir          string        `long:"logdir" description:"Directory to log output."`
	MaxLogFiles     int           `long:"maxlogfiles" description:"Maximum logfiles to keep (0 for no rotation)"`
	MaxLogFileSize  int           `long:"maxlogfilesize" description:"Maximum logfile size in MB"`
	AcceptorTimeout time.Duration `` /* 136-byte string literal not displayed */

	LetsEncryptDir    string `long:"letsencryptdir" description:"The directory to store Let's Encrypt certificates within"`
	LetsEncryptListen string `` /* 473-byte string literal not displayed */
	LetsEncryptDomain string `` /* 184-byte string literal not displayed */

	// We'll parse these 'raw' string arguments into real net.Addrs in the
	// loadConfig function. We need to expose the 'raw' strings so the
	// command line library can access them.
	// Only the parsed net.Addrs should be used!
	RawRPCListeners   []string `long:"rpclisten" description:"Add an interface/port/socket to listen for RPC connections"`
	RawRESTListeners  []string `long:"restlisten" description:"Add an interface/port/socket to listen for REST connections"`
	RawListeners      []string `long:"listen" description:"Add an interface/port to listen for peer connections"`
	RawExternalIPs    []string `` /* 200-byte string literal not displayed */
	ExternalHosts     []string `long:"externalhosts" description:"A set of hosts that should be periodically resolved to announce IPs for"`
	RPCListeners      []net.Addr
	RESTListeners     []net.Addr
	RestCORS          []string `long:"restcors" description:"Add an ip:port/hostname to allow cross origin access from. To allow all origins, set as \"*\"."`
	Listeners         []net.Addr
	ExternalIPs       []net.Addr
	DisableListen     bool          `long:"nolisten" description:"Disable listening for incoming peer connections"`
	DisableRest       bool          `long:"norest" description:"Disable REST API"`
	DisableRestTLS    bool          `long:"no-rest-tls" description:"Disable TLS for REST connections"`
	WSPingInterval    time.Duration `` /* 156-byte string literal not displayed */
	WSPongWait        time.Duration `` /* 158-byte string literal not displayed */
	NAT               bool          `` /* 210-byte string literal not displayed */
	MinBackoff        time.Duration `long:"minbackoff" description:"Shortest backoff when reconnecting to persistent peers. Valid time units are {s, m, h}."`
	MaxBackoff        time.Duration `long:"maxbackoff" description:"Longest backoff when reconnecting to persistent peers. Valid time units are {s, m, h}."`
	ConnectionTimeout time.Duration `long:"connectiontimeout" description:"The timeout value for network connections. Valid time units are {ms, s, m, h}."`

	DebugLevel string `` /* 290-byte string literal not displayed */

	CPUProfile string `long:"cpuprofile" description:"Write CPU profile to the specified file"`

	Profile string `long:"profile" description:"Enable HTTP profiling on either a port or host:port"`

	UnsafeDisconnect   bool   `` /* 166-byte string literal not displayed */
	UnsafeReplay       bool   `` /* 157-byte string literal not displayed */
	MaxPendingChannels int    `long:"maxpendingchannels" description:"The maximum number of incoming pending channels permitted per peer."`
	BackupFilePath     string `long:"backupfilepath" description:"The target location of the channel backup file"`

	FeeURL string `` /* 207-byte string literal not displayed */

	Brocoin      *lncfg.Chain    `group:"Brocoin" namespace:"brocoin"`
	BrondMode    *lncfg.Brond    `group:"brond" namespace:"brond"`
	BrocoindMode *lncfg.Brocoind `group:"brocoind" namespace:"brocoind"`
	NeutrinoMode *lncfg.Neutrino `group:"neutrino" namespace:"neutrino"`

	Litecoin      *lncfg.Chain    `group:"Litecoin" namespace:"litecoin"`
	LtcdMode      *lncfg.Brond    `group:"ltcd" namespace:"ltcd"`
	LitecoindMode *lncfg.Brocoind `group:"litecoind" namespace:"litecoind"`

	BlockCacheSize uint64 `long:"blockcachesize" description:"The maximum capacity of the block cache"`

	Autopilot *lncfg.AutoPilot `group:"Autopilot" namespace:"autopilot"`

	Tor *lncfg.Tor `group:"Tor" namespace:"tor"`

	SubRPCServers *subRPCServerConfigs `group:"subrpc"`

	Hodl *hodl.Config `group:"hodl" namespace:"hodl"`

	NoNetBootstrap bool `long:"nobootstrap" description:"If true, then automatic network bootstrapping will not be attempted."`

	NoSeedBackup             bool   `` /* 205-byte string literal not displayed */
	WalletUnlockPasswordFile string `` /* 398-byte string literal not displayed */
	WalletUnlockAllowCreate  bool   `` /* 136-byte string literal not displayed */

	ResetWalletTransactions bool `` /* 345-byte string literal not displayed */

	CoinSelectionStrategy string `` /* 142-byte string literal not displayed */

	PaymentsExpirationGracePeriod time.Duration `` /* 190-byte string literal not displayed */
	TrickleDelay                  int           `long:"trickledelay" description:"Time in milliseconds between each release of announcements to the network"`
	ChanEnableTimeout             time.Duration `` /* 214-byte string literal not displayed */
	ChanDisableTimeout            time.Duration `` /* 338-byte string literal not displayed */
	ChanStatusSampleInterval      time.Duration `` /* 168-byte string literal not displayed */
	HeightHintCacheQueryDisable   bool          `` /* 329-byte string literal not displayed */
	Alias                         string        `long:"alias" description:"The node alias. Used as a moniker by peers and intelligence services"`
	Color                         string        `` /* 139-byte string literal not displayed */
	MinChanSize                   int64         `` /* 148-byte string literal not displayed */
	MaxChanSize                   int64         `` /* 146-byte string literal not displayed */
	CoopCloseTargetConfs          uint32        `` /* 243-byte string literal not displayed */

	ChannelCommitInterval  time.Duration `` /* 262-byte string literal not displayed */
	ChannelCommitBatchSize uint32        `` /* 143-byte string literal not displayed */

	DefaultRemoteMaxHtlcs uint16 `` /* 243-byte string literal not displayed */

	NumGraphSyncPeers      int           `` /* 184-byte string literal not displayed */
	HistoricalSyncInterval time.Duration `` /* 213-byte string literal not displayed */

	IgnoreHistoricalGossipFilters bool `` /* 240-byte string literal not displayed */

	RejectPush bool `` /* 172-byte string literal not displayed */

	RejectHTLC bool `` /* 209-byte string literal not displayed */

	StaggerInitialReconnect bool `` /* 246-byte string literal not displayed */

	MaxOutgoingCltvExpiry uint32 `long:"max-cltv-expiry" description:"The maximum number of blocks funds could be locked up for when forwarding payments."`

	MaxChannelFeeAllocation float64 `` /* 224-byte string literal not displayed */

	MaxCommitFeeRateAnchors uint64 `` /* 204-byte string literal not displayed */

	DryRunMigration bool `` /* 234-byte string literal not displayed */

	EnableUpfrontShutdown bool `` /* 397-byte string literal not displayed */

	AcceptKeySend bool `long:"accept-keysend" description:"If true, spontaneous payments through keysend will be accepted. [experimental]"`

	AcceptAMP bool `long:"accept-amp" description:"If true, spontaneous payments via AMP will be accepted."`

	KeysendHoldTime time.Duration `` /* 219-byte string literal not displayed */

	GcCanceledInvoicesOnStartup bool `long:"gc-canceled-invoices-on-startup" description:"If true, we'll attempt to garbage collect canceled invoices upon start."`

	GcCanceledInvoicesOnTheFly bool `long:"gc-canceled-invoices-on-the-fly" description:"If true, we'll delete newly canceled invoices on the fly."`

	DustThreshold uint64 `` /* 129-byte string literal not displayed */

	Invoices *lncfg.Invoices `group:"invoices" namespace:"invoices"`

	Routing *lncfg.Routing `group:"routing" namespace:"routing"`

	Gossip *lncfg.Gossip `group:"gossip" namespace:"gossip"`

	Workers *lncfg.Workers `group:"workers" namespace:"workers"`

	Caches *lncfg.Caches `group:"caches" namespace:"caches"`

	Prometheus lncfg.Prometheus `group:"prometheus" namespace:"prometheus"`

	WtClient *lncfg.WtClient `group:"wtclient" namespace:"wtclient"`

	Watchtower *lncfg.Watchtower `group:"watchtower" namespace:"watchtower"`

	ProtocolOptions *lncfg.ProtocolOptions `group:"protocol" namespace:"protocol"`

	AllowCircularRoute bool `` /* 128-byte string literal not displayed */

	HealthChecks *lncfg.HealthCheckConfig `group:"healthcheck" namespace:"healthcheck"`

	DB *lncfg.DB `group:"db" namespace:"db"`

	Cluster *lncfg.Cluster `group:"cluster" namespace:"cluster"`

	RPCMiddleware *lncfg.RPCMiddleware `group:"rpcmiddleware" namespace:"rpcmiddleware"`

	RemoteSigner *lncfg.RemoteSigner `group:"remotesigner" namespace:"remotesigner"`

	// LogWriter is the root logger that all of the daemon's subloggers are
	// hooked up to.
	LogWriter *build.RotatingLogWriter

	// ActiveNetParams contains parameters of the target chain.
	ActiveNetParams chainreg.BrocoinNetParams
	// contains filtered or unexported fields
}

Config defines the configuration options for broln.

See LoadConfig for further details regarding the configuration loading+parsing process.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns all default values for the Config struct.

func LoadConfig

func LoadConfig(interceptor signal.Interceptor) (*Config, error)

LoadConfig initializes and parses the config using a config file and command line options.

The configuration proceeds as follows:

  1. Start with a default config with sane settings
  2. Pre-parse the command line to check for an alternative config file
  3. Load configuration file overwriting defaults with any specified options
  4. Parse CLI options and overwrite/add any specified options

func ValidateConfig

func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
	flagParser *flags.Parser) (*Config, error)

ValidateConfig check the given configuration to be sane. This makes sure no illegal values or combination of values are set. All file system paths are normalized. The cleaned up config is returned on success.

func (*Config) ImplementationConfig

func (c *Config) ImplementationConfig(
	interceptor signal.Interceptor) *ImplementationCfg

ImplementationConfig returns the configuration of what actual implementations should be used when creating the main broln instance.

type CustomMessage

type CustomMessage struct {
	// Peer is the peer pubkey
	Peer [33]byte

	// Msg is the custom wire message.
	Msg *lnwire.Custom
}

CustomMessage is a custom message that is received from a peer.

type DatabaseBuilder

type DatabaseBuilder interface {
	// BuildDatabase extracts the current databases that we'll use for
	// normal operation in the daemon. A function closure that closes all
	// opened databases is also returned.
	BuildDatabase(ctx context.Context) (*DatabaseInstances, func(), error)
}

DatabaseBuilder is an interface that must be satisfied by the implementation that provides broln's main database backend instances.

type DatabaseInstances

type DatabaseInstances struct {
	// GraphDB is the database that stores the channel graph used for path
	// finding.
	//
	// NOTE/TODO: This currently _needs_ to be the same instance as the
	// ChanStateDB below until the separation of the two databases is fully
	// complete!
	GraphDB *channeldb.DB

	// ChanStateDB is the database that stores all of our node's channel
	// state.
	//
	// NOTE/TODO: This currently _needs_ to be the same instance as the
	// GraphDB above until the separation of the two databases is fully
	// complete!
	ChanStateDB *channeldb.DB

	// HeightHintDB is the database that stores height hints for spends.
	HeightHintDB kvdb.Backend

	// MacaroonDB is the database that stores macaroon root keys.
	MacaroonDB kvdb.Backend

	// DecayedLogDB is the database that stores p2p related encryption
	// information.
	DecayedLogDB kvdb.Backend

	// TowerClientDB is the database that stores the watchtower client's
	// configuration.
	TowerClientDB wtclient.DB

	// TowerServerDB is the database that stores the watchtower server's
	// configuration.
	TowerServerDB watchtower.DB

	// WalletDB is the configuration for loading the wallet database using
	// the bronwallet's loader.
	WalletDB bronwallet.LoaderOption
}

DatabaseInstances is a struct that holds all instances to the actual databases that are used in broln.

type DefaultDatabaseBuilder

type DefaultDatabaseBuilder struct {
	// contains filtered or unexported fields
}

DefaultDatabaseBuilder is a type that builds the default database backends for broln, using the given configuration to decide what actual implementation to use.

func NewDefaultDatabaseBuilder

func NewDefaultDatabaseBuilder(cfg *Config,
	logger bronlog.Logger) *DefaultDatabaseBuilder

NewDefaultDatabaseBuilder returns a new instance of the default database builder.

func (*DefaultDatabaseBuilder) BuildDatabase

func (d *DefaultDatabaseBuilder) BuildDatabase(
	ctx context.Context) (*DatabaseInstances, func(), error)

BuildDatabase extracts the current databases that we'll use for normal operation in the daemon. A function closure that closes all opened databases is also returned.

type DefaultWalletImpl

type DefaultWalletImpl struct {
	// contains filtered or unexported fields
}

DefaultWalletImpl is the default implementation of our normal, bronwallet backed configuration.

func NewDefaultWalletImpl

func NewDefaultWalletImpl(cfg *Config, logger bronlog.Logger,
	interceptor signal.Interceptor, watchOnly bool) *DefaultWalletImpl

NewDefaultWalletImpl creates a new default wallet implementation.

func (*DefaultWalletImpl) BuildChainControl

func (d *DefaultWalletImpl) BuildChainControl(
	partialChainControl *chainreg.PartialChainControl,
	walletConfig *bronwallet.Config) (*chainreg.ChainControl, func(), error)

BuildChainControl is responsible for creating a fully populated chain control instance from a wallet.

NOTE: This is part of the ChainControlBuilder interface.

func (*DefaultWalletImpl) BuildWalletConfig

func (d *DefaultWalletImpl) BuildWalletConfig(ctx context.Context,
	dbs *DatabaseInstances, interceptorChain *rpcperms.InterceptorChain,
	grpcListeners []*ListenerWithSignal) (*chainreg.PartialChainControl,
	*bronwallet.Config, func(), error)

BuildWalletConfig is responsible for creating or unlocking and then fully initializing a wallet.

NOTE: This is part of the WalletConfigBuilder interface.

func (*DefaultWalletImpl) Permissions

func (d *DefaultWalletImpl) Permissions() map[string][]bakery.Op

Permissions returns the permissions that the external validator is validating. It is a map between the full HTTP URI of each RPC and its required macaroon permissions. If multiple action/entity tuples are specified per URI, they are all required. See rpcserver.go for a list of valid action and entity values.

NOTE: This is part of the ExternalValidator interface.

func (*DefaultWalletImpl) RegisterGrpcSubserver

func (d *DefaultWalletImpl) RegisterGrpcSubserver(s *grpc.Server) error

RegisterGrpcSubserver is called for each net.Listener on which broln creates a grpc.Server instance. External subservers implementing this method can then register their own gRPC server structs to the main server instance.

NOTE: This is part of the GrpcRegistrar interface.

func (*DefaultWalletImpl) RegisterRestSubserver

func (d *DefaultWalletImpl) RegisterRestSubserver(ctx context.Context,
	mux *proxy.ServeMux, restProxyDest string,
	restDialOpts []grpc.DialOption) error

RegisterRestSubserver is called after broln creates the main proxy.ServeMux instance. External subservers implementing this method can then register their own REST proxy stubs to the main server instance.

NOTE: This is part of the GrpcRegistrar interface.

func (*DefaultWalletImpl) ValidateMacaroon

func (d *DefaultWalletImpl) 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 ExternalValidator interface.

type ExternalValidator

type ExternalValidator interface {
	macaroons.MacaroonValidator

	// Permissions returns the permissions that the external validator is
	// validating. It is a map between the full HTTP URI of each RPC and its
	// required macaroon permissions. If multiple action/entity tuples are
	// specified per URI, they are all required. See rpcserver.go for a list
	// of valid action and entity values.
	Permissions() map[string][]bakery.Op
}

ExternalValidator is an interface that must be satisfied by an external macaroon validator.

type GrpcRegistrar

type GrpcRegistrar interface {
	// RegisterGrpcSubserver is called for each net.Listener on which broln
	// creates a grpc.Server instance. External subservers implementing this
	// method can then register their own gRPC server structs to the main
	// server instance.
	RegisterGrpcSubserver(*grpc.Server) error
}

GrpcRegistrar is an interface that must be satisfied by an external subserver that wants to be able to register its own gRPC server onto broln's main grpc.Server instance.

type ImplementationCfg

type ImplementationCfg struct {
	// GrpcRegistrar is a type that can register additional gRPC subservers
	// before the main gRPC server is started.
	GrpcRegistrar

	// RestRegistrar is a type that can register additional REST subservers
	// before the main REST proxy is started.
	RestRegistrar

	// ExternalValidator is a type that can provide external macaroon
	// validation.
	ExternalValidator

	// DatabaseBuilder is a type that can provide broln's main database
	// backend instances.
	DatabaseBuilder

	// WalletConfigBuilder is a type that can provide a wallet configuration
	// with a fully loaded and unlocked wallet.
	WalletConfigBuilder

	// ChainControlBuilder is a type that can provide a custom wallet
	// implementation.
	ChainControlBuilder
}

ImplementationCfg is a struct that holds all configuration items for components that can be implemented outside broln itself.

type ListenerCfg

type ListenerCfg struct {
	// RPCListeners can be set to the listeners to use for the RPC server.
	// If empty a regular network listener will be created.
	RPCListeners []*ListenerWithSignal
}

ListenerCfg is a wrapper around custom listeners that can be passed to broln when calling its main method.

type ListenerWithSignal

type ListenerWithSignal struct {
	net.Listener

	// Ready will be closed by the server listening on Listener.
	Ready chan struct{}

	// MacChan is an optional way to pass the admin macaroon to the program
	// that started broln. The channel should be buffered to avoid broln being
	// blocked on sending to the channel.
	MacChan chan []byte
}

ListenerWithSignal is a net.Listener that has an additional Ready channel that will be closed when a server starts listening.

type RPCSignerWalletImpl

type RPCSignerWalletImpl struct {
	// DefaultWalletImpl is the embedded instance of the default
	// implementation that the remote signer uses as its watch-only wallet
	// for keeping track of addresses and UTXOs.
	*DefaultWalletImpl
}

RPCSignerWalletImpl is a wallet implementation that uses a remote signer over an RPC interface.

func NewRPCSignerWalletImpl

func NewRPCSignerWalletImpl(cfg *Config, logger bronlog.Logger,
	interceptor signal.Interceptor,
	migrateWatchOnly bool) *RPCSignerWalletImpl

NewRPCSignerWalletImpl creates a new instance of the remote signing wallet implementation.

func (*RPCSignerWalletImpl) BuildChainControl

func (d *RPCSignerWalletImpl) BuildChainControl(
	partialChainControl *chainreg.PartialChainControl,
	walletConfig *bronwallet.Config) (*chainreg.ChainControl, func(), error)

BuildChainControl is responsible for creating or unlocking and then fully initializing a wallet and returning it as part of a fully populated chain control instance.

NOTE: This is part of the ChainControlBuilder interface.

type RestRegistrar

type RestRegistrar interface {
	// RegisterRestSubserver is called after broln creates the main
	// proxy.ServeMux instance. External subservers implementing this method
	// can then register their own REST proxy stubs to the main server
	// instance.
	RegisterRestSubserver(context.Context, *proxy.ServeMux, string,
		[]grpc.DialOption) error
}

RestRegistrar is an interface that must be satisfied by an external subserver that wants to be able to register its own REST mux onto broln's main proxy.ServeMux instance.

type WalletConfigBuilder

type WalletConfigBuilder interface {
	// BuildWalletConfig is responsible for creating or unlocking and then
	// fully initializing a wallet.
	BuildWalletConfig(context.Context, *DatabaseInstances,
		*rpcperms.InterceptorChain,
		[]*ListenerWithSignal) (*chainreg.PartialChainControl,
		*bronwallet.Config, func(), error)
}

WalletConfigBuilder is an interface that must be satisfied by a custom wallet implementation.

Directories

Path Synopsis
cert module
Package chanfitness monitors the behaviour of channels to provide insight into the health and performance of a channel.
Package chanfitness monitors the behaviour of channels to provide insight into the health and performance of a channel.
clock module
cmd
healthcheck module
hop
kvdb module
Package labels contains labels used to label transactions broadcast by broln.
Package labels contains labels used to label transactions broadcast by broln.
Package lnrpc is a reverse proxy.
Package lnrpc is a reverse proxy.
autopilotrpc
Package autopilotrpc is a reverse proxy.
Package autopilotrpc is a reverse proxy.
chainrpc
Package chainrpc is a reverse proxy.
Package chainrpc is a reverse proxy.
invoicesrpc
Package invoicesrpc is a reverse proxy.
Package invoicesrpc is a reverse proxy.
routerrpc
Package routerrpc is a reverse proxy.
Package routerrpc is a reverse proxy.
signrpc
Package signrpc is a reverse proxy.
Package signrpc is a reverse proxy.
verrpc
Package verrpc is a reverse proxy.
Package verrpc is a reverse proxy.
walletrpc
Package walletrpc is a reverse proxy.
Package walletrpc is a reverse proxy.
watchtowerrpc
Package watchtowerrpc is a reverse proxy.
Package watchtowerrpc is a reverse proxy.
wtclientrpc
Package wtclientrpc is a reverse proxy.
Package wtclientrpc is a reverse proxy.
Package lntest provides testing utilities for the broln repository.
Package lntest provides testing utilities for the broln repository.
queue module
ticker module

Jump to

Keyboard shortcuts

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