config

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Default permissions for writing files
	// These are based on default umask settings
	// User+Group: rw, Other: r
	FilePerms = 0664
	// User+Group: rwx, Other: rx
	DirPerms               = 0775
	FileName               = "config.toml"
	DefaultDir             = ".olfullnode"
	DefaultRPCStartTimeout = 2
)

Variables

This section is empty.

Functions

func Setup added in v0.13.0

func Setup(cfg *Server, key string, value string) error

Types

type Authorisation added in v0.14.0

type Authorisation struct {
	//owner's password
	OwnerCredentials []string `` /* 275-byte string literal not displayed */

	//Private key for RPC Authentication
	RPCPrivateKey string `` /* 207-byte string literal not displayed */
}

type ChainDriverConfig added in v0.13.0

type ChainDriverConfig struct {
	BitcoinChainType   string `toml:"bitcoin_chain_type" desc:"bitcoin chain types, mainnet, testnet3, or regtest"`
	BitcoinNodeAddress string `toml:"bitcoin_node_address" desc:"ip address of bitcoin node"`
	BitcoinRPCPort     string `toml:"bitcoin rpc_port" desc:"rpc port of bitcoin node"`
	BitcoinRPCUsername string `toml:"bitcoin_rpc_username" desc:"rpc username of bitcoin node"`
	BitcoinRPCPassword string `toml:"bitcoin_rpc_password" desc:"rpc password of bitcoin node"`

	BlockCypherToken string `toml:"blockcypher_token" desc:"token to use blockcypher APIs"`
}

func DefaultChainDriverConfig added in v0.13.0

func DefaultChainDriverConfig() *ChainDriverConfig

type ChainStateRotationCfg added in v0.14.0

type ChainStateRotationCfg struct {

	// "recent" : latest number of version to persist
	// recent = 0 : keep last version only
	// recent = 3 : keep last 4 version
	Recent int64

	// "every"  : every X number of version to persist
	// every = 0 : keep no other epoch version
	// every = 1 : keep every version
	// every > 1 : epoch number = every
	Every int64

	// "cycles" : number of latest cycles for "every" to persist
	// cycles = 1 : only keep one of latest every
	// cycles = 0 : keep every "every"
	Cycles int64
}

type Client

type Client struct {
	Node NodeConfig `toml:"node"`

	BroadcastMode string `toml:"async"`
	Proof         bool   `toml:"proof"`
}

type ConsensusConfig

type ConsensusConfig struct {
	LogOutput             string   `toml:"log_output" desc:"Determines where consensus is logged (stdout|<filename>)"`
	LogLevel              string   `toml:"log_level" desc:"Determines the verbosity of consensus logs"`
	TimeoutPropose        Duration `toml:"timeout_propose" desc:"All timeouts are in milliseconds"`
	TimeoutProposeDelta   Duration `toml:"timeout_propose_delta"`
	TimeoutPrevote        Duration `toml:"timeout_prevote"`
	TimeoutPrevoteDelta   Duration `toml:"timeout_prevote_delta"`
	TimeoutPrecommit      Duration `toml:"timeout_precommit"`
	TimeoutPrecommitDelta Duration `toml:"timeout_precommit_delta"`
	TimeoutCommit         Duration `toml:"timeout_commit"`

	SkipTimeoutCommit bool `toml:"skip_timeout_commit" desc:"Make progress as soon as we have all precommits (as if TimeoutCommit = 0)"`

	CreateEmptyBlocks           bool     `toml:"create_empty_blocks" desc:"Should this node create empty blocks"`
	CreateEmptyBlocksInterval   Duration `toml:"create_empty_blocks_interval" desc:"Interval between empty block creation in milliseconds"`
	PeerGossipSleepDuration     Duration `toml:"peer_gossip_sleep_duration" desc:"Duration values in milliseconds"`
	PeerQueryMaj23SleepDuration Duration `toml:"peer_query_maj23_sleep_duration"`
}

ConsensusConfig handles consensus-specific options

func DefaultConsensusConfig

func DefaultConsensusConfig() *ConsensusConfig

func (*ConsensusConfig) TMConfig

func (cfg *ConsensusConfig) TMConfig() *tmconfig.ConsensusConfig

type Duration

type Duration int64

Duration is a time.Duration that marshals and unmarshals with millisecond values

func (Duration) Nanoseconds

func (d Duration) Nanoseconds() time.Duration

Returns a nanosecond duration

type EthereumChainDriverConfig added in v0.13.0

type EthereumChainDriverConfig struct {
	Connection string `toml:"connection" desc:"ethereum node connection url default: http://localhost:7545"`
}

func DefaultEthConfig added in v0.13.0

func DefaultEthConfig(network string, key string) *EthereumChainDriverConfig

type GenesisDoc

type GenesisDoc = tmtypes.GenesisDoc

type MempoolConfig

type MempoolConfig struct {
	Recheck   bool `toml:"recheck"`
	Broadcast bool `toml:"broadcast"`
	Size      int  `toml:"size" desc:"Size of the mempool"`
	CacheSize int  `toml:"cache_size"`
}

MempoolConfig defines configuration options for the mempool

func DefaultMempoolConfig

func DefaultMempoolConfig() *MempoolConfig

func (*MempoolConfig) TMConfig

func (cfg *MempoolConfig) TMConfig() *tmconfig.MempoolConfig

type NetworkConfig

type NetworkConfig struct {
	RPCAddress      string `toml:"rpc_address"`
	RPCStartTimeout int    `toml:"rpc_start_timeout" desc:"RPC startup timeout in seconds"`

	P2PAddress string `toml:"p2p_address" desc:"Main address for P2P connections"`

	ExternalP2PAddress string `toml:"external_p2p_address" desc:"Address to advertise for incoming peers to connect to"`

	SDKAddress string `toml:"sdk_address"`
}

