utils

package
v0.0.0-...-2b16687 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataPath = "DATA_PATH" // DataPath 项目工作目录 [template]

	K8sEnv            = "RAFT_K8S"               // K8S=true
	BrokerIDEnv       = "RAFT_BROKER_ID"         // BROKER_ID=1
	NodeAddrEnv       = "RAFT_NODE_ADDRESS"      // NODE_ADDRESS=example.com NODE_ADDRESS=127.0.0.1:19865:19877
	ClusterEnv        = "RAFT_CLUSTER"           // CLUSTER=1=127.0.0.1:19865:19877,2=127.0.0.2:19865:19877,3=127.0.0.3:19865:19877
	TimeHeartbeatEnv  = "RAFT_TIME_HEARTBEAT"    // raft心跳定时时间ms
	TimeCheckEnv      = "RAFT_TIME_CHECK"        // raft心跳定时检查超时时间ms
	TimeoutEnv        = "RAFT_TIMEOUT"           // raft心跳超时ms
	PortEnv           = "RAFT_PORT"              // raft服务开放端口号,默认19877
	LogDirEnv         = "RAFT_LOG_DIR"           // 日志文件目录
	LogFileMaxSizeEnv = "RAFT_LOG_FILE_MAX_SIZE" // 每个日志文件保存的最大尺寸 单位:M
	LogFileMaxAgeEnv  = "RAFT_LOG_FILE_MAX_AGE"  // 文件最多保存多少天
	LogUtcEnv         = "RAFT_LOG_UTC"           // CST & UTC 时间
	LogLevelEnv       = "RAFT_LOG_LEVEL"         // 日志级别(debugLevel/infoLevel/warnLevel/ErrorLevel/panicLevel/fatalLevel)
	LogProductionEnv  = "RAFT_LOG_PRODUCTION"    // 是否生产环境,在生产环境下控制台不会输出任何日志
)

环境变量

View Source
const Version string = "1.0"

Version 版本号

Variables

View Source
var (

	// RaftStatus 是否启用raft
	RaftStatus bool
	// LogFileDir 日志文件目录
	LogFileDir string
	// LogFileMaxSize 每个日志文件保存的最大尺寸 单位:M
	LogFileMaxSize int
	// LogFileMaxAge 文件最多保存多少天
	LogFileMaxAge int
	// LogUtc CST & UTC 时间
	LogUtc bool
	// LogLevel 日志级别(debugLevel/infoLevel/warnLevel/ErrorLevel/panicLevel/fatalLevel)
	LogLevel string
	// LogProduction 是否生产环境,在生产环境下控制台不会输出任何日志
	LogProduction bool
)

Functions

func CertNodeCAName

func CertNodeCAName(orgName, orgDomain, nodeName string) string

CertNodeCAName 组织下节点证书名称

func CertNodeCANameWithOutCert

func CertNodeCANameWithOutCert(orgName, orgDomain, nodeName string) string

CertNodeCANameWithOutCert 组织下节点证书名称

func CertOrgCaNameWithOutCert

func CertOrgCaNameWithOutCert(orgName, orgDomain string) string

CertOrgCaNameWithOutCert 组织下节点证书名称

func CertOrgTLSCaNameWithOutCert

func CertOrgTLSCaNameWithOutCert(orgName, orgDomain string) string

CertOrgTLSCaNameWithOutCert 组织下节点证书名称

func CertUserCAName

func CertUserCAName(orgName, orgDomain, userName string) string

CertUserCAName 组织下用户证书名称

func CertUserCANameWithOutCert

func CertUserCANameWithOutCert(orgName, orgDomain, userName string) string

CertUserCANameWithOutCert 组织下用户证书名称

func CertificateAuthorityClientCertFilePath

func CertificateAuthorityClientCertFilePath(leagueDomain, caName string) string

CertificateAuthorityClientCertFilePath CertificateAuthorityClientCertFilePath

func CertificateAuthorityClientKeyFilePath

func CertificateAuthorityClientKeyFilePath(leagueDomain, caName string) string

CertificateAuthorityClientKeyFilePath CertificateAuthorityClientKeyFilePath

func CertificateAuthorityFilePath

func CertificateAuthorityFilePath(leagueDomain, caName string) string

CertificateAuthorityFilePath CertificateAuthorityFilePath

func ChainCodePath

func ChainCodePath(leagueName, chainCodeName, version string) (source, path, zipPath string)

ChainCodePath code目录

func ChannelArtifactsPath

func ChannelArtifactsPath(leagueName string) string

ChannelArtifactsPath channel-artifacts目录

func ChannelTXFilePath

func ChannelTXFilePath(leagueName, channelName string) string

ChannelTXFilePath 通道tx文件路径

func ChannelUpdateTXFilePath

func ChannelUpdateTXFilePath(leagueName, channelName string) string

ChannelUpdateTXFilePath 通道tx文件路径

func CryptoConfigPath

func CryptoConfigPath(leagueName string) string

CryptoConfigPath crypto-config目录

func CryptoGenesisOrgMspPath

func CryptoGenesisOrgMspPath(leagueDomain, orgDomain, orgName string, isPeer bool) (mspPath string)

CryptoGenesisOrgMspPath CryptoGenesisOrgMspPath

func CryptoOrgAndNodePath

func CryptoOrgAndNodePath(leagueDomain, orgDomain, orgName, nodeName string, isPeer bool) (orgPath, nodePath string)

CryptoOrgAndNodePath 组织机构及其节点根目录

func CryptoOrgAndUserPath

func CryptoOrgAndUserPath(leagueDomain, orgDomain, orgName, username string, isPeer bool) (orgPath, userPath string)

CryptoOrgAndUserPath 组织机构及其用户根目录

func CryptoOrgPath

func CryptoOrgPath(leagueDomain, orgDomain, orgName string, isPeer bool) string

CryptoOrgPath 组织机构及其节点根目录

func GenesisBlock4AddFilePath

func GenesisBlock4AddFilePath(leagueName string) string

GenesisBlock4AddFilePath orderer.genesis.block路径

func GenesisBlockFilePath

func GenesisBlockFilePath(leagueName string) string

GenesisBlockFilePath orderer.genesis.block路径

func MspID

func MspID(orgName string) string

MspID 组织MspID

func ObtainDataPath

func ObtainDataPath() string

ObtainDataPath 项目工作目录

func RootOrgCACertFileName

func RootOrgCACertFileName(orgName, orgDomain string) string

RootOrgCACertFileName 指定联盟主域名的根证书文件名称

func RootOrgTLSCACertFileName

func RootOrgTLSCACertFileName(orgName, orgDomain string) string

RootOrgTLSCACertFileName 指定联盟主域名的根TLS证书文件名称

func RootTLSCACertFileName

func RootTLSCACertFileName(leagueDomain string) string

RootTLSCACertFileName 指定联盟主域名的根TLS证书文件名称

Types

type Resp

type Resp interface {
	Reset()
	GetErrMsg() string
}

Resp Resp

type RespImpl

type RespImpl struct {
	// 请求返回结果:success=0;fail=1
	Code int `json:"code,omitempty"`
	// 当且仅当返回码为1时,此处包含错误信息
	ErrMsg string `json:"errMsg,omitempty"`
}

RespImpl RespImpl

func (*RespImpl) Fail

func (r *RespImpl) Fail(errMsg string)

Fail Fail

func (*RespImpl) GetErrMsg

func (r *RespImpl) GetErrMsg() string

GetErrMsg GetErrMsg

func (*RespImpl) Reset

func (r *RespImpl) Reset()

Reset Reset

Jump to

Keyboard shortcuts

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