Documentation ¶
Index ¶
- Constants
- func GetAPI(repoRoot string) (string, error)
- func GetKeyPath(repoRoot string) string
- func GetPidFromPrivFile(privPath string) (string, error)
- func GetStoragePath(repoRoot string, subPath ...string) string
- func Initialize(repoRoot string) error
- func Initialized(repoRoot string) bool
- func PathRoot() (string, error)
- func PathRootWithDefault(path string) (string, error)
- func ReadConfig(v *viper.Viper, path, configType string, config interface{}) error
- func RewriteNetworkConfig(repoRoot string, infos map[uint64]*pb.VpInfo, isNew bool) error
- func WatchBitxhubConfig(viper *viper.Viper, feed *event.Feed)
- func WatchNetworkConfig(viper *viper.Viper, feed *event.Feed, config *NetworkConfig)
- type Admin
- type Appchain
- type Cert
- type Config
- type Crypto
- type Executor
- type Gateway
- type Genesis
- type Key
- type Ledger
- type License
- type Limiter
- type Log
- type LogModule
- type Monitor
- type NetworkConfig
- type NetworkNodes
- type Order
- type PProf
- type Ping
- type Port
- type Repo
- type Security
- type Txpool
Constants ¶
View Source
const ( // key name KeyName = "key.json" // API name APIName = "api" // admin weight SuperAdminWeight = 2 NormalAdminWeight = 1 // governance strategy default participate threshold DefaultParticipateThreshold = 0.75 //Passwd DefaultPasswd = "bitxhub" )
Variables ¶
This section is empty.
Functions ¶
func GetKeyPath ¶
func GetPidFromPrivFile ¶ added in v1.0.1
GetPidFromPrivFile gets pid from libp2p node priv file
func GetStoragePath ¶
func Initialize ¶
func Initialized ¶
func PathRootWithDefault ¶
func ReadConfig ¶
func RewriteNetworkConfig ¶ added in v1.4.0
func WatchBitxhubConfig ¶ added in v1.6.3
func WatchNetworkConfig ¶ added in v1.6.3
func WatchNetworkConfig(viper *viper.Viper, feed *event.Feed, config *NetworkConfig)
Types ¶
type Config ¶
type Config struct { RepoRoot string `json:"repo_root"` Title string `json:"title"` Solo bool `json:"solo"` Port `json:"port"` PProf `json:"pprof"` Monitor `json:"monitor"` Limiter `json:"limiter"` Appchain `json:"appchain"` Gateway `json:"gateway"` Ping `json:"ping"` Log `json:"log"` Cert `json:"cert"` Txpool `json:"txpool"` Order `json:"order"` Executor `json:"executor"` Ledger `json:"ledger"` Genesis `json:"genesis"` Security Security `toml:"security" json:"security"` License License `toml:"license" json:"license"` Crypto Crypto `toml:"crypto" json:"crypto"` }
func DefaultConfig ¶
func UnmarshalConfig ¶
type Crypto ¶ added in v1.13.0
type Crypto struct {
Algorithms []string `json:"algorithms" toml:"algorithms"`
}
type Genesis ¶
type Genesis struct { ChainID uint64 `json:"chainid" toml:"chainid"` GasLimit uint64 `mapstructure:"gas_limit" json:"gas_limit" toml:"gas_limit"` BvmGasPrice uint64 `mapstructure:"bvm_gas_price" json:"bvm_gas_price" toml:"bvm_gas_price"` Balance string `json:"balance" toml:"balance"` Admins []*Admin `json:"admins" toml:"admins"` Strategy map[string]string `json:"strategy" toml:"strategy"` Dider string `json:"dider" toml:"dider"` }
type Key ¶
type Key struct { Address string `json:"address"` PrivKey crypto2.PrivateKey `json:"priv_key"` Libp2pPrivKey crypto.PrivKey }
type LogModule ¶
type LogModule struct { P2P string `toml:"p2p" json:"p2p"` Consensus string `toml:"consensus" json:"consensus"` Executor string `toml:"executor" json:"executor"` Router string `toml:"router" json:"router"` API string `toml:"api" json:"api"` CoreAPI string `mapstructure:"coreapi" toml:"coreapi" json:"coreapi"` Storage string `toml:"storage" json:"storage"` Profile string `toml:"profile" json:"profile"` }
type NetworkConfig ¶
type NetworkConfig struct { ID uint64 `toml:"id" json:"id"` N uint64 `toml:"n" json:"n"` New bool `toml:"new" json:"new"` LocalAddr string `toml:"local_addr, omitempty" json:"local_addr"` Nodes []*NetworkNodes `toml:"nodes" json:"nodes"` Genesis Genesis `toml:"genesis, omitempty" json:"genesis"` }
func (*NetworkConfig) GetNetworkPeers ¶ added in v1.4.0
func (config *NetworkConfig) GetNetworkPeers() (map[uint64]*peer.AddrInfo, error)
GetNetworkPeers gets all peers from network config
func (*NetworkConfig) GetVpAccount ¶ added in v1.4.0
func (config *NetworkConfig) GetVpAccount() map[uint64]types.Address
GetVpAccount gets genesis address from network config
func (*NetworkConfig) GetVpGenesisAccount ¶ added in v1.4.0
func (config *NetworkConfig) GetVpGenesisAccount() map[uint64]types.Address
GetVpGenesisAccount gets genesis address from network config
func (*NetworkConfig) GetVpInfos ¶ added in v1.4.0
func (config *NetworkConfig) GetVpInfos() map[uint64]*pb.VpInfo
GetVpInfos gets vp info from network config
type NetworkNodes ¶
type Repo ¶
type Repo struct { Config *Config NetworkConfig *NetworkConfig Key *Key Certs *libp2pcert.Certs ConfigChangeFeed event.Feed }
func (*Repo) SubscribeConfigChange ¶ added in v1.6.3
func (r *Repo) SubscribeConfigChange(ch chan *Repo) event.Subscription
type Security ¶ added in v1.0.1
type Security struct { EnableTLS bool `mapstructure:"enable_tls"` PemFilePath string `mapstructure:"pem_file_path" json:"pem_file_path"` ServerKeyPath string `mapstructure:"server_key_path" json:"server_key_path"` GatewayCertPath string `mapstructure:"gateway_cert_path" json:"gateway_cert_path"` GatewayKeyPath string `mapstructure:"gateway_key_path" json:"gateway_key_path"` }
Security are files used to setup connection with tls
Click to show internal directories.
Click to hide internal directories.