common

package
v0.0.0-...-95b87ed Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Copyright IBM Corp. 2016-2017 All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. 2016-2017 All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const CmdRoot = "core"
View Source
const UndefinedParamValue = ""

Variables

View Source
var (
	GetEndorserClientFnc func(address, tlsRootCertFile string) (pb.EndorserClient, error)

	GetPeerDeliverClientFnc func(address, tlsRootCertFile string) (api.PeerDeliverClient, error)

	GetDeliverClientFnc func(address, tlsRootCertFile string) (pb.Deliver_DeliverClient, error)

	GetDefaultSignerFnc func() (msp.SigningIdentity, error)

	GetBroadcastClientFnc func() (BroadcastClient, error)

	GetOrdererEndpointOfChainFnc func(chainID string, signer msp.SigningIdentity,
		endorserClient pb.EndorserClient) ([]string, error)

	GetCertificateFnc func() (tls.Certificate, error)
)
View Source
var (
	OrderingEndpoint string
)

Functions

func AddOrdererFlags

func AddOrdererFlags(cmd *cobra.Command)

func CheckLogLevel

func CheckLogLevel(level string) error

func GetAdminClient

func GetAdminClient() (pb.AdminClient, error)

func GetCertificate

func GetCertificate() (tls.Certificate, error)

func GetDefaultSigner

func GetDefaultSigner() (msp.SigningIdentity, error)

func GetDeliverClient

func GetDeliverClient(address, tlsRootCertFile string) (pb.Deliver_DeliverClient, error)

func GetEndorserClient

func GetEndorserClient(address, tlsRootCertFile string) (pb.EndorserClient, error)

func GetMockAdminClient

func GetMockAdminClient(err error) pb.AdminClient

func GetMockEndorserClient

func GetMockEndorserClient(response *pb.ProposalResponse, err error) pb.EndorserClient

func GetOrdererEndpointOfChain

func GetOrdererEndpointOfChain(chainID string, signer msp.SigningIdentity, endorserClient pb.EndorserClient) ([]string, error)

func GetPeerDeliverClient

func GetPeerDeliverClient(address, tlsRootCertFile string) (api.PeerDeliverClient, error)

func InitCmd

func InitCmd(cmd *cobra.Command, args []string)

func InitConfig

func InitConfig(cmdRoot string) error

func InitCrypto

func InitCrypto(mspMgrConfigDir, localMSPID, localMSPType string) error

func SetBCCSPKeystorePath

func SetBCCSPKeystorePath()

func SetOrdererEnv

func SetOrdererEnv(cmd *cobra.Command, args []string)

Types

type BroadcastClient

type BroadcastClient interface {
	Send(env *cb.Envelope) error
	Close() error
}

func GetBroadcastClient

func GetBroadcastClient() (BroadcastClient, error)

func GetMockBroadcastClient

func GetMockBroadcastClient(err error) BroadcastClient

type CAConfig

type CAConfig struct {
	URL         string                 `yaml:"url"`
	HTTPOptions map[string]interface{} `yaml:"httpOptions"`
	TLSCACerts  MutualTLSConfig        `yaml:"tlsCACerts"`
	Registrar   EnrollCredentials      `yaml:"registrar"`
	CaName      string                 `yaml:"caName"`
}

type CCType

type CCType struct {
	Path string `yaml:"path"`
}

type ChannelNetworkConfig

type ChannelNetworkConfig struct {
	Orderers []string `yaml:"orderers"`

	Peers map[string]PeerChannelConfig `yaml:"peers"`

	Chaincodes []string `yaml:"chaincodes"`
}

type ClientConfig

type ClientConfig struct {
	Organization    string              `yaml:"organization"`
	Logging         LoggingType         `yaml:"logging"`
	CryptoConfig    CCType              `yaml:"cryptoconfig"`
	TLS             TLSType             `yaml:"tls"`
	CredentialStore CredentialStoreType `yaml:"credentialStore"`
}

type CredentialStoreType

type CredentialStoreType struct {
	Path        string `yaml:"path"`
	CryptoStore struct {
		Path string `yaml:"path"`
	}
	Wallet string `yaml:"wallet"`
}

type DeliverClient

type DeliverClient struct {
	Service     api.DeliverService
	ChannelID   string
	TLSCertHash []byte
}

func NewDeliverClientForOrderer

func NewDeliverClientForOrderer(channelID string) (*DeliverClient, error)

func NewDeliverClientForPeer

func NewDeliverClientForPeer(channelID string) (*DeliverClient, error)

func (*DeliverClient) Close

func (d *DeliverClient) Close() error

func (*DeliverClient) GetNewestBlock

func (d *DeliverClient) GetNewestBlock() (*cb.Block, error)

func (*DeliverClient) GetOldestBlock

