tarampampam / http-proxy-daemon

:gem: Http Proxy Daemon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logo

Http Proxy Daemon

Release version Project language Build Status Release Status Coverage License

This application allows sending any HTTP requests throughout itself (proxying) using dynamic HTTP route, like http://app/proxy/https/example.com/file.json?any=param (request will be sent on https://example.com/file.json?any=param). By running this application on a remote server you can send requests to any resources "like from a server" from anywhere!

Installing

Download the latest binary file for your os/arch from releases page or use our docker image (ghcr.io).

Usage example

Run proxy server:

$ ./http-proxy-daemon serve --port 8080 --prefix 'proxy'

Then send an HTTP request to the https://httpbin.org/get?foo=bar&bar&baz through our server:

$ curl -s -H "foo:bar" --user-agent "fake agent" 'http://127.0.0.1:8080/proxy/https/httpbin.org/get?foo=bar&bar&baz'
{
  "args": {
    "bar": "",
    "baz": "",
    "foo": "bar"
  },
  "headers": {
    "Accept": "*/*",
    "Accept-Encoding": "gzip",
    "Foo": "bar",
    "Host": "httpbin.org",
    "User-Agent": "fake agent"
  },
  "origin": "8.8.8.8, 1.1.1.1",
  "url": "https://httpbin.org/get?foo=bar&bar&baz"
}

Using docker

image stats

All supported image tags can be found here and here.

Run docker-container with a proxy server in background (detached) and listen for 8080 TCP port (incoming HTTP requests):

$ docker run --rm -d -p "8080:8080/tcp" tarampampam/http-proxy-daemon:X.X.X serve --port 8080

Important notice: do not use latest application tag (this is bad practice). Use versioned tag (like 1.2.3) instead.

Benchmark

Start this application in a docker-container:

$ docker run --rm --net host tarampampam/http-proxy-daemon:0.3.0 serve --port 8080

Start nginx beside:

$ docker run --rm --net host nginx:alpine

Next, run Apache Benchmark:

$ ab -kc 15 -t 90 'http://127.0.0.1:8080/proxy/http/127.0.0.1:80'
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
Completed 25000 requests
Completed 30000 requests
Completed 35000 requests
Completed 40000 requests
Completed 45000 requests
Completed 50000 requests
Finished 50000 requests


Server Software:        nginx/1.19.9
Server Hostname:        127.0.0.1
Server Port:            8080

Document Path:          /proxy/http/127.0.0.1:80
Document Length:        612 bytes

Concurrency Level:      15
Time taken for tests:   7.469 seconds
Complete requests:      50000
Failed requests:        0
Keep-Alive requests:    50000
Total transferred:      44100000 bytes
HTML transferred:       30600000 bytes
Requests per second:    6694.38 [#/sec] (mean)
Time per request:       2.241 [ms] (mean)
Time per request:       0.149 [ms] (mean, across all concurrent requests)
Transfer rate:          5766.06 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     0    2  14.1      1     371
Waiting:        0    2  14.1      1     371
Total:          0    2  14.1      1     371

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      2
  75%      2
  80%      2
  90%      3
  95%      5
  98%      6
  99%      7
 100%    371 (longest request)

Hardware info:

$ cat /proc/cpuinfo | grep 'model name'
model name	: Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
model name	: Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
model name	: Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
model name	: Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
model name	: Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
model name	: Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
model name	: Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
model name	: Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz

$ cat /proc/meminfo | grep 'MemTotal'
MemTotal:       16261464 kB

Testing

For application testing we use built-in golang testing feature and docker-ce + docker-compose as develop environment. So, just write into your terminal after repository cloning:

$ make test

Or build binary file:

$ make build

Changes log

Release date Commits since latest release

Changes log can be found here.

Support

Issues Issues

If you will find any package errors, please, make an issue in current repository.

License

This is open-sourced software licensed under the MIT License.

About

:gem: Http Proxy Daemon

License:MIT License


Languages

Language:Go 93.4%Language:Makefile 3.6%Language:Dockerfile 3.0%