Commit 8417c9ff authored by Richer Maximilien's avatar Richer Maximilien
Browse files

Client lib

Fix addr & port in dialing
parent 460ede94
Pipeline #140 passed with stage
package net
import (
// Connect to a peer
// Closing must be defered after call
func Connect(addr_port string, cert, key, ca []byte) *ClientConn {
// load peer cert/key, ca as PEM buffers
peerCert, err := tls.X509KeyPair(cert, key)
if err != nil {
log.Fatal("Load peer cert/key error: %v", err)
caCertPool := x509.NewCertPool()
// configure transport authentificator
ta := credentials.NewTLS(&tls.Config{
Certificates: []tls.Certificate{peerCert},
RootCAs: caCertPool,
// let's do the dialing !
con, err := grpc.Dial(addr_port, grpc.WithTransportCredentials(ta))
if err != nil {
grpclog.Fatalf("Fail to dial: %v", err)
return con
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment