fabric-go-sdk网络连接文件

name: dnet
channels:
  dch:
    orderers:
    - order0.dorder
    peers:
      peer0.dpeer:
        #对等节点是否会被发送查询建议
        chaincodequery: true
        #时候会向该节点发送交易提案以供背书
        endorsingpeer: true
        #是否会成为sdk的监听目标
        eventsource: true
        #时候向该节点发送不需要链码的查询建议
        ledgerquery: true
    #[Optional] 执行通道操作
    policies:
       #[Optional] 检索通道的配置选项
      queryChannelConfig:
         #[Optional]最小响应成功选项
        minResponses: 1
         #[Optional] 
        maxTargets: 1
        #[Optional] 查询配置块重试配置
        retryOpts:
          #[Optional]重试次数
          attempts: 5
          #[Optional]第一次重试回退间隔
          initialBackoff: 500ms
          #[Optional] 任何尝试的最大回退间隔
          maxBackoff: 5s
          #[Optional] 初始化的回退因子
          backoffFactor: 2.0
      #[Optional] 选择服务选项
      selection:
        #[Optional] 背书人选择排序策略  [BlockHeightPriority,Balanced]
        SortingStrategy: BlockHeightPriority
        #[Optional] 负载均衡的策略: [RoundRobin,Random]
        Balancer: RoundRobin
        #[Optional]从一组对等点的最高块数开始,一个对等点可以落后但仍被认为是最新的块数。
        #这些对等点将使用给定的 Balancer 进行排序。如果一个节点的区块高度低于这个阈值,
        #那么它将被降级为一个较低优先级的节点列表,该列表将根据区块高度进行排序。
        #注意:此属性仅适用于 BlockHeightPriority 排序器。
        BlockHeightLagThreshold: 5
        # [Optional] resolverStrategy specifies the peer resolver strategy to use when connecting to a peer
        # Possible values: [PreferOrg (default), MinBlockHeight, Balanced]
        #
        # PreferOrg:
        #   Determines which peers are suitable based on block height lag threshold, although will prefer the peers in the
        #   current org (as long as their block height is above a configured threshold). If none of the peers from the current org
        #   are suitable then a peer from another org is chosen.
        # MinBlockHeight:
        #   Chooses the best peer according to a block height lag threshold. The maximum block height of all peers is
        #   determined and the peers whose block heights are under the maximum height but above a provided "lag" threshold are load
        #   balanced. The other peers are not considered.
        # Balanced:
        #   Chooses peers using the configured balancer.
        resolverStrategy: PreferOrg

        # [Optional] minBlockHeightResolverMode specifies the behaviour of the MinBlockHeight resolver strategy.
        # Note that this parameter is applicable only when resolverStrategy is set to MinBlockHeight or PreferOrg.
        # Possible values: [ResolveByThreshold (default), ResolveLatest]
        #
        # ResolveByThreshold:
        #   Chooses peers based on block height lag threshold.
        # ResolveLatest:
        #   Chooses only the peers with the most up-to-date block height.
        minBlockHeightResolverMode: ResolveByThreshold

        # [Optional] balancer is the balancer to use when choosing a peer to connect to
        # Possible values: [Random (default), RoundRobin]
        balancer: Random
        # [Optional] blockHeightLagThreshold sets the block height lag threshold. This value is used for choosing a peer
        # to connect to. If a peer is lagging behind the most up-to-date peer by more than the given number of
        # blocks then it will be excluded from selection.
        # Note that this parameter is applicable only when minBlockHeightResolverMode is set to ResolveByThreshold.
        # Default: 5
        blockHeightLagThreshold: 5

        # [Optional] reconnectBlockHeightLagThreshold - the event client will disconnect from the peer if the peer's
        # block height falls behind the specified number of blocks and will reconnect to a better performing peer.
        # Note that this parameter is only applicable if peerMonitor is set to Enabled (default).
        # Default: 10
        # NOTES:
        #   - peerMonitorPeriod must be >0 to enable this feature
        #   - Setting this value too low may cause the event client to disconnect/reconnect too frequently, thereby
        #     affecting performance.
        reconnectBlockHeightLagThreshold: 10

        # [Optional] peerMonitor indicates whether or not a peer monitor should be enabled in order to monitor
        # the block height of the connected peer. In the case of MinBlockHeight and PreferOrg strategy, the event client
        # will disconnect from the peer if its block height falls below the specified threshold.
        # Possible values: [Enabled, Disabled]
        # Default: Enabled for MinBlockHeight and PreferOrg strategy; Disabled for Balanced strategy
        peerMonitor: Enabled

        # [Optional] peerMonitorPeriod is the period in which the connected peer is monitored to see if
        # the event client should disconnect from it and reconnect to another peer.
        # Default: 5s
        peerMonitorPeriod: 5s

