Optimized upstream & loadbalancer

- Test and optimized load balancer origin picker
- Fixed no active origin cannot load proxy rule bug
- Implemented logger design in websocket proxy module
- Added more quickstart tours
- Fixed #270 (I guess)
- Fixed #90 (I guess)
This commit is contained in:
Toby Chui
2024-08-19 16:10:35 +08:00
parent b558bcbfcf
commit 608cc0c523
12 changed files with 5597 additions and 4415 deletions

View File

@@ -83,6 +83,10 @@ func GetUpstreamsAsString(upstreams []*Upstream) string {
for _, upstream := range upstreams {
targets = append(targets, upstream.String())
}
if len(targets) == 0 {
//No upstream
return "(no upstream config)"
}
return strings.Join(targets, ", ")
}
@@ -93,7 +97,7 @@ func (m *RouteManager) Close() {
}
// Print debug message
func (m *RouteManager) debugPrint(message string, err error) {
// Log Println, replace all log.Println or fmt.Println with this
func (m *RouteManager) println(message string, err error) {
m.Options.Logger.PrintAndLog("LoadBalancer", message, err)
}