Documentation ¶
Index ¶
- func Addmount(mountlist map[string]string) []mount.Mount
- func Addport(portlist []string) (nat.PortMap, nat.PortSet)
- func ErrorOut(err error)
- type BootNoodConfig
- type Config
- type DockerInitConfig
- type Ethash
- type Genesis
- type GlobalConf
- func (p *GlobalConf) AddNodeConfig(conf map[string]string) (*GlobalConf, error)
- func (p *GlobalConf) ArtyCreateDocker() (*GlobalConf, error)
- func (p *GlobalConf) AutoExec() (*GlobalConf, error)
- func (p *GlobalConf) CheckConfigFile() (*GlobalConf, error)
- func (p *GlobalConf) CheckDockerInit() (*GlobalConf, error)
- func (p *GlobalConf) CheckImage(imagename string) bool
- func (p *GlobalConf) ContainerConfig(postlist []string, mountlist map[string]string) (*container.Config, *container.HostConfig)
- func (p *GlobalConf) CreateBootNodeDocker() (*GlobalConf, error)
- func (p *GlobalConf) CreateGenesisJson() error
- func (p *GlobalConf) CreateNodeDocker(node string) (*GlobalConf, error)
- func (p *GlobalConf) DFileContentsVal() *GlobalConf
- func (p *GlobalConf) DeleteNodeConfig(nodename string) bool
- func (p *GlobalConf) DeletedockerAll(containername string) bool
- func (p *GlobalConf) DockerInit() (*GlobalConf, error)
- func (p *GlobalConf) DockerStart() (*GlobalConf, error)
- func (p *GlobalConf) EditBootStrapNodes(node string) (*GlobalConf, error)
- func (p *GlobalConf) Exec() (*GlobalConf, error)
- func (p *GlobalConf) GetAddNodeNum() string
- func (p *GlobalConf) GetLocalIp() string
- func (p *GlobalConf) ListContainer(all bool) (*GlobalConf, error)
- func (p *GlobalConf) ListImages() ([]map[string]string, error)
- func (p *GlobalConf) LoadConfigFile() (*GlobalConf, error)
- func (p *GlobalConf) NameToID(containername string) (string, string)
- func (p *GlobalConf) NodeRegrep(nodedirs []string) (*GlobalConf, error)
- func (p *GlobalConf) Node_conf(node string) (*NodesConfig, error)
- func (p *GlobalConf) PathExistsDir(path string) error
- func (p *GlobalConf) PathExistsFile(path string) bool
- func (p *GlobalConf) PullImage(imagename string) bool
- func (p *GlobalConf) RebuildDocker(containername string, all bool) (*GlobalConf, error)
- func (p *GlobalConf) RemoveDocker(containername string, all bool) bool
- func (p *GlobalConf) SetGlobalconfig(edit map[string]string) (*GlobalConf, error)
- func (p *GlobalConf) StartContainerSingle(ID string) (*GlobalConf, error)
- func (p *GlobalConf) StopDocker(containername string) bool
- type GlobalSet
- type NodesConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BootNoodConfig ¶
type BootNoodConfig struct { Id string Start bool Status string Port string State string IP string Created int64 Genesis Genesis }
bootnode 配置结构
type Config ¶
type Config struct { ChainId int `json:"chainId,omitempty"` HomesteadBlock int `json:"homesteadBlock,omitempty"` Eip150Block int `json:"eip150Block,omitempty"` Eip150Hash string `json:"eip150Hash,omitempty"` Eip155Block int `json:"eip155Block,omitempty"` Eip158Block int `json:"eip158Block,omitempty"` ByzantiumBlock int `json:"byzantiumBlock,omitempty"` ConstantinopleBlock int `json:"constantinopleBlock,omitempty"` Ethash Ethash `json:"ethash,omitempty"` }
type DockerInitConfig ¶
type DockerInitConfig struct { Ctx context.Context Cli *client.Client Url string Tag string DOCKER_API_VERSION string }
docker需要的数据初始化
type Genesis ¶
type Genesis struct { Config Config `json:"config,omitempty"` Nonce string `json:"nonce,omitempty"` Timestamp string `json:"timestamp,omitempty"` ExtraData string `json:"extraData,omitempty"` GasLimit string `json:"gasLimit,omitempty"` Difficulty string `json:"difficulty,omitempty"` MixHash string `json:"mixHash,omitempty"` Coinbase string `json:"coinbase,omitempty"` Alloc map[string]string `json:"alloc"` Number string `json:"number,omitempty"` GasUsed string `json:"gasUsed,omitempty"` ParentHash string `json:"parentHash,omitempty"` }
genesis.json的结构体
type GlobalConf ¶
type GlobalConf struct { Global GlobalSet BootNood BootNoodConfig Nodes map[string]*NodesConfig DockerInitConfig DockerInitConfig }
整体数据的结构体
func Init ¶
func Init() (*GlobalConf, error)
func (*GlobalConf) AddNodeConfig ¶
func (p *GlobalConf) AddNodeConfig(conf map[string]string) (*GlobalConf, error)
新增node节点,写入conf.ini
func (*GlobalConf) ArtyCreateDocker ¶
func (p *GlobalConf) ArtyCreateDocker() (*GlobalConf, error)
func (*GlobalConf) AutoExec ¶
func (p *GlobalConf) AutoExec() (*GlobalConf, error)
func (*GlobalConf) CheckConfigFile ¶
func (p *GlobalConf) CheckConfigFile() (*GlobalConf, error)
检查配置文件是否符合标准,并且检查创建关键目录
func (*GlobalConf) CheckDockerInit ¶
func (p *GlobalConf) CheckDockerInit() (*GlobalConf, error)
检查docker是否执行了初始化
func (*GlobalConf) CheckImage ¶
func (p *GlobalConf) CheckImage(imagename string) bool
检查配置文件中的镜像是否存在
func (*GlobalConf) ContainerConfig ¶
func (p *GlobalConf) ContainerConfig(postlist []string, mountlist map[string]string) (*container.Config, *container.HostConfig)
生成Container的配置文件,config和hostconfig
func (*GlobalConf) CreateBootNodeDocker ¶
func (p *GlobalConf) CreateBootNodeDocker() (*GlobalConf, error)
生成bootnode的docker容器配置
func (*GlobalConf) CreateGenesisJson ¶
func (p *GlobalConf) CreateGenesisJson() error
生成genesis.json文件
func (*GlobalConf) CreateNodeDocker ¶
func (p *GlobalConf) CreateNodeDocker(node string) (*GlobalConf, error)
生成node的docker容器配置
func (*GlobalConf) DFileContentsVal ¶
func (p *GlobalConf) DFileContentsVal() *GlobalConf
启动则加载默认配置文件
func (*GlobalConf) DeleteNodeConfig ¶
func (p *GlobalConf) DeleteNodeConfig(nodename string) bool
删除node节点,写入conf.ini
func (*GlobalConf) DeletedockerAll ¶
func (p *GlobalConf) DeletedockerAll(containername string) bool
删除容器全部相关信息
func (*GlobalConf) DockerStart ¶
func (p *GlobalConf) DockerStart() (*GlobalConf, error)
启动全部docker,根据全局配置文件
func (*GlobalConf) EditBootStrapNodes ¶
func (p *GlobalConf) EditBootStrapNodes(node string) (*GlobalConf, error)
修改bootstrapNodes信息 广播地址
func (*GlobalConf) Exec ¶
func (p *GlobalConf) Exec() (*GlobalConf, error)
func (*GlobalConf) ListContainer ¶
func (p *GlobalConf) ListContainer(all bool) (*GlobalConf, error)
列出配置文件中所有docker容器
func (*GlobalConf) ListImages ¶
func (p *GlobalConf) ListImages() ([]map[string]string, error)
列出所有镜像
func (*GlobalConf) LoadConfigFile ¶
func (p *GlobalConf) LoadConfigFile() (*GlobalConf, error)
global conf.ini文件是否存在,不存在则创建默认配置文件
func (*GlobalConf) NameToID ¶
func (p *GlobalConf) NameToID(containername string) (string, string)
容器名称转id
func (*GlobalConf) NodeRegrep ¶
func (p *GlobalConf) NodeRegrep(nodedirs []string) (*GlobalConf, error)
过滤conf.ini 里面所有Section,匹配符合规则的node标签写法
func (*GlobalConf) Node_conf ¶
func (p *GlobalConf) Node_conf(node string) (*NodesConfig, error)
配置node自己的conf.ini文件的方法
func (*GlobalConf) PathExistsDir ¶
func (p *GlobalConf) PathExistsDir(path string) error
检查目录是否存在,不存在则创建
func (*GlobalConf) RebuildDocker ¶
func (p *GlobalConf) RebuildDocker(containername string, all bool) (*GlobalConf, error)
重建容器,强制关闭和删除,保留数据(确认是否保留数据)
func (*GlobalConf) RemoveDocker ¶
func (p *GlobalConf) RemoveDocker(containername string, all bool) bool
删除一个容器,强制关闭(请确认是否删除数据目录)
func (*GlobalConf) SetGlobalconfig ¶
func (p *GlobalConf) SetGlobalconfig(edit map[string]string) (*GlobalConf, error)
修改全局配置 只允许启动前修改,可支持的修改参数为:bootNodeStart,bootNodePort,bootNodeIP,coinBase,NetworkId,imageUrl,imageTag,DOCKER_API_VERSION,BootstrapNodes
func (*GlobalConf) StartContainerSingle ¶
func (p *GlobalConf) StartContainerSingle(ID string) (*GlobalConf, error)
启动单个docker