func (d *DeliverClient) GetOldestBlock() (*cb.Block, error)

func (*DeliverClient) GetSpecifiedBlock

func (d *DeliverClient) GetSpecifiedBlock(num uint64) (*cb.Block, error)

type EnrollCredentials

type EnrollCredentials struct {
	EnrollID     string `yaml:"enrollId"`
	EnrollSecret string `yaml:"enrollSecret"`
}

type LoggingType

type LoggingType struct {
	Level string `yaml:"level"`
}

type MutualTLSConfig

type MutualTLSConfig struct {
	Pem []string `yaml:"pem"`

	Path string `yaml:"path"`

	Client TLSKeyPair `yaml:"client"`
}

type NetworkConfig

type NetworkConfig struct {
	Name                   string                          `yaml:"name"`
	Xtype                  string                          `yaml:"x-type"`
	Description            string                          `yaml:"description"`
	Version                string                          `yaml:"version"`
	Channels               map[string]ChannelNetworkConfig `yaml:"channels"`
	Organizations          map[string]OrganizationConfig   `yaml:"organizations"`
	Peers                  map[string]PeerConfig           `yaml:"peers"`
	Client                 ClientConfig                    `yaml:"client"`
	Orderers               map[string]OrdererConfig        `yaml:"orderers"`
	CertificateAuthorities map[string]CAConfig             `yaml:"certificateAuthorities"`
}

func GetConfig

func GetConfig(fileName string) (*NetworkConfig, error)

type OrdererClient

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

func NewOrdererClientFromEnv

func NewOrdererClientFromEnv() (*OrdererClient, error)

func (*OrdererClient) Broadcast

func (*OrdererClient) Certificate

func (oc *OrdererClient) Certificate() tls.Certificate

func (*OrdererClient) Deliver

type OrdererConfig

type OrdererConfig struct {
	URL         string                 `yaml:"url"`
	GrpcOptions map[string]interface{} `yaml:"grpcOptions"`
	TLSCACerts  TLSConfig              `yaml:"tlsCACerts"`
}

type OrganizationConfig

type OrganizationConfig struct {
	MspID                  string    `yaml:"mspid"`
	Peers                  []string  `yaml:"peers"`
	CryptoPath             string    `yaml:"cryptoPath"`
	CertificateAuthorities []string  `yaml:"certificateAuthorities"`
	AdminPrivateKey        TLSConfig `yaml:"adminPrivateKey"`
	SignedCert             TLSConfig `yaml:"signedCert"`
}

type PeerChannelConfig

type PeerChannelConfig struct {
	EndorsingPeer  bool `yaml:"endorsingPeer"`
	ChaincodeQuery bool `yaml:"chaincodeQuery"`
	LedgerQuery    bool `yaml:"ledgerQuery"`
	EventSource    bool `yaml:"eventSource"`
}

type PeerClient

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

func NewPeerClientForAddress

func NewPeerClientForAddress(address, tlsRootCertFile string) (*PeerClient, error)

func NewPeerClientFromEnv

func NewPeerClientFromEnv() (*PeerClient, error)

func (*PeerClient) Admin

func (pc *PeerClient) Admin() (pb.AdminClient, error)

func (*PeerClient) Certificate

func (pc *PeerClient) Certificate() tls.Certificate

func (*PeerClient) Deliver

func (pc *PeerClient) Deliver() (pb.Deliver_DeliverClient, error)

func (*PeerClient) Endorser

func (pc *PeerClient) Endorser() (pb.EndorserClient, error)

func (*PeerClient) PeerDeliver

func (pc *PeerClient) PeerDeliver() (api.PeerDeliverClient, error)

type PeerConfig

type PeerConfig struct {
	URL         string                 `yaml:"url"`
	EventURL    string                 `yaml:"eventUrl"`
	GRPCOptions map[string]interface{} `yaml:"grpcOptions"`
	TLSCACerts  TLSConfig              `yaml:"tlsCACerts"`
}

type PeerDeliverClient

type PeerDeliverClient struct {
	Client pb.DeliverClient
}

func (PeerDeliverClient) Deliver

func (dc PeerDeliverClient) Deliver(ctx context.Context, opts ...grpc.CallOption) (ccapi.Deliver, error)

func (PeerDeliverClient) DeliverFiltered

func (dc PeerDeliverClient) DeliverFiltered(ctx context.Context, opts ...grpc.CallOption) (ccapi.Deliver, error)

type TLSConfig

type TLSConfig struct {
	Path string `yaml:"path"`

	Pem string `yaml:"pem"`
}

type TLSKeyPair

type TLSKeyPair struct {
	Key  TLSConfig `yaml:"key"`
	Cert TLSConfig `yaml:"cert"`
}

type TLSType

type TLSType struct {
	Enabled bool `yaml:"enabled"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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