Documentation
¶
Index ¶
- Constants
- Variables
- func GetAPI(repoRoot string) (string, error)
- func InitConfig(path string) error
- func Initialize(repoRoot 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 SetPath(root string)
- type Appchain
- type Config
- type Direct
- type Log
- type LogModule
- type Mode
- type Peer
- type Port
- type Relay
- type Router
- type Security
- type Union
Constants ¶
View Source
const ( DirectMode = "direct" // 直连模式 RelayMode = "relay" // UnionMode = "union" // 联盟模式,中继架构。代表的是部署架构,不够灵活。不能随时变动。 )
View Source
const ( // DefaultPathName is the default config dir name DefaultPathName = "sidecar" // DefaultPathRoot is the path to the default config dir location. DefaultPathRoot = "~/" + DefaultPathName // EnvDir is the environment variable used to change the path root. EnvDir = "SIDECAR_PATH" // ConfigName is config name ConfigName = "sidecar.toml" // config path ConfigPath = "../../config" // KeyName KeyName = "key.json" // NodeKeyName NodeKeyName = "node.priv" // KeyPassword KeyPassword = "link33" // API name APIName = "api" // link33 type Link33Type = "link33" )
Variables ¶
View Source
var RootPath string
Functions ¶
func Initialize ¶
Initialize creates sidecar path and necessary configuration, account file and so on.
func LoadNodePrivateKey ¶
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 ¶
func PathRootWithDefault ¶
PathRootWithDefault gets current config path with default value
Types ¶
type Appchain ¶
type Appchain struct { Enable bool `toml:"enable" json:"enable"` Type string `toml:"type" json:"type"` DID string `toml:"did" json:"did"` Config string `toml:"config" json:"config"` Plugin string `toml:"plugin" json:"plugin"` PluginID string `toml:"plugin_id" json:"plugin_id"` }
Appchain are configs about appchain
type Config ¶
type Config struct { RepoRoot string Debug bool `toml:"debug" json:"debug"` Title string `toml:"title" json:"title"` Port Port `toml:"port" json:"port"` Log Log `toml:"log" json:"log"` Appchains []Appchain `toml:"appchains" json:"appchains"` Router Router `toml:"router" json:"router"` Security Security `toml:"security" json:"security"` Peer Peer `toml:"peer" json:"peer"` }
Config represents the necessary config data for starting sidecar
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 ¶
type LogModule struct { ApiServer string `mapstructure:"api_server" toml:"api_server" json:"api_server" json:"api_server,omitempty"` AppchainMgr string `mapstructure:"appchain_mgr" toml:"appchain_mgr" json:"appchain_mgr" json:"appchain_mgr,omitempty"` App string `mapstructure:"app" toml:"app" json:"app" json:"app,omitempty"` Monitor string `toml:"monitor" json:"monitor" json:"monitor,omitempty"` PeerMgr string `mapstructure:"peer_mgr" toml:"peer_mgr" json:"peer_mgr" json:"peer_mgr,omitempty"` Router string `toml:"router" json:"router" json:"router,omitempty"` Swarm string `toml:"swarm" json:"swarm" json:"swarm,omitempty"` Syncer string `toml:"syncer" json:"syncer" json:"syncer,omitempty"` Manager string `toml:"manager" json:"manager" json:"manager,omitempty"` Rule string `toml:"rule" json:"rule" json:"rule,omitempty"` }
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"` Validators []string `toml:"validators" json:"validators"` }
Relay are configs about bitxhub
func (*Relay) GetValidators ¶
GetValidators gets validator address of bitxhub
Click to show internal directories.
Click to hide internal directories.