config

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDataDir added in v0.4.7

func DefaultDataDir() string

DefaultDataDir is the default data directory to use for the databases and other persistence requirements.

func EnsureRoot

func EnsureRoot(rootDir string, network string)

***** these are for production settings **********

func GenesisBlock added in v0.5.1

func GenesisBlock() *types.Block

GenesisBlock will return genesis block

func GenesisTx added in v1.0.9

func GenesisTx() *types.Tx

Types

type BaseConfig

type BaseConfig struct {
	// The root directory for all data.
	// This should be set in viper so it can unmarshal into this struct
	RootDir string `mapstructure:"home"`

	//The alias of the node
	NodeAlias string `mapstructure:"node_alias"`

	//The ID of the network to json
	ChainID string `mapstructure:"chain_id"`

	//log level to set
	LogLevel string `mapstructure:"log_level"`

	// A custom human readable name for this node
	Moniker string `mapstructure:"moniker"`

	// TCP or UNIX socket address for the profiling server to listen on
	ProfListenAddress string `mapstructure:"prof_laddr"`

	Mining bool `mapstructure:"mining"`

	// Database backend: leveldb | memdb
	DBBackend string `mapstructure:"db_backend"`

	// Database directory
	DBPath string `mapstructure:"db_dir"`

	// Keystore directory
	KeysPath string `mapstructure:"keys_dir"`

	ApiAddress string `mapstructure:"api_addr"`

	VaultMode bool `mapstructure:"vault_mode"`

	// log file name
	LogFile string `mapstructure:"log_file"`
}

----------------------------------------------------------------------------- BaseConfig

func DefaultBaseConfig

func DefaultBaseConfig() BaseConfig

Default configurable base parameters.

func (BaseConfig) DBDir

func (b BaseConfig) DBDir() string

func (BaseConfig) KeysDir

func (b BaseConfig) KeysDir() string

func (BaseConfig) LogDir added in v1.0.10

func (b BaseConfig) LogDir() string

type Config

type Config struct {
	// Top level options use an anonymous struct
	BaseConfig `mapstructure:",squash"`
	// Options for services
	P2P       *P2PConfig       `mapstructure:"p2p"`
	Wallet    *WalletConfig    `mapstructure:"wallet"`
	Auth      *RPCAuthConfig   `mapstructure:"auth"`
	Web       *WebConfig       `mapstructure:"web"`
	Simd      *SimdConfig      `mapstructure:"simd"`
	Websocket *WebsocketConfig `mapstructure:"ws"`
}
var (
	// CommonConfig means config object
	CommonConfig *Config
)

func DefaultConfig

func DefaultConfig() *Config

Default configurable parameters.

func (*Config) NodeKey added in v1.0.8

func (cfg *Config) NodeKey() (string, error)

NodeKey retrieves the currently configured private key of the node, checking first any manually set key, falling back to the one found in the configured data folder. If no key can be found, a new one is generated.

func (*Config) SetRoot

func (cfg *Config) SetRoot(root string) *Config

Set the RootDir for all Config structs

type P2PConfig

type P2PConfig struct {
	ListenAddress    string `mapstructure:"laddr"`
	Seeds            string `mapstructure:"seeds"`
	PrivateKey       string `mapstructure:"node_key"`
	NodeKeyFile      string `mapstructure:"node_key_file"`
	SkipUPNP         bool   `mapstructure:"skip_upnp"`
	LANDiscover      bool   `mapstructure:"lan_discoverable"`
	MaxNumPeers      int    `mapstructure:"max_num_peers"`
	HandshakeTimeout int    `mapstructure:"handshake_timeout"`
	DialTimeout      int    `mapstructure:"dial_timeout"`
	ProxyAddress     string `mapstructure:"proxy_address"`
	ProxyUsername    string `mapstructure:"proxy_username"`
	ProxyPassword    string `mapstructure:"proxy_password"`
	KeepDial         string `mapstructure:"keep_dial"`
}

P2PConfig

func DefaultP2PConfig

func DefaultP2PConfig() *P2PConfig

Default configurable p2p parameters.

type RPCAuthConfig added in v0.3.0

type RPCAuthConfig struct {
	Disable bool `mapstructure:"disable"`
}

func DefaultRPCAuthConfig added in v0.3.0

func DefaultRPCAuthConfig() *RPCAuthConfig

Default configurable rpc's auth parameters.

type SimdConfig added in v1.0.4

type SimdConfig struct {
	Enable bool `mapstructure:"enable"`
}

func DefaultSimdConfig added in v1.0.4

func DefaultSimdConfig() *SimdConfig

Default configurable web parameters.

type WalletConfig added in v0.1.1

type WalletConfig struct {
	Disable  bool   `mapstructure:"disable"`
	Rescan   bool   `mapstructure:"rescan"`
	TxIndex  bool   `mapstructure:"txindex"`
	MaxTxFee uint64 `mapstructure:"max_tx_fee"`
}

-----------------------------------------------------------------------------

func DefaultWalletConfig added in v0.1.1

func DefaultWalletConfig() *WalletConfig

Default configurable wallet parameters.

type WebConfig added in v0.4.0

type WebConfig struct {
	Closed bool `mapstructure:"closed"`
}

func DefaultWebConfig added in v0.4.0

func DefaultWebConfig() *WebConfig

Default configurable web parameters.

type WebsocketConfig added in v1.0.7

type WebsocketConfig struct {
	MaxNumWebsockets     int `mapstructure:"max_num_websockets"`
	MaxNumConcurrentReqs int `mapstructure:"max_num_concurrent_reqs"`
}

func DefaultWebsocketConfig added in v1.0.7

func DefaultWebsocketConfig() *WebsocketConfig

Jump to

Keyboard shortcuts

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