settings

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: ISC Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIServerConfig added in v0.2.0

type APIServerConfig struct {
	Host                 string `yaml:"host"`
	Port                 string `yaml:"port"`
	EnableHealthEndpoint bool   `yaml:"enable_health_endpoint"`
	EnableMetrics        bool   `yaml:"enable_metrics"`
	EnablePProf          bool   `yaml:"enable_pprof"`
}

type BitcoinParams added in v0.2.0

type BitcoinParams struct {
	RPCConfig `yaml:",inline"`
	Params    string `yaml:"params"`
}

type Configuration

type Configuration struct {
	Settings

	Shards map[common.ShardID]ShardConfig

	BtcMiningAddress jaxutil.Address
	JaxMiningAddress jaxutil.Address
}

func (*Configuration) BitcoinRPCConf added in v0.2.0

func (s *Configuration) BitcoinRPCConf() (conf *btcdrpcclient.ConnConfig)

BitcoinRPCConf returns RPC connection parameters of the bitcoin node (in a format that is appropriate for the RPC-client).

func (*Configuration) JaxRPCConf added in v0.2.0

func (s *Configuration) JaxRPCConf() (conf *rpcclient.ConnConfig)

JaxRPCConf returns RPC connection parameters of the beacon chain (in a format that is appropriate for the RPC-client).

func (*Configuration) TotalNetworkShardsCount

func (s *Configuration) TotalNetworkShardsCount() uint32

TotalNetworkShardsCount returns the total amount of shards in the network (according to the config). The total amount of shards that are listed in config file could differ from the total amount of shards that are present in the network, e.g. miner could mine shards 100, and 200 and the total amount of shards mined == 2, but the total amount of shards in the network, according to this config is 200.

type Network added in v0.2.0

type Network struct {
	Name string `yaml:"name"`

	Beacon struct {
		SetExpansionFlagInBeaconHeader bool `yaml:"set_expansion_flag_in_beacon_header"`
		Discovering                    struct {
			RPC RPCConfig `yaml:"rpc"`
		} `yaml:"discovering"`
	} `yaml:"beacon"`

	Shards struct {
		Discovering struct {
			Dynamic struct {
				Mode      string `yaml:"mode"`
				RoundTime string `yaml:"round-time"`
			} `yaml:"dynamic"`

			Static struct {
				Credentials []ShardConfig `yaml:"credentials"`
				Forbidden   string        `yaml:"forbidden"`
			} `yaml:"static"`
		} `yaml:"discovering"`
	} `yaml:"shards"`

	Bitcoin BitcoinParams `yaml:"bitcoin"`
}

type NetworkConfig

type NetworkConfig struct {
	Host       string `yaml:"host"`
	Port       uint16 `yaml:"port"`
	DisableTLS bool   `yaml:"disableTLS"`
}

func (*NetworkConfig) Interface

func (nc *NetworkConfig) Interface() string

type NetworkConfigBitcoin added in v0.2.0

type NetworkConfigBitcoin struct {
	Host       string `yaml:"host"`
	Port       uint16 `yaml:"port"`
	DisableTLS bool   `yaml:"disableTLS"`
}

func (*NetworkConfigBitcoin) Interface added in v0.2.0

func (nc *NetworkConfigBitcoin) Interface() string

type Observer

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

func NewObserver

func NewObserver() (observer *Observer, err error)

func (*Observer) ConfigurationsFlow

func (o *Observer) ConfigurationsFlow() (flow <-chan *Configuration)

func (*Observer) ObserveConfigurationChanges

func (o *Observer) ObserveConfigurationChanges()

func (*Observer) Settings added in v0.2.0

func (o *Observer) Settings() *Settings

type RPCConfig

type RPCConfig struct {
	User         string            `yaml:"user"`
	Pass         string            `yaml:"pass"`
	Network      NetworkConfig     `yaml:"network"`
	ExtraHeaders map[string]string `yaml:"extra_headers"`
}

type Redis added in v0.2.0

type Redis struct {
	Enabled bool   `yaml:"enabled"`
	Host    string `yaml:"host"`
	Port    string `yaml:"port"`
	DB      int    `yaml:"db"`
}

type Settings

type Settings struct {
	Log logger.LogParams `yaml:"log"`

	NumCPU                int    `yaml:"num_cpu"`
	EnablePprof           bool   `yaml:"enable_pprof"`
	EnableBTCMining       bool   `yaml:"enable_btc_mining"`
	EnableBCHMode         bool   `yaml:"enable_bch_mode"`
	EnableHashSorting     bool   `yaml:"-"`
	HashSortingSlotNumber uint32 `yaml:"-"`
	ChainIDCount          uint32 `yaml:"chain_id_count"`

	BurnBtcReward    bool   `yaml:"burn_btc"`
	BtcMiningAddress string `yaml:"btc_mining_address"`
	JaxMiningAddress string `yaml:"jax_mining_address"`

	Network Network `yaml:"network"`
	Stratum Stratum `yaml:"stratum"`
	Redis   Redis   `yaml:"redis"`
}

type ShardConfig

type ShardConfig struct {
	ID  common.ShardID `yaml:"id"`
	RPC RPCConfig      `yaml:"rpc"`
}

type Stratum added in v0.2.0

type Stratum struct {
	Banning               StratumBanning  `yaml:"banning"`
	JobRebroadcastTimeout int             `yaml:"job_rebroadcast_timeout"`
	TcpProxyProtocol      bool            `yaml:"tcp_proxy_protocol"`
	ConnectionTimeout     int             `yaml:"connection_timeout"`
	Ports                 StratumListener `yaml:"ports"`
	APIServer             APIServerConfig `yaml:"api"`
	UpdateBlockToken      string          `yaml:"update_block_token"`
}

type StratumBanning added in v0.2.0

type StratumBanning struct {
	Enabled        bool    `yaml:"enabled"`
	Time           int     `yaml:"time"`
	InvalidPercent float64 `yaml:"invalid_percent"`
	CheckThreshold uint64  `yaml:"check_threshold"`
	PurgeInterval  int     `yaml:"purge_interval"`
}

type StratumListener added in v0.2.0

type StratumListener struct {
	Port    string `yaml:"port"`
	VarDiff struct {
		StartDiff                          float64 `yaml:"start_diff"`
		MinDiff                            float64 `yaml:"min_diff"`
		MaxDiff                            float64 `yaml:"max_diff"`
		TargetSharesPerTimeWindow          uint32  `yaml:"target_shares_per_time_window"`
		TargetSharesPerTimeWindowThreshold uint32  `yaml:"target_shares_per_time_window_threshold"`
		TimeWindow                         int64   `yaml:"time_window"`
		RetargetTimeWindow                 int64   `yaml:"retarget_time_window"`
		JobPriority                        bool    `yaml:"job_priority"`
		Enabled                            bool    `yaml:"enabled"`
	} `yaml:"var_diff"`
	TLS bool `yaml:"tls"`
}

Jump to

Keyboard shortcuts

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