client:
  bccsp:
    security:
      default:
        provider: SW
      enabled: true
      hashalgorithm: SHA2
      level: 256
      softverify: true
  cryptoconfig:
    path: /var/lib/agent/fabric/certs
  logging:
    level: info
  #属于哪个组织
  organization: dpeer
  tlscerts:
    pooltype: ORIGIN
    systemcertpool: false
  #peer的超时的全局配置,省略则选择默认值下面为默认值
  peer:
    timeout:
      connection: 10s
      response: 180s
      discovery:
      #对等节点列入灰名单的时间
        greylistExpiry: 10s
  orderer:
    timeout:
      connection: 15s
      response: 15s
  discovery:
    timeout:
      connection: 15s
      response: 15s
  global:
    timeout:
      query: 180s
      execute: 180s
      resmgmt: 180s
    cache:
      connectionIdle: 30s
      eventServiceIdle: 2m
      channelConfig: 30m
      channelMembership: 30s
      discovery: 10s
      selection: 10m
 #静态配置替换网络主机名     
entityMatchers:
  peer:
      #匹配规则
     - pattern: (\w+).example.(\w+)
      #替代的地址
      urlSubstitutionExp: localhost:7051
      sslTargetOverrideUrlSubstitutionExp: localhost
      #映射主机地址
      mappedHost: peer0.org1.example.com
  orderer:
    - pattern: (\w+).example2.(\w+)
      urlSubstitutionExp: localhost:7050
      sslTargetOverrideUrlSubstitutionExp: localhost
      mappedHost: orderer.example.com
   certificateAuthority:
    - pattern: (\w+).org1.example.(\w+)
      urlSubstitutionExp:
      sslTargetOverrideUrlSubstitutionExp:
      mappedHost: ca.org1.example.com
  channel:
    - pattern: ^(sample)(\w*)(channel)$
      mappedName: ch1
#order列表 sdk需要使用哪一个
orderers:
  order0.dorder:
    certtype: ORIGIN
    #grpc库的标准属性
    grpcoptions:
      #地址是否定义了协议   false:grpcs  true: grpc
      allow-insecure: false
      fail-fast: false
      keep-alive-permit: false
      keep-alive-time: 0s
      keep-alive-timeout: 20s
      ssl-target-name-override: order0.dorder
   #grpc的连接证书 TLS证书允许Fabric节点和客户端对通信进行签名和加密。任何通道通信都需要有效的TLS证书。
    tlscacerts:
      path: /var/lib/agent/fabric/certs/ordererOrganizations/dorder/orderers/order0.dorder/tls/ca.crt
    url: order0.dorder:7050
  order1.dorder:
    certtype: ORIGIN
    grpcoptions:
      allow-insecure: false
      fail-fast: false
      keep-alive-permit: false
      keep-alive-time: 0s
      keep-alive-timeout: 20s
      ssl-target-name-override: order1.dorder
    tlscacerts:
      path: /var/lib/agent/fabric/certs/ordererOrganizations/dorder/orderers/order1.dorder/tls/ca.crt
    url: order1.dorder:7050
  order2.dorder:
    certtype: ORIGIN
    grpcoptions:
      allow-insecure: false
      fail-fast: false
      keep-alive-permit: false
      keep-alive-time: 0s
      keep-alive-timeout: 20s
      ssl-target-name-override: order2.dorder
    tlscacerts:
      path: /var/lib/agent/fabric/certs/ordererOrganizations/dorder/orderers/order2.dorder/tls/ca.crt
    url: order2.dorder:7050
    
#参与网络的组织列表
organizations:
  dorder:
    cryptopath: ordererOrganizations/dorder/users/{username}@dorder/msp
    mspid: dorder
  dpeer:
    cryptopath: peerOrganizations/dpeer/users/{username}@dpeer/msp
    mspid: dpeer
    peers:
    - peer0.dpeer
    #ca颁发机构
    certificateAuthorities:
      - ca.org1.example.com
peers:
  peer0.dpeer:
    certtype: ORIGIN
    grpcoptions:
      allow-insecure: false
      fail-fast: false
      keep-alive-permit: false
      keep-alive-time: 0s
      keep-alive-timeout: 20s
      ssl-target-name-override: peer0.dpeer
    tlscacerts:
      path: /var/lib/agent/fabric/certs/peerOrganizations/dpeer/peers/peer0.dpeer/tls/ca.crt
    url: peer0.dpeer:7051
version: 1.0.0
x-type: hlfv1
#指定证书颁发机构
certificateAuthorities:
  ca.org1.example.com:
    url: https://ca.org1.example.com:7054
#    [Optional] The optional server name for target override
    grpcOptions:
#      ssl-target-name-override: ca.org1.example.com
    tlsCACerts:
#      dash-pipe ('- |') delimited pem strings of CA cert
#      pem: 'pem strings of CA cert'
#       Comma-Separated list of paths
      path: path/to/tls/cert/for/ca-org1
#       Client key and cert for SSL handshake with Fabric CA
      client:
        key:
          path: path/to/client_fabric_client-key.pem
          pem: `key pem'
        cert:
          path: path/to/client_fabric_client-key.pem
          pem: `cert pem`
#
#     Fabric-CA supports dynamic user enrollment via REST APIs. A "root" user, a.k.a registrar, is
#     needed to enroll and invoke new users.
    registrar:
      enrollId: usually-it-is_admin
      enrollSecret: adminpasswd
#     [Optional] The optional name of the CA.
    caName: ca.org1.example.com


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容