config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: Apache-2.0 Imports: 28 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// config file prefix
	ConfigPrefix = "justitia"
	// node type
	NodeType = "general.nodeType"
	// algorithm setting
	HashAlgorithm = "general.hashAlgorithm"
	// txpool setting
	TxpoolSlots    = "general.txpool.globalSlots"
	MaxTxBlock     = "general.txpool.txsPerBlock"
	TxMaxCacheTime = "general.txpool.txMaxCacheTime"
	// consensus policy setting
	ConsensusPolicy                   = "general.consensus.policy"
	ConsensusEnableEmptyBlock         = "general.consensus.enableEmptyBlock"
	ConsensusTimeoutToCollectResponse = "general.consensus.timeoutToCollectResponse"
	ConsensusTimeoutWaitCommit        = "general.consensus.timeoutToWaitCommit"
	ConsensusTimeoutViewChange        = "general.consensus.timeoutToViewChange"
	ConsensusLocalSignatureVerify     = "general.consensus.localSignatureVerify"
	ConsensusSyncSignatureVerify      = "general.consensus.syncSignatureVerify"

	ParticipatesPolicy = "general.participates.policy"
	RolePolicy         = "general.role.policy"
	// node info
	NodeAddress = "general.node.address"
	NodeId      = "general.node.id"
	NodeUrl     = "general.node.url"
	// block chain
	RepositoryPlugin    = "general.repository.plugin"
	RepositoryStatePath = "general.repository.statePath"
	RepositoryDataPath  = "general.repository.dataPath"
	// api gateway
	ApiGatewayAddr = "general.apigateway"
	// Default parameter for solo block producer
	BlockProducedTimeInterval = "general.BlockProducedInterval"

	//P2P Setting
	BlockSyncerP2P     = "general.p2p.blockSyncer" // block syncer p2p config
	BlockP2P           = "general.p2p.block"       // block p2p config
	TxP2P              = "general.p2p.tx"          // tx p2p config
	P2PAddrBook        = "AddrBookFilePath"
	P2PListenAddr      = "ListenAddress"
	P2PMaxOut          = "MaxConnOutBound"
	P2PMaxIn           = "MaxConnInBound"
	P2PPersistendPeers = "PersistentPeers"
	P2PDebug           = "DebugP2P"
	P2PDebugServer     = "DebugServer"
	P2PDebugAddr       = "DebugAddr"
	P2PNAT             = "Nat"
	P2PDisableDNSSeed  = "DisableDNSSeed"
	P2PDNSSeeds        = "DNSSeeds"
	P2PService         = "Service"

	// prometheus
	PrometheusEnabled = "monitor.prometheus.enabled"
	PrometheusPort    = "monitor.prometheus.port"
	PrometheusMaxConn = "monitor.prometheus.maxOpenConnections"

	// Expvar
	ExpvarEnabled = "monitor.expvar.enabled"
	ExpvarPort    = "monitor.expvar.port"
	ExpvarPath    = "monitor.expvar.path"

	// pprof
	PprofEnabled = "monitor.pprof.enabled"
	PprofPort    = "monitor.pprof.port"

	// Log Setting
	LogTimeFieldFormat = "logging.timeFieldFormat"
	ConsoleLogAppender = "logging.console"
	LogConsoleEnabled  = "logging.console.enabled"
	LogConsoleLevel    = "logging.console.level"
	LogConsoleFormat   = "logging.console.format"
	LogConsoleCaller   = "logging.console.caller"
	LogConsoleHostname = "logging.console.hostname"
	FileLogAppender    = "logging.file"
	LogFileEnabled     = "logging.file.enabled"
	LogFilePath        = "logging.file.path"
	LogFileLevel       = "logging.file.level"
	LogFileFormat      = "logging.file.format"
	LogFileCaller      = "logging.file.caller"
	LogFileHostname    = "logging.file.hostname"

	// signature switch
	ProducerSignatureVerifySwitch  = "general.signature.producer"
	ValidatorSignatureVerifySwitch = "general.signature.validator"

	// switch config
	TxSwitxh                         = "tx_switch"
	TxSwitchSignatureVerifySwitch    = "general.signature.txswitch"
	BlockSwitch                      = "block_switch"
	BlockSwitchSignatureVerifySwitch = "general.signature.blockswitch"
)
View Source
const (
	GenesisFileName = "genesis.json"
	InvalidPath     = ""
)

Variables

This section is empty.

Functions

func GetApiGatewayTcpAddr

func GetApiGatewayTcpAddr(conf *viper.Viper) string

func GetBlockProducerInterval

