implemented better routing system, config parsing from yaml.

This commit is contained in:
psun256
2025-12-10 01:49:45 -05:00
parent 9046a85d84
commit 8170d2a6bf
7 changed files with 498 additions and 45 deletions

35
config.yaml Normal file
View File

@@ -0,0 +1,35 @@
backends:
- id: "srv-1"
ip: "127.0.0.1"
port: 8081
- id: "srv-2"
ip: "127.0.0.1"
port: 8082
clusters:
main-api:
- "srv-1"
- "srv-2"
priority-api:
- "srv-1"
rules:
- clients:
- "0.0.0.0/0:8080"
targets:
- "main-api"
strategy:
type: "RoundRobin"
- clients:
- "0.0.0.0/0:6767"
- "0.0.0.0/0:6969"
targets: # no issues with duplicate servers or clusters
- "priority-api"
- "priority-api"
- "priority-api"
strategy:
type: "Adaptive"
coefficients: [ 1.5, 1.0, 0.5, 0.1 ]
alpha: 0.75