Documentation
¶
Index ¶
- Constants
- Variables
- func GetAPI(repoRoot string) (string, error)
- func GetNetworkPeers(networkConfig *NetworkConfig) (map[string]*peer2.AddrInfo, error)
- func InitConfig(path string) error
- func Initialize(repoRoot, algo string) error
- func KeyPath(repoRoot string) string
- func LoadNodePrivateKey(repoRoot string) (crypto.PrivateKey, error)
- func LoadPrivateKey(repoRoot string) (crypto.PrivateKey, error)
- func NodeKeyPath(repoRoot string) string
- func PathRoot() (string, error)
- func PathRootWithDefault(path string) (string, error)
- func PluginPath() (string, error)
- func ReadConfig(v *viper.Viper, path, configType string, config interface{}) error
- func SetPath(root string)
- func WriteNetworkConfig(originRoot string, repoRoot string, changeConfig *NetworkConfig) error
- type Appchain
- type Config
- type Direct
- type HA
- type Log
- type LogModule
- type Mode
- type NetworkConfig
- type NetworkPiers
- type Port
- type Relay
- type Repo
- type Security
- type TSS
- type Union
Constants ¶
View Source
const ( DirectMode = "direct" RelayMode = "relay" UnionMode = "union" )
View Source
const ( // DefaultPathName is the default config dir name DefaultPathName = ".pier" // DefaultPathRoot is the path to the default config dir location. DefaultPathRoot = "~/" + DefaultPathName // EnvDir is the environment variable used to change the path root. EnvDir = "PIER_PATH" // ConfigName is config name ConfigName = "pier.toml" NetworkName = "network.toml" // config path ConfigPath = "../../config" // KeyName KeyName = "key.json" // NodeKeyName NodeKeyName = "node.priv" // NodeCsrName NodeCsrName = "node.csr" // KeyPassword KeyPassword = "bitxhub" // API name APIName = "api" // Bitxhub type BitxhubType = "bitxhub" )
Variables ¶
View Source
var RootPath string
Functions ¶
func GetNetworkPeers ¶ added in v1.14.0
func GetNetworkPeers(networkConfig *NetworkConfig) (map[string]*peer2.AddrInfo, error)
GetNetworkPeers gets all peers from network config
func Initialize ¶
Initialize creates .pier path and necessary configuration, account file and so on.
func LoadNodePrivateKey ¶ added in v1.4.0
func LoadNodePrivateKey(repoRoot string) (crypto.PrivateKey, error)
func LoadPrivateKey ¶
func LoadPrivateKey(repoRoot string) (crypto.PrivateKey, error)
LoadPrivateKey loads private key from config path
func NodeKeyPath ¶ added in v1.4.0
func PathRootWithDefault ¶
PathRootWithDefault gets current config path with default value
func ReadConfig ¶ added in v1.14.0
func WriteNetworkConfig ¶ added in v1.14.0
func WriteNetworkConfig(originRoot string, repoRoot string, changeConfig *NetworkConfig) error
Types ¶
type Appchain ¶
type Appchain struct {
ID string `toml:"id" json:"id"`
Config string `toml:"config" json:"config"`
Plugin string `toml:"plugin" json:"plugin"`
}
Appchain are configs about appchain
type Config ¶
type Config struct {
RepoRoot string
Title string `toml:"title" json:"title"`
Port Port `toml:"port" json:"port"`
Mode Mode `toml:"mode" json:"mode"`
Log Log `toml:"log" json:"log"`
Appchain Appchain `toml:"appchain" json:"appchain"`
Security Security `toml:"security" json:"security"`
HA HA `toml:"ha" json:"ha"`
TSS *TSS `toml:"tss" json:"tss"`
}
Config represents the necessary config data for starting pier
func UnmarshalConfig ¶
UnmarshalConfig read from config files under config path
type Log ¶
type Log struct {
Dir string `toml:"dir" json:"dir"`
Filename string `toml:"filename" json:"filename"`
ReportCaller bool `mapstructure:"report_caller"`
Level string `toml:"level" json:"level"`
Module LogModule `toml:"module" json:"module"`
}
Log are config about log
type LogModule ¶ added in v1.5.0
type LogModule struct {
ApiServer string `mapstructure:"api_server" toml:"api_server" json:"api_server"`
AppchainMgr string `mapstructure:"appchain_mgr" toml:"appchain_mgr" json:"appchain_mgr"`
BxhLite string `mapstructure:"bxh_lite" toml:"bxh_lite" json:"bxh_lite"`
Exchanger string `toml:"exchanger" json:"exchanger"`
Executor string `toml:"executor" json:"executor"`
Monitor string `toml:"monitor" json:"monitor"`
PeerMgr string `mapstructure:"peer_mgr" toml:"peer_mgr" json:"peer_mgr"`
Router string `toml:"router" json:"router"`
RuleMgr string `mapstructure:"rule_mgr" toml:"rule_mgr" json:"rule_mgr"`
Swarm string `toml:"swarm" json:"swarm"`
Appchain string `mapstructure:"appchain_adapter" toml:"appchain_adapter" json:"appchain_adapter"`
Syncer string `mapstructure:"bxh_adapter" toml:"bxh_adapter" json:"bxh_adapter"`
Direct string `mapstructure:"direct_adapter" toml:"direct_adapter" json:"direct_adapter"`
Union string `toml:"union_adapter" json:"union_adapter"`
Cryptor string `toml:"cryptor" json:"cryptor"`
}
type NetworkConfig ¶ added in v1.14.0
type NetworkConfig struct {
LocalAddr string `toml:"local_addr, omitempty" json:"local_addr"`
Piers []*NetworkPiers `toml:"piers" json:"piers"`
}
func LoadNetworkConfig ¶ added in v1.14.0
func LoadNetworkConfig(repoRoot string, privateKey crypto2.PrivKey) (*NetworkConfig, error)
type NetworkPiers ¶ added in v1.14.0
type Relay ¶
type Relay struct {
Addrs []string `toml:"addrs" json:"addrs"`
TimeoutLimit time.Duration `mapstructure:"timeout_limit" json:"timeout_limit"`
Quorum uint64 `toml:"quorum" json:"quorum"`
BitXHubID string `mapstructure:"bitxhub_id" json:"bitxhub_id"`
EnableOffChainTransmission bool `mapstructure:"enable_offchain_transmission"`
}
Relay are configs about bitxhub
type Repo ¶ added in v1.14.0
type Repo struct {
Config *Config
NetworkConfig *NetworkConfig
}
type Security ¶ added in v1.4.0
type Security struct {
EnableTLS bool `mapstructure:"enable_tls"`
AccessCert []string `mapstructure:"access_cert"`
AccessKey string `mapstructure:"access_key"`
Tlsca string `toml:"tlsca" json:"tlsca"`
CommonName string `mapstructure:"common_name" json:"common_name"`
}
Security are certs used to setup connection with tls
Click to show internal directories.
Click to hide internal directories.