config

package
v0.0.0-...-8cfcfd0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Address string `json:"address" yaml:"address"`
	Type    int    `json:"type"`
	Amount  uint64 `json:"amount"`
}

type AccountCfg

type AccountCfg []Account

type Configure

type Configure struct {
	ConsensusCfg `json:"consensus"`
	TxCfg        `json:"transaction"`
	NetworkCfg   `json:"network"`
	DBCfg        `json:"db"`
	WebCfg       `json:"web"`
	AccountCfg   `json:"account"`
}

func DefaultConfig

func DefaultConfig() (*Configure, error)

DefaultConfig 生成一个默认配置

func LoadConfig

func LoadConfig(file string) (*Configure, error)

加载和初始化配置

type ConsensusCfg

type ConsensusCfg struct {
	Publickey  string `json:"publicKey" yaml:"publicKey"`
	PriVateKey string `json:"privateKey" yaml:"privateKey"`
	Verfiers   []struct {
		Publickey  string `json:"publicKey" yaml:"publicKey"`
		PriVateKey string `json:"privateKey" yaml:"privateKey"`
	} `json:"verfiers" yaml:"verfiers"`
	Timeout     int `json:"timeout" yaml:"timeout"`
	Coordinator struct {
		Publickey  string `json:"publicKey" yaml:"publicKey"`
		PriVateKey string `json:"privateKey" yaml:"privateKey"`
	} `json:"coordinator"`
	LogLevel string `json:"logLevel"`
}

type DBCfg

type DBCfg struct {
	StorageEngine string `json:"storageEngine" yaml:"storageEngine"` // 暂时只有leveldb
	LogLevel      string `json:"logLevel"`
}

type NetworkCfg

type NetworkCfg struct {
	NetMode        string     `json:"netMode" yaml:"netMode"`       // 暂时只支持http模式
	LocalAddr      string     `json:"localAddr" yaml:"localAddr"`   // 本机地址
	NodeAddrs      []NodeAddr `json:"nodeAddrs" yaml:"nodeAddrs"`   // 节点地址列表
	Publickey      string     `json:"publicKey" yaml:"publicKey"`   // 节点ID
	PriVateKey     string     `json:"privateKey" yaml:"privateKey"` // 节点私钥
	LogLevel       string     `json:"logLevel"`
	Bootstrap      bool       `json:"bootstrap"`
	BootstrapPeers []string   `json:"bootstrapPeers"`
}

type NodeAddr

type NodeAddr struct {
	Address string `json:"address"`
	PeerID  string `json:"peerID"`
}

type TxCfg

type TxCfg struct {
	MaxTxNum int    `json:"maxTxNum" yaml:"maxTxNum"` // 本地最大交易池数量
	LogLevel string `json:"logLevel"`
}

type WebCfg

type WebCfg struct {
	Port int `json:"port" yaml:"port"`
}

Jump to

Keyboard shortcuts

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