func GetBlockProducerInterval(conf *viper.Viper) int64

func GetChainIdFromConfig added in v1.1.0

func GetChainIdFromConfig() (uint64, error)

func GetExpvarConf

func GetExpvarConf(conf *viper.Viper) monitor.ExpvarConfig

func GetLogSetting

func GetLogSetting(conf *viper.Viper) log.Config

func GetNodeAccount

func GetNodeAccount(conf *viper.Viper) account.Account

func GetP2PConf

func GetP2PConf(conf *viper.Viper) map[string]*p2pConf.P2PConfig

func GetPprofConf added in v1.0.0

func GetPprofConf(conf *viper.Viper) monitor.PprofConfig

func GetProducerConf added in v1.0.0

func GetProducerConf(conf *viper.Viper) producerConfig.ProducerConfig

func GetPrometheusConf

func GetPrometheusConf(conf *viper.Viper) monitor.PrometheusConfig

func GetSwitchConf added in v1.0.0

func GetSwitchConf(conf *viper.Viper) map[string]*swConf.SwitchConfig

func ImportGenesisBlock added in v1.0.0

func ImportGenesisBlock()

func LoadConfig

func LoadConfig() (config *viper.Viper)

func NewConsensusConf

func NewConsensusConf(conf *viper.Viper) consensusConfig.ConsensusConfig

func NewRepositoryConf added in v1.1.0

func NewRepositoryConf(conf *viper.Viper) repositoryConfig.RepositoryConfig

func NewRoleConf

func NewRoleConf(conf *viper.Viper) roleConfig.RoleConfig

func NewTxPoolConf

func NewTxPoolConf(conf *viper.Viper) txpool.TxPoolConfig

Types

type AlgorithmConfig

type AlgorithmConfig struct {
	//hash algorithm
	HashAlgorithm string
	//signature algorithm
	SignAlgorithm string
}

func GetAlgorithmConf

func GetAlgorithmConf(config *viper.Viper) AlgorithmConfig

type Config

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

type GenesisAccount added in v1.0.0

type GenesisAccount struct {
	Addr     types.Address `json:"addr"     gencodec:"required"`
	Balance  *big.Int      `json:"balance"`
	Code     []byte        `json:"code"`
	Contract string        `json:"contract"`
}

GenesisAccount is the account in genesis block.

type GenesisAccountConfig added in v1.0.0

type GenesisAccountConfig struct {
	Addr     string   `json:"addr"     gencodec:"required"`
	Balance  *big.Int `json:"balance"`
	Code     string   `json:"code"`
	Contract string   `json:"contract"`
}

type GenesisBlock added in v1.0.0

type GenesisBlock struct {
	Block           *types.Block
	GenesisAccounts []GenesisAccount
	ExtraData       []byte `json:"extra_data"`
}

GenesisBlock is the genesis block struct of the chain.

func GenerateGenesisBlock added in v1.0.0

func GenerateGenesisBlock() (*GenesisBlock, error)

BuildGenesisBlock build genesis block from the specified config file. if the genesis config file is not specified, build default genesis block

type GenesisBlockConfig added in v1.0.0

type GenesisBlockConfig struct {
	Block           *types.Block
	GenesisAccounts []GenesisAccountConfig
	ExtraData       []byte `json:"extra_data"`
}

type NodeConfig

type NodeConfig struct {
	NodeType common.NodeType
	// default
	Account account.Account
	// api gateway
	ApiGatewayAddr string
	// txpool
	TxPoolConf txpool.TxPoolConfig
	// participates
	ParticipatesConf participatesConfig.ParticipateConfig
	// role
	RoleConf roleConfig.RoleConfig
	// consensus
	ConsensusConf consensusConfig.ConsensusConfig
	// repositoryConfig
	RepositoryConf repositoryConfig.RepositoryConfig
	// Block Produce Interval
	BlockInterval int64
	//algorithm config
	AlgorithmConf AlgorithmConfig
	// producer config
	ProducerConf producerConfig.ProducerConfig

	// prometheus
	PrometheusConf monitor.PrometheusConfig
	// expvar
	ExpvarConf monitor.ExpvarConfig
	// pprof
	PprofConf monitor.PprofConfig
	// log setting
	Logger log.Config
	//P2P config
	P2PConf map[string]*p2pConf.P2PConfig
	//Switch config
	SwitchConf map[string]*swConf.SwitchConfig
}

func NewNodeConfig

func NewNodeConfig() NodeConfig

type SysConfig added in v1.0.0

type SysConfig struct {
	LogLevel log.Level
	LogPath  string
	LogStyle string
}

Jump to

Keyboard shortcuts

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