Documentation ¶
Index ¶
- Variables
- func CleanAndExpandPath(path string) string
- func GetAccounts(acctList string) (map[[3]uint32]string, error)
- func ListenOnAddress(addr net.Addr) (net.Listener, error)
- func Main(cfg *Config, lisCfg ListenerCfg) error
- func NormalizeAddresses(addrs []string, defaultPort string) ([]net.Addr, error)
- func ParseAddressString(strAddress string, defaultPort string) (net.Addr, error)
- type Config
- type ListenerCfg
- type ListenerWithSignal
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultSignerDir is the default directory where lndsignerd 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\Lndsigner on Windows // ~/.lndsigner on Linux // ~/Library/Application Support/Lndsigner on MacOS DefaultSignerDir = btcutil.AppDataDir("lndsigner", false) // DefaultConfigFile is the default full path of lndsignerd's // configuration file. DefaultConfigFile = filepath.Join(DefaultSignerDir, defaultConfigFilename) )
Functions ¶
func CleanAndExpandPath ¶
CleanAndExpandPath expands environment variables and leading ~ in the passed path, cleans the result, and returns it. This function is taken from https://github.com/btcsuite/btcd
func GetAccounts ¶
GetAccounts is currently used in integration testing, but will soon also be used in policy enforcement. For current status, see the branch at https://github.com/aakselrod/lndsigner/tree/offchain-ratelimiting
func ListenOnAddress ¶
ListenOnAddress creates a listener that listens on the given address.
func Main ¶
func Main(cfg *Config, lisCfg ListenerCfg) error
Main is the true entry point for lnd. 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 NormalizeAddresses ¶
NormalizeAddresses returns a new slice with all the passed addresses normalized with the given default port and all duplicates removed.
Types ¶
type Config ¶
type Config struct { SignerDir string `long:"signerdir" description:"The base directory that contains signer's data, logs, configuration file, etc."` ConfigFile string `short:"C" long:"configfile" description:"Path to configuration file"` TLSCertPath string `long:"tlscertpath" description:"Path to write the TLS certificate for lndsignerd's RPC services"` TLSKeyPath string `long:"tlskeypath" description:"Path to write the TLS private key for lndsignerd's RPC services"` // 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"` RPCListeners []net.Addr Network string `` /* 134-byte string literal not displayed */ // ActiveNetParams contains parameters of the target chain. ActiveNetParams chaincfg.Params // Node contains the node ID as a 66-character hex string. NodePubKey string `long:"nodepubkey" description:"Node pubkey hex"` }
Config defines the configuration options for lndsignerd.
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 ¶
LoadConfig initializes and parses the config using a config file and command line options.
The configuration proceeds as follows:
- Start with a default config with sane settings
- Pre-parse the command line to check for an alternative config file
- Load configuration file overwriting defaults with any specified options
- Parse CLI options and overwrite/add any specified options
func ValidateConfig ¶
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.
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 lnd 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{} }
ListenerWithSignal is a net.Listener that has an additional Ready channel that will be closed when a server starts listening.