repo

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// key name
	KeyName = "key.json"
	// API name
	APIName = "api"
)

Variables

This section is empty.

Functions

func AddrToPeerInfo

func AddrToPeerInfo(multiAddr string) (*peer.AddrInfo, error)

AddrToPeerInfo transfer addr to PeerInfo addr example: "/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64"

func GetAPI

func GetAPI(repoRoot string) (string, error)

func GetKeyPath

func GetKeyPath(repoRoot string) string

func GetStoragePath

func GetStoragePath(repoRoot string, subPath ...string) string

func Initialize

func Initialize(repoRoot string) error

func Initialized

func Initialized(repoRoot string) bool

func PathRoot

func PathRoot() (string, error)

func PathRootWithDefault

func PathRootWithDefault(path string) (string, error)

func ReadConfig

func ReadConfig(path, configType string, config interface{}) error

Types

type Cert

type Cert struct {
	Verify bool `toml:"verify" json:"verify"`
}

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"`
}

func DefaultConfig

func DefaultConfig() (*Config, error)

func UnmarshalConfig

func UnmarshalConfig(repoRoot string) (*Config, error)

func (*Config) Bytes

func (c *Config) Bytes() ([]byte, error)

type Gateway

type Gateway struct {
	AllowedOrigins []string `mapstructure:"allowed_origins"`
}

type Genesis

type Genesis struct {
	Addresses []string `json:"addresses" toml:"addresses"`
}

type Key

type Key struct {
	PID           string             `json:"pid"`
	Address       string             `json:"address"`
	PrivKey       crypto2.PrivateKey `json:"priv_key"`
	Libp2pPrivKey crypto.PrivKey
}

func LoadKey

func LoadKey(path string) (*Key, error)

type Log

type Log struct {
	Level        string    `toml:"level" json:"level"`
	Dir          string    `toml:"dir" json:"dir"`
	Filename     string    `toml:"filename" json:"filename"`
	ReportCaller bool      `mapstructure:"report_caller" json:"report_caller"`
	Module       LogModule `toml:"module" json:"module"`
}

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"`
}

type Monitor

type Monitor struct {
	Enable bool
}

type NetworkConfig

type NetworkConfig struct {
	ID         uint64
	N          uint64
	LocalAddr  string
	Nodes      []*NetworkNodes
	OtherNodes map[uint64]*peer.AddrInfo
}

type NetworkNodes

type NetworkNodes struct {
	ID   uint64
	Addr string
}

type Order

type Order struct {
	Plugin string `toml:"plugin" json:"plugin"`
}

type PProf

type PProf struct {
	Enable bool
}

type Port

type Port struct {
	Grpc    int64 `toml:"grpc" json:"grpc"`
	Gateway int64 `toml:"gateway" json:"gateway"`
	PProf   int64 `toml:"pprof" json:"pprof"`
	Monitor int64 `toml:"monitor" json:"monitor"`
}

type Repo

type Repo struct {
	Config        *Config
	NetworkConfig *NetworkConfig
	Genesis       *Genesis
	Key           *Key
	Certs         *Certs
}

func Load

func Load(repoRoot string) (*Repo, error)

type Txpool

type Txpool struct {
	BatchSize    int           `mapstructure:"batch_size" json:"batch_size"`
	BatchTimeout time.Duration `mapstructure:"batch_timeout" json:"batch_timeout"`
}

Jump to

Keyboard shortcuts

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