Skip to content

A Simple reverse proxy that provides load balancer services! 🚧 πŸš¦πŸ›°

License

Notifications You must be signed in to change notification settings

AAVision/traffic-balancer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Traffic Balancer

Load Balancing Algorithm

  • least-time
  • weighted-round-robin
  • connection-per-time
  • round-robin

Description πŸ“š

  • least-time: The load balancer will analyse and monitor the lower average latency of the provided servers and redirect the request to that server.
  • weighted-round-robin: On booting the load balance, it will read from the configuration file the weight of every server and redirect the request to the server with the highest weight rate.
  • connection-per-second: On booting the load balancer, it will check the number of connections on every server, and it will make that server inactive if the number of requests redirected per 1 minute exceeded the provided configuration of that server.
  • round-robin: It will redirect the request per index.

The load balancer checks the server's health status every 1 minute.

Configuration 🚧

Updating the config/config.yaml file:

# least-time
# weighted-round-robin
# connection-per-time
# round-robin
algorithm: "weighted-round-robin" # Algorithm to be used
port: 3030 # Port that the reverse proxy will run on
strict: true # Strict mode for black-listing IPs
log: true # Save logs to file in log folder
access-control-allow-origin: "*" # CORS HEADERS
max-body-size: 1024 # Maximum body size!
xss-protection: true # In default true it will add xss protection header to the requested sent from load balancer to the server.
servers: #List of servers.
  - 
    host: "http://localhost:9876"
    weight: 0.1
    connections: 1
  
  - 
    host: "http://localhost"
    weight: 0.9
    connections: 100

Usage πŸš€

go build
./traffic-balancer 
Load Balancer started at :3030

⚠️ don't forget to add your servers in the config/config.yaml file

TO-DO πŸ€Ύβ€β™‚οΈ

  • Adding more Access-Control-Allow header.
  • Add more load balancer algorithms.
  • Write unit tests.
  • Add XSS Header protection.
  • Add Body size.
  • Add MTLS.
  • Add Max File Size!
  • Strict mode for blocking black listing IPs.
  • Gzip Compression.

LICENSE βš–οΈ

This project is licensed under the MIT License. See the LICENSE file for details.

About

A Simple reverse proxy that provides load balancer services! 🚧 πŸš¦πŸ›°

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages