config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Queue define message queue service type, IP and port addresses.
	// Multiple addresses should be separated by comma.
	// Example:
	//     nats://192.168.1.100:4222,192.168.1.101:4222,192.168.1.102:4222
	// default:
	//	   local
	Queue string `yaml:"queue,omitempty"`

	// Prikey Cassini relay's private key
	Prikey string `yaml:"prikey,omitempty"`

	// Consensus setting the consensus for cassini
	// "no"    - no consensus
	// default - 2/3 consensus
	Consensus bool `yaml:"consensus,omitempty"`

	// EventWaitMillitime 交易事件被监听到后需要等待的事件,
	// <=0 不等待
	// >0 等待相应毫秒数
	EventWaitMillitime int64 `yaml:"eventWaitMillitime,omitempty"`

	// Mocks 所有需要Mock的服务配置
	Mocks []*MockConfig `yaml:"mocks,omitempty"`

	// Qscs 与relay连接的区块链相关配置
	Qscs []*QscConfig `yaml:"qscs,omitempty"`

	// UseEtcd Whether to use etcd or not
	UseEtcd bool `yaml:"useEtcd,omitempty"`

	// Lock config the lock
	//
	// "etcd://192.168.1.100:2379,192.168.1.101:2379,192.168.1.102:2379"
	Lock string `yaml:"lock,omitempty"`

	// LockTTL timeout for lock
	//
	// 5 - the lock will be auto-unlock with 5s when lose session
	LockTTL int64 `yaml:"lockTTL,omitempty"`

	// EmbedEtcd Whether to start embed etcd or not
	EmbedEtcd bool `yaml:"embedEtcd,omitempty"`

	// Etcd Embed-etcd config
	Etcd *EtcdConfig `yaml:"etcd,omitempty"`
}

Config wraps all configure data of cassini

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default configuration for a Tendermint node

func GetConfig

func GetConfig() *Config

GetConfig returns the config instance of cassini

func TestConfig

func TestConfig() *Config

TestConfig returns a configuration that can be used for testing

func (*Config) GetQscConfig

func (c *Config) GetQscConfig(chainID string) (qsc QscConfig)

GetQscConfig 获取指定 ChainID 的 QSC 配置

func (*Config) Load added in v0.1.0

func (c *Config) Load() (err error)

Load the configure file

func (*Config) Parse added in v0.1.0

func (c *Config) Parse(bytes []byte) error

Parse the configure file

type EtcdConfig added in v0.0.3

type EtcdConfig struct {

	// Name - human-readable name for this member.
	//
	// --name 'default'
	Name string `yaml:"name,omitempty"`

	// Listen - list of URLs to listen on for client traffic.
	//
	// --listen-client-urls 'http://localhost:2379'
	Listen string `yaml:"listen,omitempty"`

	// Advertise list of this member's client URLs to advertise to the public.
	// The client URLs advertised should be accessible to machines that talk to etcd cluster. etcd client libraries parse these URLs to connect to the cluster.
	//
	// --advertise-client-urls http://localhost:2379
	Advertise string `yaml:"advertise,omitempty"`

	// ListenPeer list of URLs to listen on for peer traffic.
	//
	// --listen-peer-urls http://localhost:2380
	ListenPeer string `yaml:"listenPeer,omitempty"`

	// AdvertisePeer list of this member's peer URLs to advertise to the rest of the cluster.
	//
	// --initial-advertise-peer-urls http://localhost:2380
	AdvertisePeer string `yaml:"advertisePeer,omitempty"`

	// ClusterToken initial cluster token for the etcd cluster during bootstrap.
	// Specifying this can protect you from unintended cross-cluster interaction when running multiple clusters.
	//
	// --initial-cluster-token etcd-cluster
	ClusterToken string `yaml:"clusterToken,omitempty"`

	// Cluster initial cluster configuration for bootstrapping.
	//
	// --initial-cluster 'default=http://localhost:2380'
	Cluster string `yaml:"cluster,omitempty"`
}

EtcdConfig Embed-etcd config

type MockConfig

type MockConfig struct {

	// Name 链名称,mock 时,交易事件的qcp.from
	Name string `yaml:"name,omitempty"`

	// To 目标链名称,mock 时,交易事件的qcp.to
	To string `yaml:"to,omitempty"`

	// Subscribe 交易事件订阅条件,为空时通过To 参数自动拼装
	Subscribe string `yaml:"subscribe,omitempty"`

	// Sequence 交易序列号
	Sequence int64 `yaml:"sequence,omitempty"`

	// RPC RPC相关配置
	RPC *RPCConfig `yaml:"rpc,omitempty"`
}

MockConfig 封装 Mock 配置数据

func TestQscMockConfig

func TestQscMockConfig() *MockConfig

TestQscMockConfig 创建Qsc Mock 测试配置

type QscConfig

type QscConfig struct {
	// Name 链名称
	Name string `yaml:"name,omitempty"`

	// Type 链类型
	Type string `yaml:"type,omitempty"`

	// Signature if need sign tx data for this chain
	// true - required
	// false/default - not required
	Signature bool `json:"signature,omitempty"`

	// Pubkey 链的公钥
	Pubkey string `json:"pubkey,omitempty"`

	// Certificate 链给relay颁发的证书文件
	Certificate string `json:"certificate,omitempty"`

	// Nodes 区块链节点地址,多个之间用“,”分割
	Nodes string `yaml:"nodes,omitempty"`
}

QscConfig qsc 配置封装

func DefaultQscConfig

func DefaultQscConfig() []*QscConfig

DefaultQscConfig 创建默认配置

func TestQscConfig

func TestQscConfig() []*QscConfig

TestQscConfig 创建测试配置

type RPCConfig

type RPCConfig struct {
	// 监听地址端口
	NodeAddress string `yaml:"nodes,omitempty"`
}

RPCConfig 相关配置

Jump to

Keyboard shortcuts

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