TL;DR
Clone the repository (Assuming you have Go installed)
Execute the following commands:
go run server/main.go
go run client/main.go
Here the client sends stream of numbers 1 5 3 6 2 20 to get max number
You will see responses of 1 5 6 20
What this code is about
- This code base includes a gRPC server including bidirectional streaming facility
- The function in the server takes a stream of Request message that has one integer, and returns a stream of Responses that represent the current maximum between all these integers so far
- Client generates its own public-private key.
- Client signs every request message in the stream. Each requested message is verified against the signature at the server end. Only those numbers are considered to be processed whose sign is successfully verified.
Description of code base
- The client creates public and private key pair,
- Converts them to bytes,
- Client has a series of numbers as input, each is converted to []byte
- Client also create signature with private key
- Client sends all the above information as streams across a gRPC network
- Server accepts the stream and verifies using the signature
- Only if it is verified, then the server converts and does processing on the input number to find out maximum so far
- Then it returns the max number using a stream over gRPC
- Run
go test ./...
to run the tests