diff --git a/integration/nwo/fsc/topology.go b/integration/nwo/fsc/topology.go index bebe823fd..a13b62fdd 100755 --- a/integration/nwo/fsc/topology.go +++ b/integration/nwo/fsc/topology.go @@ -9,6 +9,8 @@ package fsc import ( "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/fsc/node" node2 "github.com/hyperledger-labs/fabric-smart-client/pkg/node" + "github.com/hyperledger-labs/fabric-smart-client/platform/view/services/comm/host/libp2p" + "github.com/hyperledger-labs/fabric-smart-client/platform/view/services/comm/host/rest" "github.com/hyperledger-labs/fabric-smart-client/platform/view/services/tracing" ) @@ -25,8 +27,8 @@ type Logging struct { type P2PCommunicationType = string const ( - LibP2P P2PCommunicationType = "libp2p" - WebSocket P2PCommunicationType = "websocket" + LibP2P P2PCommunicationType = libp2p.P2PCommunicationType + WebSocket P2PCommunicationType = rest.P2PCommunicationType ) type Topology struct { diff --git a/platform/view/services/comm/host/libp2p/provider.go b/platform/view/services/comm/host/libp2p/provider.go index 78c67dd5f..89dd3d97d 100644 --- a/platform/view/services/comm/host/libp2p/provider.go +++ b/platform/view/services/comm/host/libp2p/provider.go @@ -17,6 +17,9 @@ import ( "github.com/hyperledger-labs/fabric-smart-client/platform/view/view" ) +// P2PCommunicationType is a string identifier for the libp2p implementation of the p2p comm stack. +const P2PCommunicationType = "libp2p" + type libp2pConfig interface { PrivateKeyPath() string Bootstrap() bool diff --git a/platform/view/services/comm/host/rest/provider.go b/platform/view/services/comm/host/rest/provider.go index 31e456013..2fc6a3b4a 100644 --- a/platform/view/services/comm/host/rest/provider.go +++ b/platform/view/services/comm/host/rest/provider.go @@ -14,6 +14,9 @@ import ( "github.com/hyperledger-labs/fabric-smart-client/platform/view/services/id" ) +// P2PCommunicationType is a string identifier for the websocket implementation of the p2p comm stack. +const P2PCommunicationType = "websocket" + type pkiExtractor interface { ExtractPKI(id []byte) []byte } diff --git a/platform/view/services/comm/provider/provider.go b/platform/view/services/comm/provider/provider.go index b9b7480cb..e42777f43 100644 --- a/platform/view/services/comm/provider/provider.go +++ b/platform/view/services/comm/provider/provider.go @@ -9,7 +9,6 @@ package provider import ( "strings" - "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/fsc" "github.com/hyperledger-labs/fabric-smart-client/platform/common/driver" "github.com/hyperledger-labs/fabric-smart-client/platform/view/services/comm" "github.com/hyperledger-labs/fabric-smart-client/platform/view/services/comm/host" @@ -32,7 +31,7 @@ func NewHostProvider( return nil, err } - if p2pCommType := config.GetString("fsc.p2p.type"); strings.EqualFold(p2pCommType, fsc.WebSocket) { + if p2pCommType := config.GetString("fsc.p2p.type"); strings.EqualFold(p2pCommType, rest.P2PCommunicationType) { return NewWebSocketHostProvider(config, endpointService, tracerProvider, metricsProvider) } else { return NewLibP2PHostProvider(config, endpointService, metricsProvider), nil