{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v2.0.0-alpha+incompatible","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package common\n\nCopyright IBM Corp. 2016-2017 All Rights Reserved.\n\nSPDX-License-Identifier: Apache-2.0\n\nCopyright IBM Corp. 2016-2017 All Rights Reserved.\n\nSPDX-License-Identifier: Apache-2.0\n\n## Constants\n\n```go\nconst CmdRoot = \"core\"\n```\n\n```go\nconst UndefinedParamValue = \"\"\n```\nUndefinedParamValue defines what undefined parameters in the command line will initialise to\n\n## Variables\n\n```go\nvar (\n\n\t// GetEndorserClientFnc is a function that returns a new endorser client connection\n\t// to the provided peer address using the TLS root cert file,\n\t// by default it is set to GetEndorserClient function\n\tGetEndorserClientFnc func(address, tlsRootCertFile string) (pb.EndorserClient, error)\n\n\t// GetPeerDeliverClientFnc is a function that returns a new deliver client connection\n\t// to the provided peer address using the TLS root cert file,\n\t// by default it is set to GetDeliverClient function\n\tGetPeerDeliverClientFnc func(address, tlsRootCertFile string) (pb.DeliverClient, error)\n\n\t// GetDeliverClientFnc is a function that returns a new deliver client connection\n\t// to the provided peer address using the TLS root cert file,\n\t// by default it is set to GetDeliverClient function\n\tGetDeliverClientFnc func(address, tlsRootCertFile string) (pb.Deliver_DeliverClient, error)\n\n\t// GetDefaultSignerFnc is a function that returns a default Signer(Default/PERR)\n\t// by default it is set to GetDefaultSigner function\n\tGetDefaultSignerFnc func() (msp.SigningIdentity, error)\n\n\t// GetBroadcastClientFnc returns an instance of the BroadcastClient interface\n\t// by default it is set to GetBroadcastClient function\n\tGetBroadcastClientFnc func() (BroadcastClient, error)\n\n\t// GetOrdererEndpointOfChainFnc returns orderer endpoints of given chain\n\t// by default it is set to GetOrdererEndpointOfChain function\n\tGetOrdererEndpointOfChainFnc func(chainID string, signer Signer,\n\t\tendorserClient pb.EndorserClient) ([]string, error)\n\n\t// GetCertificateFnc is a function that returns the client TLS certificate\n\tGetCertificateFnc func() (tls.Certificate, error)\n)\n```\n\n```go\nvar (\n\tOrderingEndpoint string\n)\n```\n\n## Functions\n\n```go\nfunc AddOrdererFlags(cmd *cobra.Command)\n```\nAddOrdererFlags adds flags for orderer-related commands\n\n```go\nfunc CheckLogLevel(level string) error\n```\nCheckLogLevel checks that a given log level string is valid\n\n```go\nfunc GetAdminClient() (pb.AdminClient, error)\n```\nGetAdminClient returns a new admin client.  The target address for the client is taken from the configuration setting \"peer.address\"\n\n```go\nfunc GetCertificate() (tls.Certificate, error)\n```\nGetCertificate returns the client's TLS certificate\n\n```go\nfunc GetDefaultSigner() (msp.SigningIdentity, error)\n```\nGetDefaultSigner return a default Signer(Default/PERR) for cli\n\n```go\nfunc GetDeliverClient(address, tlsRootCertFile string) (pb.Deliver_DeliverClient, error)\n```\nGetDeliverClient 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\"\n\n```go\nfunc GetEndorserClient(address, tlsRootCertFile string) (pb.EndorserClient, error)\n```\nGetEndorserClient 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\"\n\n```go\nfunc GetMockAdminClient(err error) pb.AdminClient\n```\n\n```go\nfunc GetMockEndorserClient(response *pb.ProposalResponse, err error) pb.EndorserClient\n```\nGetMockEndorserClient return a endorser client return specified ProposalResponse and err(nil or error)\n\n```go\nfunc GetOrdererEndpointOfChain(chainID string, signer Signer, endorserClient pb.EndorserClient) ([]string, error)\n```\nGetOrdererEndpointOfChain returns orderer endpoints of given chain\n\n```go\nfunc GetPeerDeliverClient(address, tlsRootCertFile string) (pb.DeliverClient, error)\n```\nGetPeerDeliverClient 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\"\n\n```go\nfunc InitCmd(cmd *cobra.Command, args []string)\n```\n\n```go\nfunc InitConfig(cmdRoot string) error\n```\nInitConfig initializes viper config\n\n```go\nfunc InitCrypto(mspMgrConfigDir, localMSPID, localMSPType string) error\n```\nInitCrypto initializes crypto for this peer\n\n```go\nfunc SetBCCSPKeystorePath()\n```\nSetBCCSPKeystorePath sets the file keystore path for the SW BCCSP provider to an absolute path relative to the config file\n\n```go\nfunc SetOrdererEnv(cmd *cobra.Command, args []string)\n```\nSetOrdererEnv adds orderer-specific settings to the global Viper environment\n\n## Types\n\n```go\ntype BroadcastClient interface {\n\t//Send data to orderer\n\tSend(env *cb.Envelope) error\n\tClose() error\n}\n```\n\n```go\nfunc GetBroadcastClient() (BroadcastClient, error)\n```\nGetBroadcastClient creates a simple instance of the BroadcastClient interface\n\n```go\nfunc GetMockBroadcastClient(err error) BroadcastClient\n```\n\n```go\ntype CAConfig struct {\n\tURL         string                 `yaml:\"url\"`\n\tHTTPOptions map[string]interface{} `yaml:\"httpOptions\"`\n\tTLSCACerts  MutualTLSConfig        `yaml:\"tlsCACerts\"`\n\tRegistrar   EnrollCredentials      `yaml:\"registrar\"`\n\tCaName      string                 `yaml:\"caName\"`\n}\n```\nCAConfig defines a CA configuration not currently used by CLI\n\n```go\ntype CCType struct {\n\tPath string `yaml:\"path\"`\n}\n```\nCCType - not currently used by CLI\n\n```go\ntype ChannelNetworkConfig struct {\n\t// Orderers list of ordering service nodes\n\tOrderers []string `yaml:\"orderers\"`\n\t// Peers a list of peer-channels that are part of this organization\n\t// to get the real Peer config object, use the Name field and fetch NetworkConfig.Peers[Name]\n\tPeers map[string]PeerChannelConfig `yaml:\"peers\"`\n\t// Chaincodes list of services\n\tChaincodes []string `yaml:\"chaincodes\"`\n}\n```\nChannelNetworkConfig provides the definition of channels for the network\n\n```go\ntype ClientConfig struct {\n\tOrganization    string              `yaml:\"organization\"`\n\tLogging         LoggingType         `yaml:\"logging\"`\n\tCryptoConfig    CCType              `yaml:\"cryptoconfig\"`\n\tTLS             TLSType             `yaml:\"tls\"`\n\tCredentialStore CredentialStoreType `yaml:\"credentialStore\"`\n}\n```\nClientConfig - not currently used by CLI\n\n```go\ntype CredentialStoreType struct {\n\tPath        string `yaml:\"path\"`\n\tCryptoStore struct {\n\t\tPath string `yaml:\"path\"`\n\t}\n\tWallet string `yaml:\"wallet\"`\n}\n```\nCredentialStoreType - not currently used by CLI\n\n```go\ntype DeliverClient struct {\n\tSigner      identity.SignerSerializer\n\tService     ab.AtomicBroadcast_DeliverClient\n\tChannelID   string\n\tTLSCertHash []byte\n}\n```\nDeliverClient holds the necessary information to connect a client to an orderer/peer deliver service\n\n```go\nfunc NewDeliverClientForOrderer(channelID string, signer identity.SignerSerializer) (*DeliverClient, error)\n```\nNewDeliverClientForOrderer creates a new DeliverClient from an OrdererClient\n\n```go\nfunc NewDeliverClientForPeer(channelID string, signer identity.SignerSerializer) (*DeliverClient, error)\n```\nNewDeliverClientForPeer creates a new DeliverClient from a PeerClient\n\n```go\nfunc (d *DeliverClient) Close() error\n```\nClose closes a deliver client's connection\n\n```go\nfunc (d *DeliverClient) GetNewestBlock() (*cb.Block, error)\n```\nGetNewestBlock gets the newest block from a peer/orderer's deliver service\n\n```go\nfunc (d *DeliverClient) GetOldestBlock() (*cb.Block, error)\n```\nGetOldestBlock gets the oldest block from a peer/orderer's deliver service\n\n```go\nfunc (d *DeliverClient) GetSpecifiedBlock(num uint64) (*cb.Block, error)\n```\nGetSpecifiedBlock gets the specified block from a peer/orderer's deliver service\n\n```go\ntype EnrollCredentials struct {\n\tEnrollID     string `yaml:\"enrollId\"`\n\tEnrollSecret string `yaml:\"enrollSecret\"`\n}\n```\nEnrollCredentials holds credentials used for enrollment not currently used by CLI\n\n```go\ntype LoggingType struct {\n\tLevel string `yaml:\"level\"`\n}\n```\nLoggingType not currently used by CLI\n\n```go\ntype MutualTLSConfig struct {\n\tPem []string `yaml:\"pem\"`\n\n\t// Certfiles root certificates for TLS validation (Comma separated path list)\n\tPath string `yaml:\"path\"`\n\n\t//Client TLS information\n\tClient TLSKeyPair `yaml:\"client\"`\n}\n```\nMutualTLSConfig Mutual TLS configurations not currently used by CLI\n\n```go\ntype NetworkConfig struct {\n\tName                   string                          `yaml:\"name\"`\n\tXtype                  string                          `yaml:\"x-type\"`\n\tDescription            string                          `yaml:\"description\"`\n\tVersion                string                          `yaml:\"version\"`\n\tChannels               map[string]ChannelNetworkConfig `yaml:\"channels\"`\n\tOrganizations          map[string]OrganizationConfig   `yaml:\"organizations\"`\n\tPeers                  map[string]PeerConfig           `yaml:\"peers\"`\n\tClient                 ClientConfig                    `yaml:\"client\"`\n\tOrderers               map[string]OrdererConfig        `yaml:\"orderers\"`\n\tCertificateAuthorities map[string]CAConfig             `yaml:\"certificateAuthorities\"`\n}\n```\nNetworkConfig provides a static definition of a Hyperledger Fabric network\n\n```go\nfunc GetConfig(fileName string) (*NetworkConfig, error)\n```\nGetConfig unmarshals the provided connection profile into a network configuration struct\n\n```go\ntype OrdererClient struct {\n\t// contains filtered or unexported fields\n}\n```\nOrdererClient represents a client for communicating with an ordering service\n\n```go\nfunc NewOrdererClientFromEnv() (*OrdererClient, error)\n```\nNewOrdererClientFromEnv creates an instance of an OrdererClient from the global Viper instance\n\n```go\nfunc (oc *OrdererClient) Broadcast() (ab.AtomicBroadcast_BroadcastClient, error)\n```\nBroadcast returns a broadcast client for the AtomicBroadcast service\n\n```go\nfunc (oc *OrdererClient) Certificate() tls.Certificate\n```\nCertificate returns the TLS client certificate (if available)\n\n```go\nfunc (oc *OrdererClient) Deliver() (ab.AtomicBroadcast_DeliverClient, error)\n```\nDeliver returns a deliver client for the AtomicBroadcast service\n\n```go\ntype OrdererConfig struct {\n\tURL         string                 `yaml:\"url\"`\n\tGrpcOptions map[string]interface{} `yaml:\"grpcOptions\"`\n\tTLSCACerts  TLSConfig              `yaml:\"tlsCACerts\"`\n}\n```\nOrdererConfig defines an orderer configuration not currently used by CLI\n\n```go\ntype OrganizationConfig struct {\n\tMspID                  string    `yaml:\"mspid\"`\n\tPeers                  []string  `yaml:\"peers\"`\n\tCryptoPath             string    `yaml:\"cryptoPath\"`\n\tCertificateAuthorities []string  `yaml:\"certificateAuthorities\"`\n\tAdminPrivateKey        TLSConfig `yaml:\"adminPrivateKey\"`\n\tSignedCert             TLSConfig `yaml:\"signedCert\"`\n}\n```\nOrganizationConfig provides the definition of an organization in the network not currently used by CLI\n\n```go\ntype PeerChannelConfig struct {\n\tEndorsingPeer  bool `yaml:\"endorsingPeer\"`\n\tChaincodeQuery bool `yaml:\"chaincodeQuery\"`\n\tLedgerQuery    bool `yaml:\"ledgerQuery\"`\n\tEventSource    bool `yaml:\"eventSource\"`\n}\n```\nPeerChannelConfig defines the peer capabilities\n\n```go\ntype PeerClient struct {\n\t// contains filtered or unexported fields\n}\n```\nPeerClient represents a client for communicating with a peer\n\n```go\nfunc NewPeerClientForAddress(address, tlsRootCertFile string) (*PeerClient, error)\n```\nNewPeerClientForAddress creates an instance of a PeerClient using the provided peer address and, if TLS is enabled, the TLS root cert file\n\n```go\nfunc NewPeerClientFromEnv() (*PeerClient, error)\n```\nNewPeerClientFromEnv creates an instance of a PeerClient from the global Viper instance\n\n```go\nfunc (pc *PeerClient) Admin() (pb.AdminClient, error)\n```\nAdmin returns a client for the Admin service\n\n```go\nfunc (pc *PeerClient) Certificate() tls.Certificate\n```\nCertificate returns the TLS client certificate (if available)\n\n```go\nfunc (pc *PeerClient) Deliver() (pb.Deliver_DeliverClient, error)\n```\nDeliver returns a client for the Deliver service\n\n```go\nfunc (pc *PeerClient) Endorser() (pb.EndorserClient, error)\n```\nEndorser returns a client for the Endorser service\n\n```go\nfunc (pc *PeerClient) PeerDeliver() (pb.DeliverClient, error)\n```\nPeerDeliver returns a client for the Deliver service for peer-specific use cases (i.e. DeliverFiltered)\n\n```go\ntype PeerConfig struct {\n\tURL         string                 `yaml:\"url\"`\n\tEventURL    string                 `yaml:\"eventUrl\"`\n\tGRPCOptions map[string]interface{} `yaml:\"grpcOptions\"`\n\tTLSCACerts  TLSConfig              `yaml:\"tlsCACerts\"`\n}\n```\nPeerConfig defines a peer configuration\n\n```go\ntype Signer interface {\n\tSign(msg []byte) ([]byte, error)\n\tSerialize() ([]byte, error)\n}\n```\nSigner defines the interface needed for signing messages\n\n```go\ntype TLSConfig struct {\n\t// the following two fields are interchangeable.\n\t// If Path is available, then it will be used to load the cert\n\t// if Pem is available, then it has the raw data of the cert it will be used as-is\n\t// Certificate root certificate path\n\tPath string `yaml:\"path\"`\n\t// Certificate actual content\n\tPem string `yaml:\"pem\"`\n}\n```\nTLSConfig TLS configurations\n\n```go\ntype TLSKeyPair struct {\n\tKey  TLSConfig `yaml:\"key\"`\n\tCert TLSConfig `yaml:\"cert\"`\n}\n```\nTLSKeyPair contains the private key and certificate for TLS encryption not currently used by CLI\n\n```go\ntype TLSType struct {\n\tEnabled bool `yaml:\"enabled\"`\n}\n```\nTLSType - not currently used by CLI\n\n","path":"github.com/eric-erki/https-hyperledger.org/internal/peer/common","name":"common","synopsis":"","isRedistributable":true}
