peer

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PeersToTxnProcessors

func PeersToTxnProcessors(peers []fab.Peer) []fab.ProposalProcessor

PeersToTxnProcessors converts a slice of Peers to a slice of TxnProposalProcessors

Types

type Option

type Option func(*Peer) error

Option describes a functional parameter for the New constructor

func FromPeerConfig

func FromPeerConfig(peerCfg *fab.NetworkPeer) Option

FromPeerConfig is a functional option for the peer.New constructor that configures a new peer from a apiconfig.NetworkPeer struct

func WithInsecure

func WithInsecure() Option

WithInsecure is a functional option for the peer.New constructor that configures the peer's grpc insecure option

func WithMSPID

func WithMSPID(mspID string) Option

WithMSPID is a functional option for the peer.New constructor that configures the peer's msp ID

func WithPeerProcessor

func WithPeerProcessor(processor fab.ProposalProcessor) Option

WithPeerProcessor is a functional option for the peer.New constructor that configures the peer's proposal processor

func WithServerName

func WithServerName(serverName string) Option

WithServerName is a functional option for the peer.New constructor that configures the peer's server name

func WithTLSCert

func WithTLSCert(certificate *sm2.Certificate) Option

WithTLSCert is a functional option for the peer.New constructor that configures the peer's TLS certificate

func WithURL

func WithURL(url string) Option

WithURL is a functional option for the peer.New constructor that configures the peer's URL

type Peer

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

Peer represents a node in the target blockchain network to which HFC sends endorsement proposals, transaction ordering or query requests.

func New

func New(config fab.EndpointConfig, opts ...Option) (*Peer, error)

New Returns a new Peer instance

func (*Peer) MSPID

func (p *Peer) MSPID() string

MSPID gets the Peer mspID.

func (*Peer) ProcessTransactionProposal

func (p *Peer) ProcessTransactionProposal(ctx reqContext.Context, proposal fab.ProcessProposalRequest) (*fab.TransactionProposalResponse, error)

ProcessTransactionProposal sends the created proposal to peer for endorsement.

func (*Peer) String

func (p *Peer) String() string

func (*Peer) URL

func (p *Peer) URL() string

URL gets the Peer URL. Required property for the instance objects. It returns the address of the Peer.

Jump to

Keyboard shortcuts

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