Add TCP Middlewares support

This commit is contained in:
Romain 2021-06-11 15:30:05 +02:00 committed by GitHub
parent 679def0151
commit fc9f41b955
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
134 changed files with 5865 additions and 1852 deletions

View file

@ -45,8 +45,9 @@ func (h Handler) getOverview(rw http.ResponseWriter, request *http.Request) {
Middlewares: getHTTPMiddlewareSection(h.runtimeConfiguration.Middlewares),
},
TCP: schemeOverview{
Routers: getTCPRouterSection(h.runtimeConfiguration.TCPRouters),
Services: getTCPServiceSection(h.runtimeConfiguration.TCPServices),
Routers: getTCPRouterSection(h.runtimeConfiguration.TCPRouters),
Services: getTCPServiceSection(h.runtimeConfiguration.TCPServices),
Middlewares: getTCPMiddlewareSection(h.runtimeConfiguration.TCPMiddlewares),
},
UDP: schemeOverview{
Routers: getUDPRouterSection(h.runtimeConfiguration.UDPRouters),
@ -160,6 +161,25 @@ func getTCPServiceSection(services map[string]*runtime.TCPServiceInfo) *section
}
}
func getTCPMiddlewareSection(middlewares map[string]*runtime.TCPMiddlewareInfo) *section {
var countErrors int
var countWarnings int
for _, mid := range middlewares {
switch mid.Status {
case runtime.StatusDisabled:
countErrors++
case runtime.StatusWarning:
countWarnings++
}
}
return &section{
Total: len(middlewares),
Warnings: countWarnings,
Errors: countErrors,
}
}
func getUDPRouterSection(routers map[string]*runtime.UDPRouterInfo) *section {
var countErrors int
var countWarnings int