An open API service indexing awesome lists of open source software.

https://github.com/chinmayagrawal775/forward_proxy

Forward Proxy Built using GO that you can use right in your system
https://github.com/chinmayagrawal775/forward_proxy

concurrency forward-proxy golang goroutines profiling thread-pool

Last synced: about 2 months ago
JSON representation

Forward Proxy Built using GO that you can use right in your system

Awesome Lists containing this project

README

        

# Forward Proxy Built using GO

![Made with love in India](https://madewithlove.now.sh/in?heart=true&colorA=%232543d4&colorB=%23f58f00&template=for-the-badge)
[![made-with-go](https://img.shields.io/badge/Made%20with-GO-1f425f.svg)](https://go.dev/)
[![Open Source Love svg1](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badges/)

## About Project ๐Ÿ“„

What is forward proxy?
>
> From chatGPT:
>
> A forward proxy is a type of server that acts as an intermediary between a client and the internet. When a client makes a request to access a website or online resource, the request is first sent to the forward proxy server. The proxy then forwards this request to the destination server, retrieves the response, and sends it back to the client.

## Prerequisites โš™๏ธ
- Go installed on your system. (Version `1.23.0`)

## Local Setup Guide ๐Ÿ› ๏ธ

### Clone the repository
```
git clone [email protected]:chinmayagrawal775/forward_proxy.git
```

### Go to project folder
```
cd forward_proxy
```

### Run Proxy server using below command
```
go run main.go
```

Above command will run the proxy server at below URL:
> http://127.0.0.1:6969

By default it also starts the profiling server. You can access it at:
> http://127.0.0.1:6060/debug/pprof

### Test Proxy server ๐Ÿงช
Run the below commands in new terminal
```
curl --proxy 127.0.0.1:6969 example.com

curl --proxy 127.0.0.1:6969 facebook.com
```
With the first commnad you will see the html output in your terminal.

And with the second command you will see `Access to the site blocked!!` as `facebook.com` is a blocked site in proxy server. You can tweak it by modifying the `config/restricted-hosts.txt` file.

## Build Project ๐Ÿ—๏ธ
You can use the Makefile to create executable binary with the following command:
```
make build
```

Or you can also simply run the following command also:
```
go build
```

Both of the above commands will create the executable binaries with the name `foraward_proxy`

## How to use it as actual proxy server ๐ŸŒ ๐ŸŒ
Here i am giving the example of using your proxy server in [FireFox Browser](https://www.mozilla.org/en-US/firefox/). You can easily configure your firefox browser to use this forward proxy. Below are the steps to do that:

- Open Firefox, go to settings.
- In the General tab, at the very bottom, you will find the `Network Setting` section. Click the `Settings...` button
- Or you can also serach for `proxy` in the search bar of firefox settings
- In the opened modal, click the `Manual proxy configuration`
- Now you will have access to input the proxy URL.
- In HTTP proxy section enter the URL: `127.0.0.1` PORT: `6969`
- do check the `Also use this proxy for HTTPS` checkbox, so that HTTPs URLs will also be proxied.
- Click on `OK`

Hurray ๐ŸŽ‰ ๐Ÿš€, Now you have cofigured the forward proxy in your firefox browser. All your request will now go through this proxy server. To verify check out the proxy server logs in terminal. You will find various requests logging there.