Beispiel #1
0
func newPeerClientConnection() (*grpc.ClientConn, error) {
	var peerAddress = getPeerAddress()
	if comm.TLSEnabled() {
		return comm.NewClientConnectionWithAddress(peerAddress, true, true, comm.InitTLSForPeer())
	}
	return comm.NewClientConnectionWithAddress(peerAddress, true, false, nil)
}
Beispiel #2
0
// NewGrpcClient return a new GRPC client connection for the specified peer address
func NewGrpcClient(peerAddress string) (*grpc.ClientConn, error) {
	var tmpConn *grpc.ClientConn
	var err error
	if comm.TLSEnabled() {
		tmpConn, err = comm.NewClientConnectionWithAddress(peerAddress, true, true, comm.InitTLSForPeer())
	}
	tmpConn, err = comm.NewClientConnectionWithAddress(peerAddress, true, false, nil)
	if err != nil {
		fmt.Printf("error connection to server at host:port = %s\n", peerAddress)
	}
	return tmpConn, err

}
Beispiel #3
0
// NewPeerClientConnectionWithAddress Returns a new grpc.ClientConn to the configured local PEER.
func NewPeerClientConnectionWithAddress(peerAddress string) (*grpc.ClientConn, error) {
	if comm.TLSEnabled() {
		return comm.NewClientConnectionWithAddress(peerAddress, true, true, comm.InitTLSForPeer())
	}
	return comm.NewClientConnectionWithAddress(peerAddress, true, false, nil)
}