NetworkConfig exposes configuration files for the current

func DefaultNetworkConfig

func DefaultNetworkConfig() *NetworkConfig

type NodeConfig

type NodeConfig struct {
	NodeName string `toml:"node_name"`
	FastSync bool   `` /* 143-byte string literal not displayed */
	DB       string `toml:"db" desc:"Specify what backend database to use (goleveldb|cleveldb)"`
	DBDir    string `toml:"db_dir" desc:"Specify the application database directory. This is always relative to the root directory of the app."`

	LogLevel int `toml:"loglevel" desc:"Specify the log level for olfullnode. 0: Fatal, 1: Error, 2: Warning, 3: Info, 4: Debug, 5: Detail"`
	// List of transaction tags to index in the db, allows them to be searched
	// by this parameter
	IndexTags []string `toml:"index_tags" desc:"List of transaction tags to index in the database, allows them to be searched by the specified tags"`
	// Tells the indexer to index all available tags, IndexTags has precedence
	// over IndexAllTAgs
	IndexAllTags bool `toml:"index_all_tags" desc:"Tells the indexer to index all available tags, IndexTags has precedence over IndexAllTags"`

	//rpc package
	Services []string `toml:"services" desc:"List of services used by the current Node. Possible valued [broadcast, node, owner, query, tx]"`

	Auth Authorisation `toml:"Auth" desc:"the OwnerCredentials and RPCPrivateKey should be configured together"`

	ChainStateRotation ChainStateRotationCfg `toml:"ChainStateRotation" desc:"the schedule for chain state rotation"`
}

NodeConfig handles general configuration settings for the node

func DefaultNodeConfig

func DefaultNodeConfig() *NodeConfig

type P2PConfig

type P2PConfig struct {
	Seeds []string `toml:"seeds" desc:"List of seed nodes to connect to"`

	SeedMode bool `toml:"seed_mode" desc:"Enables seed mode, which will make the node crawl the network looking for peers"`

	PersistentPeers []string `toml:"persistent_peers" desc:"List of peers to maintain a persistent connection to"`

	UPNP bool `toml:"upnp" desc:"Enable UPNP port forwarding"`

	AddrBookStrict bool `` /* 155-byte string literal not displayed */

	MaxNumInboundPeers int `toml:"max_num_inbound_peers" desc:"Max number of inbound peers"`

	MaxNumOutboundPeers int `toml:"max_num_outbound_peers" desc:"Max number of outbound peers to connect to, excluding persistent peers"`

	FlushThrottleTimeout Duration `toml:"flush_throttle_timeout" desc:"Time to wait before flushing messages out on the connection in milliseconds"`

	MaxPacketMsgPayloadSize int `toml:"max_packet_msg_payload_size" desc:"Max size of a message packet payload, in bytes"`

	SendRate int64 `toml:"send_rate" desc:"Rate at which packets can be sent, in bytes/second"`

	// Rate at which packets can be received, in bytes/second
	RecvRate int64 `toml:"recv_rate" desc:"Rate at which packets can be received, in bytes/second"`

	PexReactor bool `toml:"pex" desc:"Set true to enable the peer-exchange reactor"`

	PrivatePeerIDs []string `toml:"private_peer_ids" desc:"List of peer IDs to keep private (will not be gossiped to other peers)"`

	AllowDuplicateIP bool `toml:"allow_duplicate_ip" desc:"Toggle to disable guard against peers connecting from the same IP"`

	HandshakeTimeout Duration `toml:"handshake_timeout" desc:"In milliseconds"`
	DialTimeout      Duration `toml:"dial_timeout" desc:"In milliseconds"`
}

P2PConfig defines the options for P2P networking layer

func DefaultP2PConfig

func DefaultP2PConfig() *P2PConfig

func (*P2PConfig) SetPersistentPeers added in v0.13.0

func (cfg *P2PConfig) SetPersistentPeers(peers []string)

func (*P2PConfig) TMConfig

func (cfg *P2PConfig) TMConfig() *tmconfig.P2PConfig

type Server

type Server struct {
	Node           *NodeConfig                `toml:"node"`
	Network        *NetworkConfig             `toml:"network"`
	P2P            *P2PConfig                 `toml:"p2p"`
	Mempool        *MempoolConfig             `toml:"mempool"`
	Consensus      *ConsensusConfig           `toml:"consensus"`
	ChainDriver    *ChainDriverConfig         `toml:"chain_driver"`
	EthChainDriver *EthereumChainDriverConfig `toml:"ethereum_chain_driver"`
	// contains filtered or unexported fields
}

Struct for holding the configuration details for the node

func DefaultServerConfig

func DefaultServerConfig() *Server

func (*Server) ChainID

func (cfg *Server) ChainID() string

func (*Server) Marshal

func (cfg *Server) Marshal() (text []byte, err error)

Marshal returns the text form of Server as TOML

func (*Server) ReadFile

func (cfg *Server) ReadFile(path string) error

ReadFile accepts a filepath and returns the

func (*Server) RootDir

func (cfg *Server) RootDir() string

func (*Server) SaveFile

func (cfg *Server) SaveFile(filepath string) error

SaveFile saves the current config to a file at the specified path

func (*Server) TMConfig

func (cfg *Server) TMConfig() tmconfig.Config

func (*Server) Unmarshal

func (cfg *Server) Unmarshal(text []byte) error

Marshal accepts the text form of a TOML configuration file and fills Server with its values

Jump to

Keyboard shortcuts

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