https://github.com/adrian-lin-1-0-0/gobalancer
A simple load balancer written in GO
https://github.com/adrian-lin-1-0-0/gobalancer
golang http load-balancer proxy tcp
Last synced: 3 months ago
JSON representation
A simple load balancer written in GO
- Host: GitHub
- URL: https://github.com/adrian-lin-1-0-0/gobalancer
- Owner: adrian-lin-1-0-0
- Created: 2022-06-30T17:55:31.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-07-03T19:11:28.000Z (almost 3 years ago)
- Last Synced: 2025-01-25T18:43:42.289Z (5 months ago)
- Topics: golang, http, load-balancer, proxy, tcp
- Language: Go
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## A simple load balancer written in GO
### Features
- [ ] Protocol type
- [x] TCP (HTTP/ HTTPS/ TCP over SSL)
- [ ] UDP
- [x] Load balance algorithms
- [x] Random
- [x] Round-robin
- [x] IP-hash### Config
#### listeners
| Field | Type | Requirement | Description |
| -- | -- | -- | -- |
| port | number | required | |
| upstream | number| required | upstream port |
| health_check_interval | number| optional | seconds ; default : 30 seconds|
| ssl | boolean| optional | enable ssl ; default : false |
| ssl_certificate | string | optional| |
| ssl_certificate_key | string | optional| |
| algo| string | optional | rand, round-robin, ip-hash ;default : rand |
| nagle | boolean | optional | https://networkencyclopedia.com/nagles-algorithm/ default : false |#### instances
| Field | Type | Requirement | Description |
| -- | -- | -- | -- |
| addr | string | required | address of upstream server |gobalancer.json
```json
{
"listeners":[
{
"nagle":false,
"healthcheck":10,
"algo":"round-robin",
"port":3001,
"ssl":true,
"ssl_certificate":"./server.crt",
"ssl_certificate_key":"./server.key",
"upstream":4001
},
{
"port":3002,
"upstream":4002
},
{
"port":3003,
"upstream":4003,
"algo":"ip-hash"
}
],
"instances":[
{
"addr":"127.0.0.1"
},
{
"addr":"127.0.0.2"
}
]
}
```