Code Monkey home page Code Monkey logo

go-powtcp's Introduction

go-powtcp (Proof of Concept)

The service is a tcp-server with protection against DDOS attacks using Proof of Work algorithm via challenge-response protocol.

The client sends a request with the proto.RequestServiceType message type to the server, in response the server returns a challenge with the proto.RequestChallengeType message type to the client. The proto.RequestChallengeType message type also includes parameters for the client to perform the required work. The task to be solved is unique and has a lifetime, after which it ceases to be relevant for execution. Having performed the necessary work, the client sends a ResponseChallengeType message to the server with a proof of the completed work. If the solution provided by the client is correct, the server returns a quote to the client with a proto.ResponseServiceType message.

To prevent exploitation of the server by repeatedly sending the same solution, tasks are one-shot. A single solution can be used only once to retrieve a quote. The complexity of work tasks issued by the server is adaptive and is adjusted depending on the time spent by clients on the solution, the number of active issued tasks and the number of requests within a fixed window.

Key points:

  • tcp server protected from ddos attacks with Proof of Work;
  • the challenge-response protocol is used;
  • sha-256 hash function is used, as it secure and modern algorithm proven in the bitcoin network;
  • after pow-verification server sends one of quotes from "word of wisdom" book.

Run in docker

  1. create config from example
~$ cp config.docker_example config
~$ vi config
  1. run build
~$ make build-amd64
  1. build docker-image
~$ make docker-build
  1. create docker network
~$ make docker-network
  1. run server
~$ make docker-server-run
  1. run client
~$ make docker-client-run

Testing

~$ make test

License

MIT

go-powtcp's People

Contributors

zyablitsev avatar

Watchers

 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.