Giter Site home page Giter Site logo

timoyuen / reverseproxy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ymedialabs/reverseproxy

0.0 3.0 0.0 2.35 MB

Reverse Proxy in Golang is developed in order to analyse the performance of the any API server.

License: MIT License

Go 100.00%

reverseproxy's Introduction

Reverse Proxy In Go With Performance Analysis

Getting Started

Just Pull this go source code and run the binary file. This is built in order to analyze the HTTP traffic that is coming to your server.

HTTP Traffic from outside <-> GoProxy Server <-> Main Server

This goproxy server is responsible for accepting the HTTP request from outside world and route them to the actual server. The current version of this proxy server helps to analyze the server like response time, average response time for a particular path, printing request and response body for every HTTP request etc. The output is set to a terminal where you run the binary file.

This Server prints request body & response body of every request. Used http.DumpResponse which helps to copy the http response in a string format.

Prerequisites

Go Version 1.6 if not installed you can follow this documentation https://golang.org/doc/install

Deployment

You can run the program with the "port" and "url" sent as command line arguments. If not set by default Reverse Proxy will be running on port 9090 and it will be redirecting the request to http://localhost:8080.

Make sure you run your program at 8080 port or specify port while running the program.

Run Commands:

If you want to host ReverseProxy on 9090 and redirect the request to the port 5000 , run following command

./ReverseProxy -port=9090 -url=http://localhost:5000

or

./ReverseProxy

Note: If you modify anything in the code please do build the code once so that new binary file will be generated and you run the modified binary go file to get expected results.

Output

When you run the ReverseProxy server, It will print the port where Reverse Proxy is running and where it is redirecting the request to.

picture

Following screenshot shows the things that are captured after making one of the login POST request through reverse proxy.

picture

Whenever there is a http request , we are printing request body and response body along with headers.Along with that we are measuring the time for each api. Currently we are storing the total response time, total no of api calls for a particular path.

Thanks!

reverseproxy's People

Contributors

kiran0007 avatar

Watchers

James Cloos avatar  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.