tapcfg

package
v0.3.0-alpha.rc3 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 45 Imported by: 2

Documentation

Index

Constants

View Source
const (

	// DatabaseBackendSqlite is the name of the SQLite database backend.
	DatabaseBackendSqlite = "sqlite"

	// DatabaseBackendPostgres is the name of the Postgres database backend.
	DatabaseBackendPostgres = "postgres"
)

Variables

View Source
var (
	// DefaultTapdDir is the default directory where tapd 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\Tapd on Windows
	//   ~/.tapd on Linux
	//   ~/Library/Application Support/Tapd on MacOS
	DefaultTapdDir = btcutil.AppDataDir("tapd", false)

	// DefaultConfigFile is the default full path of tapd's configuration
	// file.
	DefaultConfigFile = filepath.Join(DefaultTapdDir, defaultConfigFileName)
)

Functions

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/btcsuite/btcd

func CreateServerFromConfig

func CreateServerFromConfig(cfg *Config, cfgLogger btclog.Logger,
	shutdownInterceptor signal.Interceptor,
	mainErrChan chan<- error) (*tap.Server, error)

CreateServerFromConfig creates a new Taproot Asset server from the given CLI config.

func CreateSubServerFromConfig

func CreateSubServerFromConfig(cfg *Config, cfgLogger btclog.Logger,
	lndServices *lndclient.LndServices,
	mainErrChan chan<- error) (*tap.Server, error)

CreateSubServerFromConfig creates a new Taproot Asset server from the given CLI config.

Types

type ChainConfig

type ChainConfig struct {
	Network string `` /* 129-byte string literal not displayed */

	SigNetChallenge string `` /* 188-byte string literal not displayed */
}

ChainConfig houses the configuration options that govern which chain/network we operate on.

type Config

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

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

	TapdDir    string `long:"tapddir" description:"The base directory that contains tapd's data, logs, configuration file, etc."`
	ConfigFile string `long:"configfile" description:"Path to configuration file"`

	DataDir        string `long:"datadir" description:"The directory to store tapd's data within"`
	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"`

	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"`

	BatchMintingInterval time.Duration `` /* 149-byte string literal not displayed */

	ReOrgSafeDepth int32 `` /* 139-byte string literal not displayed */

	// The following options are used to configure the proof courier.
	DefaultProofCourierAddr string                    `long:"proofcourieraddr" description:"Default proof courier service address."`
	HashMailCourier         *proof.HashMailCourierCfg `group:"proofcourier" namespace:"hashmailcourier"`

	ChainConf *ChainConfig
	RpcConf   *RpcConfig

	Lnd *LndConfig `group:"lnd" namespace:"lnd"`

	DatabaseBackend string                `` /* 134-byte string literal not displayed */
	Sqlite          *tapdb.SqliteConfig   `group:"sqlite" namespace:"sqlite"`
	Postgres        *tapdb.PostgresConfig `group:"postgres" namespace:"postgres"`

	Universe *UniverseConfig `group:"universe" namespace:"universe"`

	Prometheus monitoring.PrometheusConfig `group:"prometheus" namespace:"prometheus"`

	// 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 chaincfg.Params
	// contains filtered or unexported fields
}

Config is the main config for the tapd cli command.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns all default values for the Config struct.

func LoadConfig

func LoadConfig(interceptor signal.Interceptor) (*Config, btclog.Logger, 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, cfgLogger btclog.Logger) (*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.

type LndConfig

type LndConfig struct {
	Host string `long:"host" description:"lnd instance rpc address"`

	// MacaroonDir is the directory that contains all the macaroon files
	// required for the remote connection.
	MacaroonDir string `long:"macaroondir" description:"DEPRECATED: Use macaroonpath."`

	// MacaroonPath is the path to the single macaroon that should be used
	// instead of needing to specify the macaroon directory that contains
	// all of lnd's macaroons. The specified macaroon MUST have all
	// permissions that all the subservers use, otherwise permission errors
	// will occur.
	MacaroonPath string `` /* 304-byte string literal not displayed */

	TLSPath string `long:"tlspath" description:"Path to lnd tls certificate"`
}

LndConfig is the main config we'll use to connect to the lnd node that backs up tapd.

type RpcConfig

type RpcConfig struct {
	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"`

	TLSCertPath        string        `long:"tlscertpath" description:"Path to write the TLS certificate for tapd's RPC and REST services"`
	TLSKeyPath         string        `long:"tlskeypath" description:"Path to write the TLS private key for tapd'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"`

	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 */

	MacaroonPath string `long:"macaroonpath" description:"Path to write the admin macaroon for tapd's RPC and REST services if it doesn't exist"`
	NoMacaroons  bool   `` /* 133-byte string literal not displayed */

	AllowPublicUniProofCourier bool `long:"allow-public-uni-proof-courier" description:"Disable macaroon authentication for universe proof courier RPC endpoints."`
	AllowPublicStats           bool `long:"allow-public-stats" description:"Disable macaroon authentication for stats RPC endpoints."`

	RestCORS []string `long:"restcors" description:"Add an ip:port/hostname to allow cross origin access from. To allow all origins, set as \"*\"."`

	LetsEncryptDir    string `long:"letsencryptdir" description:"The directory to store Let's Encrypt certificates within"`
	LetsEncryptListen string `` /* 471-byte string literal not displayed */
	LetsEncryptDomain string `` /* 186-byte string literal not displayed */
	LetsEncryptEmail  string `long:"letsencryptemail" description:"The email address to use for Let's Encrypt account registration."`
}

RpcConfig houses the set of config options that affect how clients connect to the main RPC server.

type UniverseConfig

type UniverseConfig struct {
	SyncInterval time.Duration `long:"syncinterval" description:"Amount of time to wait between universe syncs"`

	FederationServers []string `` /* 186-byte string literal not displayed */

	PublicAccess bool `` /* 259-byte string literal not displayed */
}

UniverseConfig is the config that houses any Universe related config values.

Jump to

Keyboard shortcuts

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