peer

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2019 License: Apache-2.0 Imports: 17 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 *apiconfig.NetworkPeer) Option

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

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 apiconfig.Config, opts ...Option) (*Peer, error)

New Returns a new Peer instance

func NewPeer

func NewPeer(url string, config apiconfig.Config) (*Peer, error)

NewPeer constructs a Peer given its endpoint configuration settings. url is the URL with format of "host:port". Deprecated: use peer.New() instead

func NewPeerFromConfig

func NewPeerFromConfig(peerCfg *apiconfig.NetworkPeer, config apiconfig.Config) (*Peer, error)

NewPeerFromConfig constructs a Peer from given peer configuration and global configuration setting. Deprecated: use peer.New() instead

func NewPeerFromProcessor

func NewPeerFromProcessor(url string, processor apifabclient.ProposalProcessor, config apiconfig.Config) (*Peer, error)

NewPeerFromProcessor constructs a Peer with a ProposalProcessor to simulate transactions. Deprecated: use peer.New() instead

func NewPeerTLSFromCert

func NewPeerTLSFromCert(url string, certPath string, serverHostOverride string, config apiconfig.Config) (*Peer, error)

NewPeerTLSFromCert constructs a Peer given its endpoint configuration settings. url is the URL with format of "host:port". certificate is ... serverNameOverride is passed to NewClientTLSFromCert in grpc/credentials. Deprecated: use peer.New() instead

func (*Peer) EnrollmentCertificate

func (p *Peer) EnrollmentCertificate() *pem.Block

EnrollmentCertificate returns the Peer's enrollment certificate. It returns the certificate in PEM format signed by the trusted CA.

func (*Peer) MSPID

func (p *Peer) MSPID() string

MSPID gets the Peer mspID.

func (*Peer) Name

func (p *Peer) Name() string

Name gets the Peer name.

func (*Peer) ProcessTransactionProposal

func (p *Peer) ProcessTransactionProposal(proposal fab.TransactionProposal) (fab.TransactionProposalResponse, error)

ProcessTransactionProposal sends the created proposal to peer for endorsement.

func (*Peer) Roles

func (p *Peer) Roles() []string

Roles gets the user’s roles the Peer participates in. It’s an array of possible values in “client”, and “auditor”. The member service defines two more roles reserved for peer membership: “peer” and “validator”, which are not exposed to the applications. It returns the roles for this user.

func (*Peer) SetEnrollmentCertificate

func (p *Peer) SetEnrollmentCertificate(pem *pem.Block)

SetEnrollmentCertificate set the Peer’s enrollment certificate. pem is the enrollment Certificate in PEM format signed by the trusted CA.

func (*Peer) SetMSPID

func (p *Peer) SetMSPID(mspID string)

SetMSPID sets the Peer mspID.

func (*Peer) SetName

func (p *Peer) SetName(name string)

SetName sets the Peer name / id.

func (*Peer) SetRoles

func (p *Peer) SetRoles(roles []string)

SetRoles sets the user’s roles the Peer participates in. See getRoles() for legitimate values. roles is the list of roles for the user.

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