Skip to content

JoYBoY1210/Ginx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GinX - Lightweight Reverse Proxy in Go

GinX is a lightweight reverse proxy server written in Go. It supports:

  • 🔁 Round Robin Load Balancing – Distributes incoming requests evenly across multiple backend servers.
  • ♻️ Hot Configuration Reloading – Reload configuration on the fly by pressing r + Enter.
  • 🗂️ Static File Serving – Serves static files directly from the server.

🔧 Configuration

All routes are defined in a config.yaml file. Here's an example:

routes:
  - path: /files/
    backends:
        - http://localhost:3000
        - http://localhost:4000
    stratergy: round_robin


  - path: /static/
    static_dir: ./static


Explanation

  • path: The route path to match.
  • backends: A list of backend servers for load balancing.
  • stratergy: Load balancing strategy (round-robin supported).
  • static_dir: Directory path for serving static files.

🚀 Getting Started

1. Clone the Repository

git clone https://github.com/JoYBoY1210/Ginx.git
cd Ginx

2. Run the Server

go run main.go

3. Reload Config (Hot Reload)

In the terminal where the server is running, press:

r + Enter

This will reload the config.yaml file without restarting the server.


📁 Project Structure

Ginx/
├── main.go              # Main entry point
├── config.yaml          # Configuration file for routes
├── router/
│   └── router.go        # Sets routes and proxy logic
├── utils/
│   └── config.go        # Configuration loader
└── public/              # Static files served via /static/

📦 Dependencies

  • Go standard library
  • gopkg.in/yaml.v2 for YAML parsing

📝 License

MIT License

About

light weight reverse proxy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages