Versions in this module Expand all Collapse all v1 v1.2.0 Aug 30, 2023 Changes in this version + var TestBlock = &po.DeliverResponse + func CreateBlockWithCCEvent(events *pp.ChaincodeEvent, txID string, channelID string) (*common.Block, error) + func CreateBlockWithCCEventAndTxStatus(events *pp.ChaincodeEvent, txID string, channelID string, ...) (*common.Block, error) + func NewMockCAClient(orgName string, cryptoProvider core.CryptoSuite) (api.CAClient, error) + func NewMockCryptoConfig() core.CryptoSuiteConfig + func NewMockCryptoConfigCustomized(tlsEnabled, mutualTLSEnabled, errorCase bool) core.CryptoSuiteConfig + func NewMockEndpointConfig() fab.EndpointConfig + func NewMockEndpointConfigCustomized(tlsEnabled, mutualTLSEnabled, errorCase bool) fab.EndpointConfig + func NewMockIdentity(err error) (msp.Identity, error) + func NewMockIdentityConfig() msp.IdentityConfig + func NewMockIdentityConfigCustomized(tlsEnabled, mutualTLSEnabled, errorCase bool) msp.IdentityConfig + func NewMockIdentityManager(opts ...UsersOption) msp.IdentityManager + func NewMockSigningIdentity() (msp.SigningIdentity, error) + func NewMockTransactionHeader(channelID string) (fab.TransactionHeader, error) + func NewRwSet(ccID string) *rwsetutil.NsRwSet + func NewSimpleMockBlock() *common.Block + func NewSimpleMockError() error + type Channel struct + func NewMockChannel(channelID string) (*Channel, error) + func (c *Channel) ChannelID() string + func (c *Channel) ChannelService() fab.ChannelService + func (c *Channel) Providers() context.Client + type DeliverySession struct + Deliveries chan *common.Block + DeliveryErrors chan error + DeliveryQueue chan interface{} + func (s *DeliverySession) Close() + type LocalContext struct + func NewMockLocalContext(client *MockContext, discoveryProvider fab.LocalDiscoveryProvider) *LocalContext + func (c *LocalContext) LocalDiscoveryService() fab.DiscoveryService + type MockBroadcastServer struct + BroadcastCustomResponse *po.BroadcastResponse + BroadcastError error + BroadcastInternalServerError bool + Creds credentials.TransportCredentials + DeliverError error + DeliverResponse *po.DeliverResponse + Deliveries chan *common.Block + FilteredDeliveries chan *pb.FilteredBlock + func (m *MockBroadcastServer) Broadcast(server po.AtomicBroadcast_BroadcastServer) error + func (m *MockBroadcastServer) Deliver(server po.AtomicBroadcast_DeliverServer) error + func (m *MockBroadcastServer) Start(address string) string + func (m *MockBroadcastServer) Stop() + type MockCAClient struct + func (mgr *MockCAClient) AddAffiliation(request *api.AffiliationRequest) (*api.AffiliationResponse, error) + func (mgr *MockCAClient) CreateIdentity(request *api.IdentityRequest) (*api.IdentityResponse, error) + func (mgr *MockCAClient) Enroll(request *api.EnrollmentRequest) error + func (mgr *MockCAClient) GetAffiliation(affiliation, caname string) (*api.AffiliationResponse, error) + func (mgr *MockCAClient) GetAllAffiliations(caname string) (*api.AffiliationResponse, error) + func (mgr *MockCAClient) GetAllIdentities(caname string) ([]*api.IdentityResponse, error) + func (mgr *MockCAClient) GetCAInfo() (*api.GetCAInfoResponse, error) + func (mgr *MockCAClient) GetIdentity(id, caname string) (*api.IdentityResponse, error) + func (mgr *MockCAClient) ModifyAffiliation(request *api.ModifyAffiliationRequest) (*api.AffiliationResponse, error) + func (mgr *MockCAClient) ModifyIdentity(request *api.IdentityRequest) (*api.IdentityResponse, error) + func (mgr *MockCAClient) Reenroll(request *api.ReenrollmentRequest) error + func (mgr *MockCAClient) Register(request *api.RegistrationRequest) (string, error) + func (mgr *MockCAClient) RemoveAffiliation(request *api.AffiliationRequest) (*api.AffiliationResponse, error) + func (mgr *MockCAClient) RemoveIdentity(request *api.RemoveIdentityRequest) (*api.IdentityResponse, error) + func (mgr *MockCAClient) Revoke(request *api.RevocationRequest) (*api.RevocationResponse, error) + type MockChannelCfg struct + MockAnchorPeers []*fab.OrgAnchorPeer + MockBlockNumber uint64 + MockCapabilities map[fab.ConfigGroupKey]map[string]bool + MockID string + MockMSPs []*msp.MSPConfig + MockMembership fab.ChannelMembership + MockOrderers []string + MockVersions *fab.Versions + func NewMockChannelCfg(id string) *MockChannelCfg + func (cfg *MockChannelCfg) AnchorPeers() []*fab.OrgAnchorPeer + func (cfg *MockChannelCfg) BlockNumber() uint64 + func (cfg *MockChannelCfg) HasCapability(group fab.ConfigGroupKey, capability string) bool + func (cfg *MockChannelCfg) ID() string + func (cfg *MockChannelCfg) MSPs() []*msp.MSPConfig + func (cfg *MockChannelCfg) Orderers() []string + func (cfg *MockChannelCfg) Versions() *fab.Versions + type MockChannelConfig struct + func NewMockChannelConfig(ctx context.Client, channelID string) (*MockChannelConfig, error) + func (c *MockChannelConfig) Query(reqCtx reqContext.Context) (fab.ChannelCfg, error) + func (c *MockChannelConfig) QueryBlock(reqCtx reqContext.Context) (*common.Block, error) + type MockChannelContext struct + Channel fab.ChannelService + func NewMockChannelContext(context *MockContext, channelID string) *MockChannelContext + func (c *MockChannelContext) ChannelID() string + func (c *MockChannelContext) ChannelService() fab.ChannelService + func (c *MockChannelContext) GetMetrics() *metrics.ClientMetrics + type MockChannelProvider struct + func NewMockChannelProvider(ctx core.Providers) (*MockChannelProvider, error) + func (cp *MockChannelProvider) ChannelService(ctx fab.ClientContext, channelID string) (fab.ChannelService, error) + func (cp *MockChannelProvider) SetCustomChannelService(customChannelService fab.ChannelService) + type MockChannelService struct + func (cs *MockChannelService) ChannelConfig() (fab.ChannelCfg, error) + func (cs *MockChannelService) Config() (fab.ChannelConfig, error) + func (cs *MockChannelService) Discovery() (fab.DiscoveryService, error) + func (cs *MockChannelService) EventService(opts ...options.Opt) (fab.EventService, error) + func (cs *MockChannelService) Membership() (fab.ChannelMembership, error) + func (cs *MockChannelService) Selection() (fab.SelectionService, error) + func (cs *MockChannelService) SetCustomMembership(customMembership fab.ChannelMembership) + func (cs *MockChannelService) SetDiscovery(discovery fab.DiscoveryService) + func (cs *MockChannelService) SetOrderers(orderers []string) + func (cs *MockChannelService) SetSelection(selection fab.SelectionService) + func (cs *MockChannelService) SetTransactor(t fab.Transactor) + func (cs *MockChannelService) Transactor(reqCtx reqContext.Context) (fab.Transactor, error) + type MockConfig struct + CustomTLSCACertPool commtls.CertPool + func (c *MockConfig) CAClientCert(org string) ([]byte, bool) + func (c *MockConfig) CAClientKey(org string) ([]byte, bool) + func (c *MockConfig) CAConfig(org string) (*msp.CAConfig, bool) + func (c *MockConfig) CAKeyStorePath() string + func (c *MockConfig) CAServerCerts(org string) ([][]byte, bool) + func (c *MockConfig) ChannelConfig(channelID string) *fab.ChannelEndpointConfig + func (c *MockConfig) ChannelOrderers(name string) []fab.OrdererConfig + func (c *MockConfig) ChannelPeers(name string) []fab.ChannelPeer + func (c *MockConfig) Client() *msp.ClientConfig + func (c *MockConfig) CredentialStorePath() string + func (c *MockConfig) CryptoConfigPath() string + func (c *MockConfig) IsSecurityEnabled() bool + func (c *MockConfig) KeyStorePath() string + func (c *MockConfig) Lookup(key string) (interface{}, bool) + func (c *MockConfig) NetworkConfig() *fab.NetworkConfig + func (c *MockConfig) NetworkPeers() []fab.NetworkPeer + func (c *MockConfig) OrdererConfig(name string) (*fab.OrdererConfig, bool, bool) + func (c *MockConfig) OrderersConfig() []fab.OrdererConfig + func (c *MockConfig) PeerConfig(nameOrURL string) (*fab.PeerConfig, bool) + func (c *MockConfig) PeersConfig(org string) ([]fab.PeerConfig, bool) + func (c *MockConfig) SecurityAlgorithm() string + func (c *MockConfig) SecurityLevel() int + func (c *MockConfig) SecurityProvider() string + func (c *MockConfig) SecurityProviderLabel() string + func (c *MockConfig) SecurityProviderLibPath() string + func (c *MockConfig) SecurityProviderPin() string + func (c *MockConfig) SetCustomChannelConfig(channelID string, config *fab.ChannelEndpointConfig) + func (c *MockConfig) SetCustomNetworkPeerCfg(customNetworkPeerCfg []fab.NetworkPeer) + func (c *MockConfig) SetCustomOrdererCfg(customOrdererCfg *fab.OrdererConfig) + func (c *MockConfig) SetCustomPeerCfg(customPeerCfg *fab.PeerConfig) + func (c *MockConfig) SetCustomRandomOrdererCfg(customRandomOrdererCfg *fab.OrdererConfig) + func (c *MockConfig) SoftVerify() bool + func (c *MockConfig) TLSCACertPool() commtls.CertPool + func (c *MockConfig) TLSClientCerts() []tls.Certificate + func (c *MockConfig) TcertBatchSize() int + func (c *MockConfig) Timeout(arg fab.TimeoutType) time.Duration + type MockConfigBlockBuilder struct + Index uint64 + LastConfigIndex uint64 + func (b *MockConfigBlockBuilder) Build() *common.Block + type MockConfigGroupBuilder struct + ApplicationCapabilities []string + ChannelCapabilities []string + Groups map[string]*common.ConfigGroup + MSPNames []string + ModPolicy string + OrdererAddress string + OrdererCapabilities []string + PolicyRefs []string + RootCA string + Version uint64 + type MockConfigUpdateEnvelopeBuilder struct + ChannelID string + func (b *MockConfigUpdateEnvelopeBuilder) Build() *common.Envelope + func (b *MockConfigUpdateEnvelopeBuilder) BuildBytes() []byte + func (b *MockConfigUpdateEnvelopeBuilder) BuildConfigUpdateBytes() []byte + type MockContext struct + SigningIdentity msp.SigningIdentity + func NewMockContext(si msp.SigningIdentity) *MockContext + func (m MockContext) EnrollmentCertificate() []byte + func (m MockContext) Identifier() *msp.IdentityIdentifier + func (m MockContext) PrivateKey() core.Key + func (m MockContext) PublicVersion() msp.Identity + func (m MockContext) Serialize() ([]byte, error) + func (m MockContext) Sign(msg []byte) ([]byte, error) + func (m MockContext) Verify(msg []byte, sig []byte) error + type MockCryptoSuite struct + func (m *MockCryptoSuite) GetHash(opts core.HashOpts) (hash.Hash, error) + func (m *MockCryptoSuite) GetKey(ski []byte) (k core.Key, err error) + func (m *MockCryptoSuite) Hash(msg []byte, opts core.HashOpts) (hash []byte, err error) + func (m *MockCryptoSuite) KeyGen(opts core.KeyGenOpts) (k core.Key, err error) + func (m *MockCryptoSuite) KeyImport(raw interface{}, opts core.KeyImportOpts) (k core.Key, err error) + func (m *MockCryptoSuite) Sign(k core.Key, digest []byte, opts core.SignerOpts) (signature []byte, err error) + func (m *MockCryptoSuite) Verify(k core.Key, signature, digest []byte, opts core.SignerOpts) (valid bool, err error) + type MockEndorserServer struct + AddkvWrite bool + Creds credentials.TransportCredentials + ProposalError error + func (m *MockEndorserServer) ProcessProposal(context context.Context, proposal *pb.SignedProposal) (*pb.ProposalResponse, error) + func (m *MockEndorserServer) Start(address string) string + func (m *MockEndorserServer) Stop() + type MockEventService struct + Timeout bool + TxStatusRegCh chan *dispatcher.TxStatusReg + TxValidationCode pb.TxValidationCode + func NewMockEventService() *MockEventService + func (m *MockEventService) RegisterBlockEvent(filter ...fab.BlockFilter) (fab.Registration, <-chan *fab.BlockEvent, error) + func (m *MockEventService) RegisterChaincodeEvent(ccID, eventFilter string) (fab.Registration, <-chan *fab.CCEvent, error) + func (m *MockEventService) RegisterFilteredBlockEvent() (fab.Registration, <-chan *fab.FilteredBlockEvent, error) + func (m *MockEventService) RegisterTxStatusEvent(txID string) (fab.Registration, <-chan *fab.TxStatusEvent, error) + func (m *MockEventService) Unregister(reg fab.Registration) + type MockGrpcOrderer struct + Creds credentials.TransportCredentials + OrdererURL string + func NewMockGrpcOrderer(url string, tls credentials.TransportCredentials) *MockGrpcOrderer + func (o *MockGrpcOrderer) SendBroadcast(ctx reqContext.Context, envelope *fab.SignedEnvelope) (*common.Status, error) + func (o *MockGrpcOrderer) SendDeliver(ctx reqContext.Context, envelope *fab.SignedEnvelope) (chan *common.Block, chan error) + func (o *MockGrpcOrderer) Start() string + func (o *MockGrpcOrderer) Stop() + func (o *MockGrpcOrderer) URL() string + type MockIdentity struct + Err error + func (id *MockIdentity) Anonymous() bool + func (id *MockIdentity) ExpiresAt() time.Time + func (id *MockIdentity) GetIdentifier() *msp.IdentityIdentifier + func (id *MockIdentity) GetMSPIdentifier() string + func (id *MockIdentity) GetOrganizationalUnits() []*msp.OUIdentifier + func (id *MockIdentity) SatisfiesPrincipal(principal *msp_protos.MSPPrincipal) error + func (id *MockIdentity) Serialize() ([]byte, error) + func (id *MockIdentity) Validate() error + func (id *MockIdentity) Verify(msg []byte, sig []byte) error + type MockIdentityManager struct + func (mgr *MockIdentityManager) CreateSigningIdentity(opts ...msp.SigningIdentityOption) (msp.SigningIdentity, error) + func (mgr *MockIdentityManager) GetSigningIdentity(id string) (msp.SigningIdentity, error) + type MockInfraProvider struct + func (f *MockInfraProvider) Close() + func (f *MockInfraProvider) CommManager() fab.CommManager + func (f *MockInfraProvider) CreateChannelCfg(ctx fab.ClientContext, name string) (fab.ChannelCfg, error) + func (f *MockInfraProvider) CreateChannelConfig(channelID string) (fab.ChannelConfig, error) + func (f *MockInfraProvider) CreateChannelMembership(ctx fab.ClientContext, channel string) (fab.ChannelMembership, error) + func (f *MockInfraProvider) CreateEventService(ic fab.ClientContext, channelID string, opts ...options.Opt) (fab.EventService, error) + func (f *MockInfraProvider) CreateOrdererFromConfig(cfg *fab.OrdererConfig) (fab.Orderer, error) + func (f *MockInfraProvider) CreatePeerFromConfig(peerCfg *fab.NetworkPeer) (fab.Peer, error) + func (f *MockInfraProvider) SetCustomOrderer(customOrderer fab.Orderer) + type MockMSP struct + Err error + func NewMockMSP(err error) *MockMSP + func (m *MockMSP) DeserializeIdentity(serializedIdentity []byte) (msp.Identity, error) + func (m *MockMSP) GetDefaultSigningIdentity() (msp.SigningIdentity, error) + func (m *MockMSP) GetIdentifier() (string, error) + func (m *MockMSP) GetMSPs() (map[string]msp.MSP, error) + func (m *MockMSP) GetSigningIdentity(identifier *msp.IdentityIdentifier) (msp.SigningIdentity, error) + func (m *MockMSP) GetTLSIntermediateCerts() [][]byte + func (m *MockMSP) GetTLSRootCerts() [][]byte + func (m *MockMSP) GetType() msp.ProviderType + func (m *MockMSP) GetVersion() msp.MSPVersion + func (m *MockMSP) IsWellFormed(identity *msp_protos.SerializedIdentity) error + func (m *MockMSP) SatisfiesPrincipal(id msp.Identity, principal *msp_protos.MSPPrincipal) error + func (m *MockMSP) Setup(config *msp_protos.MSPConfig) error + func (m *MockMSP) Validate(id msp.Identity) error + type MockMSPManager struct + Err error + MSPs map[string]msp.MSP + func NewMockMSPManager(msps map[string]msp.MSP) *MockMSPManager + func NewMockMSPManagerWithError(msps map[string]msp.MSP, err error) *MockMSPManager + func (mgr *MockMSPManager) DeserializeIdentity(serializedIdentity []byte) (msp.Identity, error) + func (mgr *MockMSPManager) GetMSPs() (map[string]msp.MSP, error) + func (mgr *MockMSPManager) IsWellFormed(identity *msp_protos.SerializedIdentity) error + func (mgr *MockMSPManager) Setup(msps []msp.MSP) error + type MockMembership struct + ValidateErr error + VerifyErr error + func NewMockMembership() *MockMembership + func NewMockMembershipWithMSPFilter(mspsToBeExlcluded []string) *MockMembership + func (m *MockMembership) ContainsMSP(msp string) bool + func (m *MockMembership) Validate(serializedID []byte) error + func (m *MockMembership) Verify(serializedID []byte, msg []byte, sig []byte) error + type MockOrderer struct + BroadcastErrors chan error + BroadcastListener chan *fab.SignedEnvelope + BroadcastQueue chan *fab.SignedEnvelope + DeliverySessions chan *DeliverySession + DeliverySessionsQueue chan *DeliverySession + OrdererURL string + func NewMockOrderer(url string, broadcastListener chan *fab.SignedEnvelope) *MockOrderer + func (o *MockOrderer) CloseQueue() + func (o *MockOrderer) EnqueueForSendDeliver(values ...interface{}) + func (o *MockOrderer) EnqueueSendBroadcastError(err error) + func (o *MockOrderer) SendBroadcast(ctx reqContext.Context, envelope *fab.SignedEnvelope) (*common.Status, error) + func (o *MockOrderer) SendDeliver(ctx reqContext.Context, envelope *fab.SignedEnvelope) (chan *common.Block, chan error) + func (o *MockOrderer) URL() string + type MockPeer struct + ChaincodeID string + Endorser []byte + Error error + MockCert *pem.Block + MockMSP string + MockName string + MockRoles []string + MockURL string + Payload []byte + ProcessProposalCalls int + ProposalResponsePayload []byte + RWLock *sync.RWMutex + ResponseMessage string + RwSets []*rwsetutil.NsRwSet + Status int32 + func NewMockPeer(name string, url string) *MockPeer + func (p *MockPeer) EnrollmentCertificate() *pem.Block + func (p *MockPeer) MSPID() string + func (p *MockPeer) Name() string + func (p *MockPeer) ProcessTransactionProposal(ctx reqContext.Context, tp fab.ProcessProposalRequest) (*fab.TransactionProposalResponse, error) + func (p *MockPeer) Properties() fab.Properties + func (p *MockPeer) SetChaincodeID(ccID string) + func (p *MockPeer) SetEnrollmentCertificate(pem *pem.Block) + func (p *MockPeer) SetMSPID(mspID string) + func (p *MockPeer) SetName(name string) + func (p *MockPeer) SetProperties(properties fab.Properties) + func (p *MockPeer) SetRwSets(rwSets ...*rwsetutil.NsRwSet) + func (p *MockPeer) URL() string + type MockProviderContext struct + func NewMockProviderContext(userOpts ...ProviderOption) *MockProviderContext + func NewMockProviderContextCustom(cryptoConfig core.CryptoSuiteConfig, endpointConfig fab.EndpointConfig, ...) *MockProviderContext + func (pc *MockProviderContext) ChannelProvider() fab.ChannelProvider + func (pc *MockProviderContext) CryptoSuite() core.CryptoSuite + func (pc *MockProviderContext) CryptoSuiteConfig() core.CryptoSuiteConfig + func (pc *MockProviderContext) EndpointConfig() fab.EndpointConfig + func (pc *MockProviderContext) GetMetrics() *metrics.ClientMetrics + func (pc *MockProviderContext) IdentityConfig() msp.IdentityConfig + func (pc *MockProviderContext) IdentityManager(orgName string) (msp.IdentityManager, bool) + func (pc *MockProviderContext) InfraProvider() fab.InfraProvider + func (pc *MockProviderContext) LocalDiscoveryProvider() fab.LocalDiscoveryProvider + func (pc *MockProviderContext) PrivateKey() core.Key + func (pc *MockProviderContext) PublicVersion() msp.Identity + func (pc *MockProviderContext) SetCryptoSuiteConfig(config core.CryptoSuiteConfig) + func (pc *MockProviderContext) SetCustomChannelProvider(customChannelProvider fab.ChannelProvider) + func (pc *MockProviderContext) SetCustomInfraProvider(customInfraProvider fab.InfraProvider) + func (pc *MockProviderContext) SetEndpointConfig(config fab.EndpointConfig) + func (pc *MockProviderContext) SetIdentityConfig(config msp.IdentityConfig) + func (pc *MockProviderContext) Sign(msg []byte) ([]byte, error) + func (pc *MockProviderContext) SigningManager() core.SigningManager + func (pc *MockProviderContext) UserStore() msp.UserStore + type MockSelectionService struct + Error error + Peers []fab.Peer + func NewMockSelectionService(err error, peers ...fab.Peer) *MockSelectionService + func (ds *MockSelectionService) GetEndorsersForChaincode(chaincodes []*fab.ChaincodeCall, opts ...options.Opt) ([]fab.Peer, error) + type MockSigningIdentity struct + Signer crypto.Signer + func (id *MockSigningIdentity) GetPublicVersion() msp.Identity + func (id *MockSigningIdentity) Sign(msg []byte) ([]byte, error) + type MockStaticDiscoveryProvider struct + Error error + Peers []fab.Peer + func NewMockDiscoveryProvider(err error, peers []fab.Peer) *MockStaticDiscoveryProvider + func (dp *MockStaticDiscoveryProvider) CreateLocalDiscoveryService(mspID string) (fab.DiscoveryService, error) + func (dp *MockStaticDiscoveryProvider) SetCustomDiscoveryService(customDiscoveryService fab.DiscoveryService) + type MockStaticDiscoveryService struct + Error error + Peers []fab.Peer + func NewMockDiscoveryService(err error, peers ...fab.Peer) *MockStaticDiscoveryService + func (ds *MockStaticDiscoveryService) GetPeers() ([]fab.Peer, error) + type MockTransactionHeader struct + MockChannelID string + MockCreator []byte + MockID fab.TransactionID + MockNonce []byte + func (th *MockTransactionHeader) ChannelID() string + func (th *MockTransactionHeader) Creator() []byte + func (th *MockTransactionHeader) Nonce() []byte + func (th *MockTransactionHeader) TransactionID() fab.TransactionID + type MockTransactor struct + ChannelID string + Ctx reqContex.Context + Orderers []fab.Orderer + func (t *MockTransactor) CreateTransaction(request fab.TransactionRequest) (*fab.Transaction, error) + func (t *MockTransactor) CreateTransactionHeader(opts ...fab.TxnHeaderOpt) (fab.TransactionHeader, error) + func (t *MockTransactor) SendTransaction(tx *fab.Transaction) (*fab.TransactionResponse, error) + func (t *MockTransactor) SendTransactionProposal(proposal *fab.TransactionProposal, targets []fab.ProposalProcessor) ([]*fab.TransactionProposalResponse, error) + type ProviderOption func(*ProviderUsersOptions) error + func WithProviderUser(username string, org string) ProviderOption + type ProviderUsersOptions struct + type UsersOption func(*UsersOptions) error + func WithUser(username string, org string) UsersOption + func WithUsers(users map[string]msp.SigningIdentity) UsersOption + type UsersOptions struct