forked from hyperledger/fabric-sdk-go
/
api.go
95 lines (80 loc) · 2.6 KB
/
api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package fab
import (
"github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry"
"github.com/hyperledger/fabric-sdk-go/pkg/core/config/endpoint"
)
// ClientConfig provides the definition of the client configuration
type ClientConfig struct {
Organization string
TLSCerts ClientTLSConfig
}
// ClientTLSConfig contains the client TLS configuration
type ClientTLSConfig struct {
//Client TLS information
Client endpoint.TLSKeyPair
}
// OrdererConfig defines an orderer configuration
type OrdererConfig struct {
URL string
GRPCOptions map[string]interface{}
TLSCACerts endpoint.TLSConfig
}
// PeerConfig defines a peer configuration
type PeerConfig struct {
URL string
EventURL string
GRPCOptions map[string]interface{}
TLSCACerts endpoint.TLSConfig
}
// OrganizationConfig provides the definition of an organization in the network
type OrganizationConfig struct {
MSPID string
CryptoPath string
Users map[string]endpoint.TLSKeyPair
Peers []string
CertificateAuthorities []string
}
// ChannelEndpointConfig provides the definition of channels for the network
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
}
//ChannelPolicies defines list of policies defined for a channel
type ChannelPolicies struct {
//Policy for querying channel block
QueryChannelConfig QueryChannelConfigPolicy
}
//QueryChannelConfigPolicy defines opts for channelConfigBlock
type QueryChannelConfigPolicy struct {
MinResponses int
MaxTargets int
RetryOpts retry.Opts
}
// PeerChannelConfig defines the peer capabilities
type PeerChannelConfig struct {
EndorsingPeer bool
ChaincodeQuery bool
LedgerQuery bool
EventSource bool
}
// MatchConfig contains match pattern and substitution pattern
// for pattern matching of network configured hostnames or channel names with static config
type MatchConfig struct {
Pattern string
// these are used for hostname mapping
URLSubstitutionExp string
EventURLSubstitutionExp string
SSLTargetOverrideURLSubstitutionExp string
MappedHost string
// this is used for Name mapping instead of hostname mappings
MappedName string
}