Skip to content

Acts as a middleman between the client and the internet, logging HTTP requests

Notifications You must be signed in to change notification settings

vitorsv1/go-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTP Proxy with Logging

Overview

This is a basic HTTP proxy server written in Go that logs all incoming HTTP requests. It captures essential details like the request method, URL, and headers, making it a useful starting point for learning about networking, proxying, and logging in Go.

Features

  • Forwards HTTP requests to their destination.
  • Logs request details (method, URL, headers).
  • Simple and lightweight, perfect for beginners.

Installation & Usage

Prerequisites

Ensure you have Go installed (version 1.18 or higher recommended). You can download it from golang.org.

Clone the Repository

 git clone https://github.com/vitorsv1/go-proxy.git
 cd go-proxy

Run the Proxy Server

go run main.go

By default, the proxy listens on port 8080.

Configure Your System to Use the Proxy

  • Browser: Set localhost:8080 as your HTTP proxy.
  • Curl: Use the proxy in requests:
    curl -x http://localhost:8080 http://example.com

File Structure

  • cmd/
    • main.go
  • internal/
    • proxy/
      • proxy.go
      • logger.go
      • filter.go
    • config/
      • config.go
  • logs/
  • tests/
  • go.mod
  • README.md

Next Steps

Here are some enhancements you can add:

  • Support for HTTPS requests
  • Implement domain blocklisting
  • Save logs to a file instead of printing to the console

About

Acts as a middleman between the client and the internet, logging HTTP requests

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages