Code Monkey home page Code Monkey logo

findmaxnumberrpc's Introduction

FindMaxNumberRPC

Abstract

FindMaxNumber RPC Bi-Directional streaming client and server implemented using Go and GRPC with unit tests & integration tests.

Deployment

1. Clone repo

go get github.com/cyyber/FindMaxNumberRPC

2. Change directory

cd $GOPATH/src/github.com/cyyber/FindMaxNumberRPC

3. Build

On successful build, binary files for server and client will be generated. Following is the command to build.

make build

4. Generate Certificates & Configure

Before starting server or client, certificates need to be generated for both server and clients and file paths of certificates must be configured in config/config.toml.

5. Starting Server

./server

6. Starting Client

./client

Components

Server - GRPC server running supports only GetMaxNumber rpc call. GetMaxNumber takes number as input and responds only if it is max number. To start the server needs certificates as well as Root Certificate Authority file. All clients which tries to connect with this server, must provide the certificate signed by the same Root Certificate Authority as configured in server. In case of failure, client will not be allowed to establish connection.

Client - GRPC client takes infinite input until KeyboardInterrupt. All inputs are streamed to server and any response received by server gets printed on console.

Config

Field Type Server Client
host string Address on which server will listen Address where connection will be attempted
port int16 Port on which server will listen Port where connection will be attempted
server_crt string File path for server.crt N/A
server_key string File path for server.key N/A
client_crt string N/A File path for client.crt
client_key string N/A File path for client.key
cert_auth string File path for CertificateAuthority.crt File path for CertificateAuthority.crt

Unit Tests & Integration Tests

Pre defined certificates has been generated for ip 127.0.0.1 and have been stored into pkg/server/test_data. These certificates are used for integration test only and in any case should not be used for production. These certificates has been generated by certstrap.

The following will only run unit tests.

go test -short -v ./...

The following will run unit tests as well as integration tests.

go test -v ./...

findmaxnumberrpc's People

Contributors

cyyber avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.