Skip to content

tinahhhhh/go-grpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spam Assessment using Go and gRPC

This project is a spam assessment application based on Go programming language and gRPC. Users input the data they like to assess and send it to the server. After appplying assessment functions, the server respond the result back to the client.

Usage

  1. Git clone this project

    git clone https://github.com/tinahhhhh/go-grpc.git
    

Run locally

  1. Install Go from here

  2. Install gRPC

    go install google.golang.org/grpc/cmd/[email protected] 
    go install google.golang.org/protobuf/cmd/[email protected]
    export PATH="$PATH:$(go env GOPATH)/bin"s
    
  3. Install Protocol buffer compiler

    apt install -y protobuf-compiler
    
  4. Run the server (Please provide the url.)

    go run server/main.go -url https:xxx
    
  5. Run the client

    go run client/main.go
    
  6. Input the data you like to spam check in the client under the format "entity_type:entity_value".

    e.g. user_id:xxx
         email:[email protected]
         ip: xx.xx.xx.xx
    

Run on docker continers [Testing]

TODO: Use docker composer to make client and server contrainer comunicate. Use socat to execute STDIN to the client container. The following commands and server address in client code need to be modified according to docker network environment.

  1. Modify the server/Dockerfile file (In the last line (#22)) by providing URL for the data source.

    ENTRYPOINT cd /go/src/grpc-client && go run main.go -url https:xxx
    
  2. Run the server (Please provide the url.)

    cd server
    docker build . -t server 
    docker run server -p 50051:50051
    
  3. Run the client

    cd client
    docker build . -t client 
    docker run -i client -p 50051:50051
    
  4. Input the data you like to spam check in the client under the format "entity_type:entity_value".

    e.g. user_id:xxx
         email:[email protected]
         ip: xx.xx.xx.xx
    

Result

Unit Test

	cd server
	go test

References

  1. build go + grpc
  2. grpc-go hello world
  3. HTTP Get method in Golang
  4. gojsonq package
  5. unit test in Go

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published