config

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCheckpointCacheMaxEntries = 100
	DefaultPollingIntervalSeconds    = 60   // in seconds
	DefaultResendIntervalSeconds     = 1800 // 30 minutes
)
View Source
const (
	// DefaultGRPCAddress defines the default address to bind the gRPC server to.
	DefaultGRPCAddress = "0.0.0.0:8080"
)
View Source
const (
	// DefaultGRPCWebAddress defines the default address to bind the gRPC-web server to.
	DefaultGRPCWebAddress = "0.0.0.0:8081"
)

Variables

This section is empty.

Functions

func DefaultConfigFile

func DefaultConfigFile() string

func WriteSample

func WriteSample() error

Types

type BTCConfig

type BTCConfig struct {
	DisableClientTLS  bool                      `mapstructure:"no-client-tls"`
	CAFile            string                    `mapstructure:"ca-file"`
	Endpoint          string                    `mapstructure:"endpoint"`
	WalletEndpoint    string                    `mapstructure:"wallet-endpoint"`
	WalletPassword    string                    `mapstructure:"wallet-password"`
	WalletName        string                    `mapstructure:"wallet-name"`
	WalletCAFile      string                    `mapstructure:"wallet-ca-file"`
	WalletLockTime    int64                     `mapstructure:"wallet-lock-time"` // time duration in which the wallet remains unlocked, in seconds
	TxFeeMin          btcutil.Amount            `mapstructure:"tx-fee-min"`       // minimum tx fee, in BTC
	TxFeeMax          btcutil.Amount            `mapstructure:"tx-fee-max"`       // maximum tx fee, in BTC
	TargetBlockNum    int64                     `mapstructure:"target-block-num"` // this implies how soon the tx is estimated to be included in a block, e.g., 1 means the tx is estimated to be included in the next block
	NetParams         string                    `mapstructure:"net-params"`
	Username          string                    `mapstructure:"username"`
	Password          string                    `mapstructure:"password"`
	ReconnectAttempts int                       `mapstructure:"reconnect-attempts"`
	BtcBackend        types.SupportedBtcBackend `mapstructure:"btc-backend"`
	ZmqEndpoint       string                    `mapstructure:"zmq-endpoint"`
}

BTCConfig defines configuration for the Bitcoin client

func DefaultBTCConfig

func DefaultBTCConfig() BTCConfig

func (*BTCConfig) Validate

func (cfg *BTCConfig) Validate() error

type CommonConfig

type CommonConfig struct {
	// Backoff interval for the first retry.
	RetrySleepTime time.Duration `mapstructure:"retry-sleep-time"`

	// Maximum backoff interval between retries. Exponential backoff leads to interval increase.
	// This value is the cap of the interval, when exceeded the retries stop.
	MaxRetrySleepTime time.Duration `mapstructure:"max-retry-sleep-time"`
}

CommonConfig defines the server's basic configuration

func DefaultCommonConfig

func DefaultCommonConfig() CommonConfig

func (*CommonConfig) Validate

func (cfg *CommonConfig) Validate() error

type Config

type Config struct {
	Common    CommonConfig         `mapstructure:"common"`
	BTC       BTCConfig            `mapstructure:"btc"`
	Babylon   bbncfg.BabylonConfig `mapstructure:"babylon"`
	GRPC      GRPCConfig           `mapstructure:"grpc"`
	GRPCWeb   GRPCWebConfig        `mapstructure:"grpc-web"`
	Submitter SubmitterConfig      `mapstructure:"submitter"`
	Reporter  ReporterConfig       `mapstructure:"reporter"`
	Monitor   MonitorConfig        `mapstructure:"monitor"`
}

Config defines the server's top level configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns server's default configuration.

func New

func New(configFile string) (Config, error)

New returns a fully parsed Config object from a given file directory

func (*Config) Validate

func (cfg *Config) Validate() error

type GRPCConfig

type GRPCConfig struct {
	OneTimeTLSKey bool     `mapstructure:"onetime-tls-key"`
	RPCKeyFile    string   `mapstructure:"rpc-key"`
	RPCCertFile   string   `mapstructure:"rpc-cert"`
	Endpoints     []string `mapstructure:"endpoints"`
}

GRPCConfig defines configuration for the gRPC server.

func DefaultGRPCConfig

func DefaultGRPCConfig() GRPCConfig

func (*GRPCConfig) Validate

func (cfg *GRPCConfig) Validate() error

type GRPCWebConfig

type GRPCWebConfig struct {
	Placeholder string `mapstructure:"placeholder"`
}

GRPCWebConfig defines configuration for the gRPC-web server.

func DefaultGRPCWebConfig

func DefaultGRPCWebConfig() GRPCWebConfig

func (*GRPCWebConfig) Validate

func (cfg *GRPCWebConfig) Validate() error

type MonitorConfig added in v0.5.0

type MonitorConfig struct {
	// Max number of checkpoints in the buffer
	CheckpointBufferSize uint64 `mapstructure:"checkpoint-buffer-size"`
	// Max number of BTC blocks in the buffer
	BtcBlockBufferSize uint64 `mapstructure:"btc-block-buffer-size"`
	// Max number of BTC blocks in the cache
	BtcCacheSize uint64 `mapstructure:"btc-cache-size"`
	// Intervals between each liveness check in seconds
	LivenessCheckIntervalSeconds uint64 `mapstructure:"liveness-check-interval-seconds"`
	// Max lasting BTC heights that a checkpoint is not reported before an alarm is sent
	MaxLiveBtcHeights uint64 `mapstructure:"max-live-btc-heights"`
	// the confirmation depth to consider a BTC block as confirmed
	BtcConfirmationDepth uint64 `mapstructure:"btc-confirmation-depth"`
	// whether to enable liveness checker
	LivenessChecker bool `mapstructure:"liveness-checker"`
}

MonitorConfig defines the Monitor's basic configuration

func DefaultMonitorConfig added in v0.5.0

func DefaultMonitorConfig() MonitorConfig

func (*MonitorConfig) Validate added in v0.5.0

func (cfg *MonitorConfig) Validate() error

type ReporterConfig

type ReporterConfig struct {
	NetParams string `mapstructure:"netparams"` // should be mainnet|testnet|simnet|signet
}

ReporterConfig defines configuration for the reporter.

func DefaultReporterConfig

func DefaultReporterConfig() ReporterConfig

func (*ReporterConfig) Validate

func (cfg *ReporterConfig) Validate() error

type SubmitterConfig

type SubmitterConfig struct {
	NetParams              string `mapstructure:"netparams"`   // should be mainnet|testnet|simnet|signet
	BufferSize             uint   `mapstructure:"buffer-size"` // buffer for raw checkpoints
	PollingIntervalSeconds uint   `mapstructure:"polling-interval-seconds"`
	ResendIntervalSeconds  uint   `mapstructure:"resend-interval-seconds"`
}

SubmitterConfig defines configuration for the gRPC-web server.

func DefaultSubmitterConfig

func DefaultSubmitterConfig() SubmitterConfig

func (*SubmitterConfig) GetTag

func (cfg *SubmitterConfig) GetTag(tagIdx uint8) btctxformatter.BabylonTag

func (*SubmitterConfig) GetVersion

func (cfg *SubmitterConfig) GetVersion() btctxformatter.FormatVersion

func (*SubmitterConfig) Validate

func (cfg *SubmitterConfig) Validate() error

Jump to

Keyboard shortcuts

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