forked from hyperledger/fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chan.Part.API IT: Join app channel at genesis block member (hyperledg…
…er#1465) Single node raft for now. Multi node raft to follow. Also some related refactoring/addition of helper functions for certificates, private keys, and addresses. FAB-18019 Signed-off-by: Will Lahti <[email protected]>
- Loading branch information
Showing
9 changed files
with
610 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
Copyright IBM Corp All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package configtx | ||
|
||
import ( | ||
"net" | ||
"strconv" | ||
|
||
"github.com/hyperledger/fabric/integration/nwo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
// PeerHostPort returns the host name and port number for the specified peer. | ||
func PeerHostPort(n *nwo.Network, p *nwo.Peer) (string, int) { | ||
return splitHostPort(n.PeerAddress(p, nwo.ListenPort)) | ||
} | ||
|
||
// OrdererHostPort returns the host name and port number for the specified | ||
// orderer. | ||
func OrdererHostPort(n *nwo.Network, o *nwo.Orderer) (string, int) { | ||
return splitHostPort(n.OrdererAddress(o, nwo.ListenPort)) | ||
} | ||
|
||
func splitHostPort(address string) (string, int) { | ||
host, port, err := net.SplitHostPort(address) | ||
Expect(err).NotTo(HaveOccurred()) | ||
portInt, err := strconv.Atoi(port) | ||
Expect(err).NotTo(HaveOccurred()) | ||
return host, portInt | ||
} |
Oops, something went wrong.