Documentation ¶
Index ¶
- func AttemptSecured(url string, allowInSecure bool) bool
- func BuildConfigEndpointFromOptions(opts ...interface{}) (fab.EndpointConfig, error)
- func EndpointConfigFromBackend(cache cryptocache.CryptoCache, ...) (fab.EndpointConfig, error)
- func IdentityConfigFromBackend(cache cryptocache.CryptoCache, coreBackend ...core.ConfigBackend) (msp.IdentityConfig, error)
- func IsEndpointConfigFullyOverridden(c *EndpointConfigOptions) bool
- func IsTLSEnabled(url string) bool
- func ToAddress(url string) string
- func UpdateMissingOptsWithDefaultConfig(c *EndpointConfigOptions, d fab.EndpointConfig) fab.EndpointConfig
- type BalancerType
- type CAConfig
- type ChannelEndpointConfig
- type ChannelPolicies
- type DiscoveryPolicy
- type EndpointClientConfig
- type EndpointClientTLSConfig
- type EndpointConfig
- func (c *EndpointConfig) ChannelConfig(name string) *fab.ChannelEndpointConfig
- func (c *EndpointConfig) ChannelOrderers(name string) []fab.OrdererConfig
- func (c *EndpointConfig) ChannelPeers(name string) []fab.ChannelPeer
- func (c *EndpointConfig) CryptoConfigPath() string
- func (c *EndpointConfig) NetworkConfig() *fab.NetworkConfig
- func (c *EndpointConfig) NetworkPeers() []fab.NetworkPeer
- func (c *EndpointConfig) OrdererConfig(nameOrURL string) (*fab.OrdererConfig, bool, bool)
- func (c *EndpointConfig) OrderersConfig() []fab.OrdererConfig
- func (c *EndpointConfig) PeerConfig(nameOrURL string) (*fab.PeerConfig, bool)
- func (c *EndpointConfig) PeersConfig(org string) ([]fab.PeerConfig, bool)
- func (c *EndpointConfig) ResetNetworkConfig() error
- func (c *EndpointConfig) TLSCACertPool() commtls.CertPool
- func (c *EndpointConfig) TLSClientCerts() []tls.Certificate
- func (c *EndpointConfig) Timeout(tType fab.TimeoutType) time.Duration
- type EndpointConfigOptions
- type EventServicePolicy
- type IdentityClientConfig
- type IdentityClientTLSConfig
- type IdentityConfig
- func (c *IdentityConfig) CAClientCert(caID string) ([]byte, bool)
- func (c *IdentityConfig) CAClientKey(caID string) ([]byte, bool)
- func (c *IdentityConfig) CAConfig(caID string) (*msp.CAConfig, bool)
- func (c *IdentityConfig) CAKeyStorePath() string
- func (c *IdentityConfig) CAServerCerts(caID string) ([][]byte, bool)
- func (c *IdentityConfig) Client() *msp.ClientConfig
- func (c *IdentityConfig) CredentialStorePath() string
- func (c *IdentityConfig) TLSCACertPool() commtls.CertPool
- type MatchConfig
- type MutualTLSConfig
- type OrdererConfig
- type OrganizationConfig
- type PeerChannelConfig
- type PeerConfig
- type QueryChannelConfigPolicy
- type SelectionPolicy
- type SelectionSortingStrategy
- type TLSConfig
- type TLSKeyPair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttemptSecured ¶
AttemptSecured is a utility function which verifies URL and returns if secured connections needs to established for protocol 'grpcs' in URL returns true for protocol 'grpc' in URL returns false for no protocol mentioned, returns !allowInSecure
func BuildConfigEndpointFromOptions ¶
func BuildConfigEndpointFromOptions(opts ...interface{}) (fab.EndpointConfig, error)
BuildConfigEndpointFromOptions will return an EndpointConfig instance pre-built with Optional interfaces provided in fabsdk's WithEndpointConfig(opts...) call
func EndpointConfigFromBackend ¶
func EndpointConfigFromBackend(cache cryptocache.CryptoCache, channelConfigProvider func(name string) *fab.ChannelEndpointConfig, channelPeersProvider func(channel string) []fab.ChannelPeer, coreBackend ...core.ConfigBackend) (fab.EndpointConfig, error)
EndpointConfigFromBackend returns endpoint config implementation for given backend
func IdentityConfigFromBackend ¶
func IdentityConfigFromBackend(cache cryptocache.CryptoCache, coreBackend ...core.ConfigBackend) (msp.IdentityConfig, error)
IdentityConfigFromBackend returns identity config implementation of given backend
func IsEndpointConfigFullyOverridden ¶
func IsEndpointConfigFullyOverridden(c *EndpointConfigOptions) bool
IsEndpointConfigFullyOverridden will return true if all of the argument's sub interfaces is not nil (ie EndpointConfig interface not fully overridden)
func IsTLSEnabled ¶
IsTLSEnabled is a generic function that expects a URL and verifies if it has a prefix HTTPS or GRPCS to return true for TLS Enabled URLs or false otherwise
func ToAddress ¶
ToAddress is a utility function to trim the GRPC protocol prefix as it is not needed by GO if the GRPC protocol is not found, the url is returned unchanged
func UpdateMissingOptsWithDefaultConfig ¶
func UpdateMissingOptsWithDefaultConfig(c *EndpointConfigOptions, d fab.EndpointConfig) fab.EndpointConfig
UpdateMissingOptsWithDefaultConfig will verify if any functions of the EndpointConfig were not updated with fabsdk's WithConfigEndpoint(opts...) call, then use default EndpointConfig interface for these functions instead
Types ¶
type BalancerType ¶
type BalancerType string
BalancerType is the load-balancer type
const ( // RoundRobin (default) chooses endorsers in a round-robin fashion RoundRobin BalancerType = "RoundRobin" // Random chooses endorsers randomly Random BalancerType = "Random" )
type CAConfig ¶
type CAConfig struct { ID string URL string GRPCOptions map[string]interface{} TLSCACerts MutualTLSConfig Registrar msp.EnrollCredentials CAName string }
CAConfig defines a CA configuration in identity config
type ChannelEndpointConfig ¶
type ChannelEndpointConfig struct { // Orderers list of ordering service nodes Orderers []string // 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 // Policies list of policies for channel Policies ChannelPolicies }
ChannelEndpointConfig provides the definition of channels for the network
type ChannelPolicies ¶
type ChannelPolicies struct { // Policy for querying channel block QueryChannelConfig QueryChannelConfigPolicy // Policy for querying discovery Discovery DiscoveryPolicy // Policy for endorser selection Selection SelectionPolicy // Policy for event service EventService EventServicePolicy }
ChannelPolicies defines list of policies defined for a channel
type DiscoveryPolicy ¶
DiscoveryPolicy defines policy for discovery
type EndpointClientConfig ¶
type EndpointClientConfig struct { Organization string TLSCerts EndpointClientTLSConfig }
EndpointClientConfig provides the definition of the client configuration
type EndpointClientTLSConfig ¶
type EndpointClientTLSConfig struct { // Client TLS information Client TLSKeyPair }
EndpointClientTLSConfig contains the client TLS configuration
type EndpointConfig ¶
type EndpointConfig struct {
// contains filtered or unexported fields
}
EndpointConfig represents the endpoint configuration for the client
func (*EndpointConfig) ChannelConfig ¶
func (c *EndpointConfig) ChannelConfig(name string) *fab.ChannelEndpointConfig
ChannelConfig returns the channel configuration
func (*EndpointConfig) ChannelOrderers ¶
func (c *EndpointConfig) ChannelOrderers(name string) []fab.OrdererConfig
ChannelOrderers returns a list of channel orderers
func (*EndpointConfig) ChannelPeers ¶
func (c *EndpointConfig) ChannelPeers(name string) []fab.ChannelPeer
ChannelPeers returns the channel peers configuration
func (*EndpointConfig) CryptoConfigPath ¶
func (c *EndpointConfig) CryptoConfigPath() string
CryptoConfigPath ...
func (*EndpointConfig) NetworkConfig ¶
func (c *EndpointConfig) NetworkConfig() *fab.NetworkConfig
NetworkConfig returns the network configuration defined in the config file
func (*EndpointConfig) NetworkPeers ¶
func (c *EndpointConfig) NetworkPeers() []fab.NetworkPeer
NetworkPeers returns the network peers configuration, all the peers from all the orgs in config.
func (*EndpointConfig) OrdererConfig ¶
func (c *EndpointConfig) OrdererConfig(nameOrURL string) (*fab.OrdererConfig, bool, bool)
OrdererConfig returns the requested orderer
func (*EndpointConfig) OrderersConfig ¶
func (c *EndpointConfig) OrderersConfig() []fab.OrdererConfig
OrderersConfig returns a list of defined orderers
func (*EndpointConfig) PeerConfig ¶
func (c *EndpointConfig) PeerConfig(nameOrURL string) (*fab.PeerConfig, bool)
PeerConfig Retrieves a specific peer from the configuration by name or url
func (*EndpointConfig) PeersConfig ¶
func (c *EndpointConfig) PeersConfig(org string) ([]fab.PeerConfig, bool)
PeersConfig Retrieves the fabric peers for the specified org from the config file provided
func (*EndpointConfig) ResetNetworkConfig ¶
func (c *EndpointConfig) ResetNetworkConfig() error
ResetNetworkConfig clears network config cache
func (*EndpointConfig) TLSCACertPool ¶
func (c *EndpointConfig) TLSCACertPool() commtls.CertPool
TLSCACertPool returns the configured cert pool. If a certConfig is provided, the certificate is added to the pool
func (*EndpointConfig) TLSClientCerts ¶
func (c *EndpointConfig) TLSClientCerts() []tls.Certificate
TLSClientCerts loads the client's certs for mutual TLS
func (*EndpointConfig) Timeout ¶
func (c *EndpointConfig) Timeout(tType fab.TimeoutType) time.Duration
Timeout reads timeouts for the given timeout type, if type is not found in the config then default is set as per the const value above for the corresponding type
type EndpointConfigOptions ¶
type EndpointConfigOptions struct {
// contains filtered or unexported fields
}
EndpointConfigOptions represents EndpointConfig interface with overridable interface functions if a function is not overridden, the default EndpointConfig implementation will be used.
type EventServicePolicy ¶
type EventServicePolicy struct { ResolverStrategy string MinBlockHeightResolverMode string Balancer BalancerType BlockHeightLagThreshold int PeerMonitor string ReconnectBlockHeightLagThreshold int PeerMonitorPeriod time.Duration }
EventServicePolicy specifies the policy for the event service
type IdentityClientConfig ¶
type IdentityClientConfig struct { Organization string Logging logApi.LoggingType CryptoConfig msp.CCType TLSCerts IdentityClientTLSConfig CredentialStore msp.CredentialStoreType }
IdentityClientConfig defines client configuration in identity config
type IdentityClientTLSConfig ¶
type IdentityClientTLSConfig struct { // Client TLS information Client TLSKeyPair SystemCertPool bool }
IdentityClientTLSConfig defines client TLS configuration in identity config
type IdentityConfig ¶
type IdentityConfig struct {
// contains filtered or unexported fields
}
IdentityConfig represents the identity configuration for the client
func (*IdentityConfig) CAClientCert ¶
func (c *IdentityConfig) CAClientCert(caID string) ([]byte, bool)
CAClientCert read configuration for the fabric CA client cert bytes for given org
func (*IdentityConfig) CAClientKey ¶
func (c *IdentityConfig) CAClientKey(caID string) ([]byte, bool)
CAClientKey read configuration for the fabric CA client key bytes for given org
func (*IdentityConfig) CAConfig ¶
func (c *IdentityConfig) CAConfig(caID string) (*msp.CAConfig, bool)
CAConfig returns the CA configuration.
func (*IdentityConfig) CAKeyStorePath ¶
func (c *IdentityConfig) CAKeyStorePath() string
CAKeyStorePath returns the same path as KeyStorePath() without the 'keystore' directory added. This is done because the fabric-ca-client adds this to the path
func (*IdentityConfig) CAServerCerts ¶
func (c *IdentityConfig) CAServerCerts(caID string) ([][]byte, bool)
CAServerCerts Read configuration option for the server certificates will send a list of cert bytes for given org
func (*IdentityConfig) Client ¶
func (c *IdentityConfig) Client() *msp.ClientConfig
Client returns the Client config
func (*IdentityConfig) CredentialStorePath ¶
func (c *IdentityConfig) CredentialStorePath() string
CredentialStorePath returns the user store path
func (*IdentityConfig) TLSCACertPool ¶
func (c *IdentityConfig) TLSCACertPool() commtls.CertPool
TLSCACertPool returns the configured cert pool.
type MatchConfig ¶
type MatchConfig struct { Pattern string // these are used for hostname mapping URLSubstitutionExp string SSLTargetOverrideURLSubstitutionExp string MappedHost string // this is used for Name mapping instead of hostname mappings MappedName string // IgnoreEndpoint option to exclude given entity from any kind of search or from entity list IgnoreEndpoint bool }
MatchConfig contains match pattern and substitution pattern for pattern matching of network configured hostnames or channel names with static config
type MutualTLSConfig ¶
type MutualTLSConfig struct { Pem []string // Certfiles root certificates for TLS validation (Comma separated path list) Path string // Client TLS information Client TLSKeyPair }
MutualTLSConfig Mutual TLS configurations
type OrdererConfig ¶
OrdererConfig defines an orderer configuration
type OrganizationConfig ¶
type OrganizationConfig struct { MSPID string CryptoPath string Users map[string]TLSKeyPair Peers []string CertificateAuthorities []string }
OrganizationConfig provides the definition of an organization in the network
type PeerChannelConfig ¶
type PeerChannelConfig struct { EndorsingPeer bool ChaincodeQuery bool LedgerQuery bool EventSource bool }
PeerChannelConfig defines the peer capabilities
type PeerConfig ¶
PeerConfig defines a peer configuration
type QueryChannelConfigPolicy ¶
QueryChannelConfigPolicy defines opts for channelConfigBlock
type SelectionPolicy ¶
type SelectionPolicy struct { // SortingStrategy is the endorser sorting strategy to use SortingStrategy SelectionSortingStrategy // BalancerType is the balancer to use in order to load-balance calls to endorsers Balancer BalancerType // BlockHeightLagThreshold is the number of blocks from the highest block number of a group of peers // that a peer can lag behind and still be considered to be up-to-date. These peers will be sorted // using the given Balancer. If a peer's block height falls behind this threshold then it will be // demoted to a lower priority list of peers which will be sorted according to block height. // Note: This property only applies to BlockHeightPriority sorter BlockHeightLagThreshold int }
SelectionPolicy defines policy for selection
type SelectionSortingStrategy ¶
type SelectionSortingStrategy string
SelectionSortingStrategy is the endorser selection sorting strategy
const ( // BlockHeightPriority (default) is a load-balancing selection sorting strategy // which also prioritizes peers at a block height that is above a certain "lag" threshold. BlockHeightPriority SelectionSortingStrategy = "BlockHeightPriority" // Balanced is a load-balancing selection sorting strategy Balanced SelectionSortingStrategy = "Balanced" )
type TLSConfig ¶
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 // If both Path and Pem are available, pem takes the precedence Path string // Certificate actual content Pem string // contains filtered or unexported fields }
TLSConfig TLS configuration used in the sdk's configs.
func (*TLSConfig) LoadBytes ¶
func (cfg *TLSConfig) LoadBytes(cache cryptocache.CryptoCache) error
LoadBytes preloads bytes from Pem/Path Pem takes precedence over Path
type TLSKeyPair ¶
TLSKeyPair contains the private key and certificate for TLS encryption