config

package
v1.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONFIG_DIR_NAME         = ".hamster-provider"
	CONFIG_DEFAULT_FILENAME = "config"
	SWARM_KEY               = "/key/swarm/psk/1.0.0/\n/base16/\n55158d9b6b7e5a8e41aa8b34dd057ff1880e38348613d27ae194ad7c5b9670d7"
)

Variables

This section is empty.

Functions

func DefaultConfigDir

func DefaultConfigDir() string

func DefaultConfigPath

func DefaultConfigPath() string

Types

type ChainRegInfo

type ChainRegInfo struct {
	ResourceIndex   uint64 `json:"resourceIndex"`
	OrderIndex      uint64 `json:"orderIndex"`
	AgreementIndex  uint64 `json:"agreementIndex"`
	RenewOrderIndex uint64 `json:"renewOrderIndex"`
	Working         string `json:"working"`
	Price           uint64 `json:"price"`
	AccountAddress  string `json:"accountAddress"`
}

type Config

type Config struct {
	ApiPort      int          `json:"apiPort"`      // API port number
	Identity     Identity     `json:"identity"`     // p2p id
	Keys         []PublicKey  `json:"keys"`         // public key list
	Bootstraps   []string     `json:"bootstraps"`   // local nodes's bootstrap peer addresses
	LinkApi      string       `json:"linkApi"`      // centralized reporting address
	ChainApi     string       `json:"chainApi"`     // blockchain address
	SeedOrPhrase string       `json:"seedOrPhrase"` // blockchain account seed or mnemonic
	Vm           VmOption     `json:"vm"`           // theoretical environment config
	ChainRegInfo ChainRegInfo `json:"chainRegInfo"` // chain registration information
	ConfigFlag   ConfigFlag   `json:"configFlag"`
}

Config config parameter

type ConfigFlag added in v1.1.0

type ConfigFlag string
const DONE ConfigFlag = "done"
const NONE ConfigFlag = "none"

type ConfigManager

type ConfigManager struct {
	// contains filtered or unexported fields
}

func NewConfigManager

func NewConfigManager() *ConfigManager

func NewConfigManagerWithPath

func NewConfigManagerWithPath(path string) *ConfigManager

func (*ConfigManager) AddBootstrap

func (cm *ConfigManager) AddBootstrap(bootstrap string) error

func (*ConfigManager) ConfigVM

func (cm *ConfigManager) ConfigVM(vmOption VmOption) error

ConfigVM Configure

func (*ConfigManager) GetConfig

func (cm *ConfigManager) GetConfig() (*Config, error)

func (*ConfigManager) RemoveBootstrap

func (cm *ConfigManager) RemoveBootstrap(bootstrap string) error

func (*ConfigManager) Save

func (cm *ConfigManager) Save(config *Config) error

type Identity

type Identity struct {
	PeerID   string
	PrivKey  string `json:",omitempty"`
	SwarmKey string `json:"swarm_key"`
}

Identity p2p identity token structure

func CreateIdentity

func CreateIdentity() (Identity, error)

type PublicKey

type PublicKey struct {
	Key string `json:"key"`
}

PublicKey public key information

type VmOption

type VmOption struct {
	Cpu        uint64 `json:"cpu"`
	Mem        uint64 `json:"mem"`
	Disk       uint64 `json:"disk"`
	System     string `json:"system"`
	Image      string `json:"image"`
	AccessPort int    `json:"accessPort"`
	// virtualization type,docker/kvm
	Type string `json:"type"`
}

VmOption vm configuration information

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL