in go, grpc, language

I couldn’t find a single article explaining the different ways of connecting two Go applications using gRPC. After many tries, I came to the final 3 most useful ways to go:

Basic connection, no security

First, and easiest, is to not use TLS at all and not require any certificate. This mode is most useful if you have no certificate or if you don’t care about security, as transport is just HTTP, everything is in clear :-)

On the server side:

Here, we didn’t specify any argument to grpc.NewServer(), so no TLS!

On the client side:

Secure connection, using TLS

Now, we establish a connection using TLS, which requires a certificate on the server side. To generate a self-signed certificate, you can use openssl like so:

Server side would be:

Client side would be :

Even more secure connection, using TLS and server cert

We establish a connection using TLS, which requires a certificate on the server side.

Server side would be:

And on the client side:

Gophers images provided by René French, Brian Ketelsen and Steve Francia, https://github.com/ashleymcnamara/gophers

Facebooktwittergoogle_plusredditpinterestlinkedinmailNo tags for this post.

Write a Comment

Comment