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
- Variables
- func AddOrdererFlags(cmd *cobra.Command)
- func CheckLogLevel(level string) error
- func GetAdminClient() (pb.AdminClient, error)
- func GetCertificate() (tls.Certificate, error)
- func GetDefaultSigner() (msp.SigningIdentity, error)
- func GetDeliverClient(address, tlsRootCertFile string) (pb.Deliver_DeliverClient, error)
- func GetEndorserClient(address, tlsRootCertFile string) (pb.EndorserClient, error)
- func GetMockAdminClient(err error) pb.AdminClient
- func GetMockEndorserClient(response *pb.ProposalResponse, err error) pb.EndorserClient
- func GetOrdererEndpointOfChain(chainID string, signer msp.SigningIdentity, endorserClient pb.EndorserClient) ([]string, error)
- func GetPeerDeliverClient(address, tlsRootCertFile string) (api.PeerDeliverClient, error)
- func InitCmd(cmd *cobra.Command, args []string)
- func InitConfig(cmdRoot string) error
- func InitCrypto(mspMgrConfigDir, localMSPID, localMSPType string) error
- func SetBCCSPKeystorePath()
- func SetOrdererEnv(cmd *cobra.Command, args []string)
- type BroadcastClient
- type CAConfig
- type CCType
- type ChannelNetworkConfig
- type ClientConfig
- type CredentialStoreType
- type DeliverClient
- type EnrollCredentials
- type LoggingType
- type MutualTLSConfig
- type NetworkConfig
- type OrdererClient
- type OrdererConfig
- type OrganizationConfig
- type PeerChannelConfig
- type PeerClient
- type PeerConfig
- type PeerDeliverClient
- type TLSConfig
- type TLSKeyPair
- type TLSType
Constants ¶
const CmdRoot = "core"
const UndefinedParamValue = ""
UndefinedParamValue defines what undefined parameters in the command line will initialise to
Variables ¶
var ( // GetEndorserClientFnc is a function that returns a new endorser client connection // to the provided peer address using the TLS root cert file, // by default it is set to GetEndorserClient function GetEndorserClientFnc func(address, tlsRootCertFile string) (pb.EndorserClient, error) // GetPeerDeliverClientFnc is a function that returns a new deliver client connection // to the provided peer address using the TLS root cert file, // by default it is set to GetDeliverClient function GetPeerDeliverClientFnc func(address, tlsRootCertFile string) (api.PeerDeliverClient, error) // GetDeliverClientFnc is a function that returns a new deliver client connection // to the provided peer address using the TLS root cert file, // by default it is set to GetDeliverClient function GetDeliverClientFnc func(address, tlsRootCertFile string) (pb.Deliver_DeliverClient, error) // GetDefaultSignerFnc is a function that returns a default Signer(Default/PERR) // by default it is set to GetDefaultSigner function GetDefaultSignerFnc func() (msp.SigningIdentity, error) // GetBroadcastClientFnc returns an instance of the BroadcastClient interface // by default it is set to GetBroadcastClient function GetBroadcastClientFnc func() (BroadcastClient, error) // GetOrdererEndpointOfChainFnc returns orderer endpoints of given chain // by default it is set to GetOrdererEndpointOfChain function GetOrdererEndpointOfChainFnc func(chainID string, signer msp.SigningIdentity, endorserClient pb.EndorserClient) ([]string, error) // GetCertificateFnc is a function that returns the client TLS certificate GetCertificateFnc func() (tls.Certificate, error) )
var (
OrderingEndpoint string
)
Functions ¶
func AddOrdererFlags ¶ added in v1.1.0
AddOrdererFlags adds flags for orderer-related commands
func CheckLogLevel ¶
CheckLogLevel checks that a given log level string is valid
func GetAdminClient ¶
func GetAdminClient() (pb.AdminClient, error)
GetAdminClient returns a new admin client. The target address for the client is taken from the configuration setting "peer.address"
func GetCertificate ¶ added in v1.2.0
func GetCertificate() (tls.Certificate, error)
GetCertificate returns the client's TLS certificate
func GetDefaultSigner ¶
func GetDefaultSigner() (msp.SigningIdentity, error)
GetDefaultSigner return a default Signer(Default/PERR) for cli
func GetDeliverClient ¶ added in v1.2.0
func GetDeliverClient(address, tlsRootCertFile string) (pb.Deliver_DeliverClient, error)
GetDeliverClient returns a new deliver client. If both the address and tlsRootCertFile are not provided, the target values for the client are taken from the configuration settings for "peer.address" and "peer.tls.rootcert.file"
func GetEndorserClient ¶
func GetEndorserClient(address, tlsRootCertFile string) (pb.EndorserClient, error)
GetEndorserClient returns a new endorser client. If the both the address and tlsRootCertFile are not provided, the target values for the client are taken from the configuration settings for "peer.address" and "peer.tls.rootcert.file"
func GetMockAdminClient ¶
func GetMockAdminClient(err error) pb.AdminClient
func GetMockEndorserClient ¶
func GetMockEndorserClient(response *pb.ProposalResponse, err error) pb.EndorserClient
GetMockEndorserClient return a endorser client return specified ProposalResponse and err(nil or error)
func GetOrdererEndpointOfChain ¶
func GetOrdererEndpointOfChain(chainID string, signer msp.SigningIdentity, endorserClient pb.EndorserClient) ([]string, error)
GetOrdererEndpointOfChain returns orderer endpoints of given chain
func GetPeerDeliverClient ¶ added in v1.2.0
func GetPeerDeliverClient(address, tlsRootCertFile string) (api.PeerDeliverClient, error)
GetPeerDeliverClient returns a new deliver client. If both the address and tlsRootCertFile are not provided, the target values for the client are taken from the configuration settings for "peer.address" and "peer.tls.rootcert.file"
func InitCrypto ¶
InitCrypto initializes crypto for this peer
func SetBCCSPKeystorePath ¶ added in v1.1.0
func SetBCCSPKeystorePath()
SetBCCSPKeystorePath sets the file keystore path for the SW BCCSP provider to an absolute path relative to the config file
func SetOrdererEnv ¶ added in v1.1.0
SetOrdererEnv adds orderer-specific settings to the global Viper environment
Types ¶
type BroadcastClient ¶
type BroadcastClient interface { //Send data to orderer Send(env *cb.Envelope) error Close() error }
func GetBroadcastClient ¶
func GetBroadcastClient() (BroadcastClient, error)
GetBroadcastClient creates a simple instance of the BroadcastClient interface
func GetMockBroadcastClient ¶
func GetMockBroadcastClient(err error) BroadcastClient
type CAConfig ¶ added in v1.2.0
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"` }
CAConfig defines a CA configuration not currently used by CLI
type CCType ¶ added in v1.2.0
type CCType struct {
Path string `yaml:"path"`
}
CCType - not currently used by CLI
type ChannelNetworkConfig ¶ added in v1.2.0
type ChannelNetworkConfig struct { // Orderers list of ordering service nodes Orderers []string `yaml:"orderers"` // Peers a list of peer-channels that are part of this organization // to get the real Peer config object, use the Name field and fetch NetworkConfig.Peers[Name] Peers map[string]PeerChannelConfig `yaml:"peers"` // Chaincodes list of services Chaincodes []string `yaml:"chaincodes"` }
ChannelNetworkConfig provides the definition of channels for the network
type ClientConfig ¶ added in v1.2.0
type ClientConfig struct { Organization string `yaml:"organization"` Logging LoggingType `yaml:"logging"` CryptoConfig CCType `yaml:"cryptoconfig"` TLS TLSType `yaml:"tls"` CredentialStore CredentialStoreType `yaml:"credentialStore"` }
ClientConfig - not currently used by CLI
type CredentialStoreType ¶ added in v1.2.0
type CredentialStoreType struct { Path string `yaml:"path"` CryptoStore struct { Path string `yaml:"path"` } Wallet string `yaml:"wallet"` }
CredentialStoreType - not currently used by CLI
type DeliverClient ¶ added in v1.2.0
type DeliverClient struct { Service api.DeliverService ChannelID string TLSCertHash []byte BestEffort bool }
DeliverClient holds the necessary information to connect a client to an orderer/peer deliver service
func NewDeliverClientForOrderer ¶ added in v1.2.0
func NewDeliverClientForOrderer(channelID string, bestEffort bool) (*DeliverClient, error)
NewDeliverClientForOrderer creates a new DeliverClient from an OrdererClient
func NewDeliverClientForPeer ¶ added in v1.2.0
func NewDeliverClientForPeer(channelID string, bestEffort bool) (*DeliverClient, error)
NewDeliverClientForPeer creates a new DeliverClient from a PeerClient
func (*DeliverClient) Close ¶ added in v1.2.0
func (d *DeliverClient) Close() error
Close closes a deliver client's connection
func (*DeliverClient) GetNewestBlock ¶ added in v1.2.0
func (d *DeliverClient) GetNewestBlock() (*cb.Block, error)
GetNewestBlock gets the newest block from a peer/orderer's deliver service
func (*DeliverClient) GetOldestBlock ¶ added in v1.2.0
func (d *DeliverClient) GetOldestBlock() (*cb.Block, error)
GetOldestBlock gets the oldest block from a peer/orderer's deliver service
func (*DeliverClient) GetSpecifiedBlock ¶ added in v1.2.0
func (d *DeliverClient) GetSpecifiedBlock(num uint64) (*cb.Block, error)
GetSpecifiedBlock gets the specified block from a peer/orderer's deliver service
type EnrollCredentials ¶ added in v1.2.0
type EnrollCredentials struct { EnrollID string `yaml:"enrollId"` EnrollSecret string `yaml:"enrollSecret"` }
EnrollCredentials holds credentials used for enrollment not currently used by CLI
type LoggingType ¶ added in v1.2.0
type LoggingType struct {
Level string `yaml:"level"`
}
LoggingType not currently used by CLI
type MutualTLSConfig ¶ added in v1.2.0
type MutualTLSConfig struct { Pem []string `yaml:"pem"` // Certfiles root certificates for TLS validation (Comma separated path list) Path string `yaml:"path"` //Client TLS information Client TLSKeyPair `yaml:"client"` }
MutualTLSConfig Mutual TLS configurations not currently used by CLI
type NetworkConfig ¶ added in v1.2.0
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"` }
NetworkConfig provides a static definition of a Hyperledger Fabric network
func GetConfig ¶ added in v1.2.0
func GetConfig(fileName string) (*NetworkConfig, error)
GetConfig unmarshals the provided connection profile into a network configuration struct
type OrdererClient ¶ added in v1.1.0
type OrdererClient struct {
// contains filtered or unexported fields
}
OrdererClient represents a client for communicating with an ordering service
func NewOrdererClientFromEnv ¶ added in v1.1.0
func NewOrdererClientFromEnv() (*OrdererClient, error)
NewOrdererClientFromEnv creates an instance of an OrdererClient from the global Viper instance
func (*OrdererClient) Broadcast ¶ added in v1.1.0
func (oc *OrdererClient) Broadcast() (ab.AtomicBroadcast_BroadcastClient, error)
Broadcast returns a broadcast client for the AtomicBroadcast service
func (*OrdererClient) Certificate ¶ added in v1.1.0
func (oc *OrdererClient) Certificate() tls.Certificate
Certificate returns the TLS client certificate (if available)
func (*OrdererClient) Deliver ¶ added in v1.1.0
func (oc *OrdererClient) Deliver() (ab.AtomicBroadcast_DeliverClient, error)
Deliver returns a deliver client for the AtomicBroadcast service
type OrdererConfig ¶ added in v1.2.0
type OrdererConfig struct { URL string `yaml:"url"` GrpcOptions map[string]interface{} `yaml:"grpcOptions"` TLSCACerts TLSConfig `yaml:"tlsCACerts"` }
OrdererConfig defines an orderer configuration not currently used by CLI
type OrganizationConfig ¶ added in v1.2.0
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"` }
OrganizationConfig provides the definition of an organization in the network not currently used by CLI
type PeerChannelConfig ¶ added in v1.2.0
type PeerChannelConfig struct { EndorsingPeer bool `yaml:"endorsingPeer"` ChaincodeQuery bool `yaml:"chaincodeQuery"` LedgerQuery bool `yaml:"ledgerQuery"` EventSource bool `yaml:"eventSource"` }
PeerChannelConfig defines the peer capabilities
type PeerClient ¶ added in v1.1.0
type PeerClient struct {
// contains filtered or unexported fields
}
PeerClient represents a client for communicating with a peer
func NewPeerClientForAddress ¶ added in v1.2.0
func NewPeerClientForAddress(address, tlsRootCertFile string) (*PeerClient, error)
NewPeerClientForAddress creates an instance of a PeerClient using the provided peer address and, if TLS is enabled, the TLS root cert file
func NewPeerClientFromEnv ¶ added in v1.1.0
func NewPeerClientFromEnv() (*PeerClient, error)
NewPeerClientFromEnv creates an instance of a PeerClient from the global Viper instance
func (*PeerClient) Admin ¶ added in v1.1.0
func (pc *PeerClient) Admin() (pb.AdminClient, error)
Admin returns a client for the Admin service
func (*PeerClient) Certificate ¶ added in v1.2.0
func (pc *PeerClient) Certificate() tls.Certificate
Certificate returns the TLS client certificate (if available)
func (*PeerClient) Deliver ¶ added in v1.2.0
func (pc *PeerClient) Deliver() (pb.Deliver_DeliverClient, error)
Deliver returns a client for the Deliver service
func (*PeerClient) Endorser ¶ added in v1.1.0
func (pc *PeerClient) Endorser() (pb.EndorserClient, error)
Endorser returns a client for the Endorser service
func (*PeerClient) PeerDeliver ¶ added in v1.2.0
func (pc *PeerClient) PeerDeliver() (api.PeerDeliverClient, error)
PeerDeliver returns a client for the Deliver service for peer-specific use cases (i.e. DeliverFiltered)
type PeerConfig ¶ added in v1.2.0
type PeerConfig struct { URL string `yaml:"url"` EventURL string `yaml:"eventUrl"` GRPCOptions map[string]interface{} `yaml:"grpcOptions"` TLSCACerts TLSConfig `yaml:"tlsCACerts"` }
PeerConfig defines a peer configuration
type PeerDeliverClient ¶ added in v1.2.0
type PeerDeliverClient struct {
Client pb.DeliverClient
}
PeerDeliverClient holds the necessary information to connect a client to a peer deliver service
func (PeerDeliverClient) Deliver ¶ added in v1.2.0
func (dc PeerDeliverClient) Deliver(ctx context.Context, opts ...grpc.CallOption) (ccapi.Deliver, error)
Deliver connects the client to the Deliver RPC
func (PeerDeliverClient) DeliverFiltered ¶ added in v1.2.0
func (dc PeerDeliverClient) DeliverFiltered(ctx context.Context, opts ...grpc.CallOption) (ccapi.Deliver, error)
DeliverFiltered connects the client to the DeliverFiltered RPC
type TLSConfig ¶ added in v1.2.0
type TLSConfig struct { // the following two fields are interchangeable. // If Path is available, then it will be used to load the cert // if Pem is available, then it has the raw data of the cert it will be used as-is // Certificate root certificate path Path string `yaml:"path"` // Certificate actual content Pem string `yaml:"pem"` }
TLSConfig TLS configurations
type TLSKeyPair ¶ added in v1.2.0
TLSKeyPair contains the private key and certificate for TLS encryption not currently used by CLI