This project aims to create a simple proxy server using Go, providing an opportunity to understand how proxy servers work and gain hands-on experience with Go programming language.
- Forward HTTP requests from clients to target servers
- Forward responses from target servers back to clients
- Handle multiple concurrent connections efficiently
- Logging of requests and responses
- Basic caching mechanism for improved performance
Make sure you have the following installed:
- Go: Ensure Go is properly installed on your system.
-
Clone the repository:
git clone <repository_url> cd go-proxy-server
-
Build the project:
go build
-
Run the server:
./go-proxy-server
To use the proxy server, configure your client to use localhost
at the port the proxy server is running on (default is 8080).
You can configure the proxy server by modifying the config.json
file. Options include:
- Port: The port on which the proxy server listens for incoming connections.
- TargetHost: The host to which the proxy server forwards incoming requests.
Here's an example of how you can configure the proxy server in config.json
:
{
"port": 8080,
"targetHost": "example.com"
}