Documentation ¶
Index ¶
- Constants
- func AddrToPeerInfo(multiAddr string) (*peer.AddrInfo, error)
- func AddrsToPeerInfo(multiAddrs []string) ([]peer.AddrInfo, error)
- 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 MultiaddrToPeerID(multiAddr string) (string, error)
- func PathRoot() (string, error)
- func PathRootWithDefault(path string) (string, error)
- func ReadConfig(path, configType string, config interface{}) error
- type Cert
- type Certs
- type Config
- type Executor
- type Gateway
- type Genesis
- type Key
- type Log
- type LogModule
- type Monitor
- type NetworkConfig
- type NetworkNode
- type Order
- type PProf
- type Port
- type ReadinNetworkConfig
- type Repo
- type Security
- type Txpool
Constants ¶
const ( // key name KeyName = "key.json" // API name APIName = "api" )
Variables ¶
This section is empty.
Functions ¶
func AddrToPeerInfo ¶
AddrToPeerInfo transfer addr to PeerInfo addr example: "/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64"
func AddrsToPeerInfo ¶ added in v1.0.1
AddrsToPeerInfo transfer addrs to PeerInfo
func GetKeyPath ¶
func GetPidFromPrivFile ¶ added in v1.0.1
GetPidFromPrivFile gets pid from libp2p node priv file
func GetStoragePath ¶
func Initialize ¶
func Initialized ¶
func MultiaddrToPeerID ¶ added in v1.0.1
MultiaddrToPeerID .
func PathRootWithDefault ¶
func ReadConfig ¶
Types ¶
type Certs ¶
type Certs struct { NodeCertData []byte AgencyCertData []byte CACertData []byte NodeCert *x509.Certificate AgencyCert *x509.Certificate CACert *x509.Certificate }
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"` Gateway `json:"gateway"` Log `json:"log"` Cert `json:"cert"` Txpool `json:"txpool"` Order `json:"order"` Executor `json:"executor"` Security Security `toml:"security" json:"security"` }
func DefaultConfig ¶
func UnmarshalConfig ¶
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"` }
type NetworkConfig ¶
type NetworkConfig struct { ID uint64 N uint64 LocalAddr string Nodes []*NetworkNode OtherNodes map[uint64]*peer.AddrInfo }
NetworkConfig . @param OtherNodes to fit original code @param OthersNodes for new network config
func (NetworkConfig) Len ¶ added in v1.0.1
func (p NetworkConfig) Len() int
Len returns length of the struct to be sorted
func (NetworkConfig) Less ¶ added in v1.0.1
func (p NetworkConfig) Less(i, j int) bool
Less compares two iterms ascending(ASC)
type NetworkNode ¶ added in v1.0.1
NetworkNode is the struct to describe network conf of a node @param ID is the id of the node, it is origined by sorting. @param Addrs is the address array of the node. @param Addr is the default used address the node.
type ReadinNetworkConfig ¶ added in v1.0.1
type ReadinNetworkConfig struct {
Addrs [][]string
}
ReadinNetworkConfig is used for read in toml file
type Repo ¶
type Repo struct { Config *Config NetworkConfig *NetworkConfig Genesis *Genesis Key *Key Certs *Certs }
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"` }
Security are files used to setup connection with tls