config

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0, MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(cfg *MinerConfig) error

func ConfigComment

func ConfigComment(t interface{}) ([]byte, error)

func FromFile

func FromFile(path string, def interface{}) (interface{}, error)

FromFile loads config from a specified file overriding defaults specified in the def parameter. If file does not exist or is empty defaults are assumed.

func FromReader

func FromReader(reader io.Reader, def interface{}) (interface{}, error)

FromReader loads config from a reader instance.

Types

type API

type API struct {
	ListenAddress string
}

type APIInfo

type APIInfo struct {
	Addr  string
	Token string
}

func (APIInfo) AuthHeader

func (a APIInfo) AuthHeader() http.Header

func (APIInfo) DialArgs

func (a APIInfo) DialArgs(version string) (string, error)

func (APIInfo) Host

func (a APIInfo) Host() (string, error)

type Duration

type Duration time.Duration

Duration is a wrapper type for Duration for decoding and encoding from/to TOML

func (Duration) MarshalText

func (dur Duration) MarshalText() ([]byte, error)

func (*Duration) UnmarshalText

func (dur *Duration) UnmarshalText(text []byte) error

UnmarshalText implements interface for TOML decoding

type GatewayNode

type GatewayNode struct {
	ListenAPI []string
	Token     string
}

func (*GatewayNode) AuthHeader

func (gw *GatewayNode) AuthHeader() http.Header

func (*GatewayNode) DialArgs

func (gw *GatewayNode) DialArgs() ([]string, error)

type MinerConfig

type MinerConfig struct {
	API         API
	FullNode    *APIInfo
	Gateway     *GatewayNode
	Auth        *APIInfo
	SubmitNodes []*APIInfo

	PropagationDelaySecs uint64
	MpoolSelectDelaySecs uint64
	MinerOnceTimeout     Duration

	SlashFilter *SlashFilterConfig
	Recorder    *RecorderConfig

	Tracing *metrics.TraceConfig
	Metrics *metrics.MetricsConfig
}

func DefaultMinerConfig

func DefaultMinerConfig() *MinerConfig

type MySQLConfig

type MySQLConfig struct {
	Conn            string
	MaxOpenConn     int      // 100
	MaxIdleConn     int      // 10
	ConnMaxLifeTime Duration // 60s
	Debug           bool
}

type RecorderConfig added in v1.13.0

type RecorderConfig struct {
	Enable            bool
	ExpireEpoch       uint64
	MaxRecordPerQuery uint
}

type SlashFilterConfig

type SlashFilterConfig struct {
	Type  string
	MySQL MySQLConfig
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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