WebUI: add udp pages
This commit is contained in:
parent
336dd1d5ba
commit
7a5d2a3bd9
23 changed files with 842 additions and 10 deletions
|
@ -32,6 +32,7 @@ type features struct {
|
|||
type overview struct {
|
||||
HTTP schemeOverview `json:"http"`
|
||||
TCP schemeOverview `json:"tcp"`
|
||||
UDP schemeOverview `json:"udp"`
|
||||
Features features `json:"features,omitempty"`
|
||||
Providers []string `json:"providers,omitempty"`
|
||||
}
|
||||
|
@ -47,6 +48,10 @@ func (h Handler) getOverview(rw http.ResponseWriter, request *http.Request) {
|
|||
Routers: getTCPRouterSection(h.runtimeConfiguration.TCPRouters),
|
||||
Services: getTCPServiceSection(h.runtimeConfiguration.TCPServices),
|
||||
},
|
||||
UDP: schemeOverview{
|
||||
Routers: getUDPRouterSection(h.runtimeConfiguration.UDPRouters),
|
||||
Services: getUDPServiceSection(h.runtimeConfiguration.UDPServices),
|
||||
},
|
||||
Features: getFeatures(h.staticConfig),
|
||||
Providers: getProviders(h.staticConfig),
|
||||
}
|
||||
|
@ -155,6 +160,44 @@ func getTCPServiceSection(services map[string]*runtime.TCPServiceInfo) *section
|
|||
}
|
||||
}
|
||||
|
||||
func getUDPRouterSection(routers map[string]*runtime.UDPRouterInfo) *section {
|
||||
var countErrors int
|
||||
var countWarnings int
|
||||
for _, rt := range routers {
|
||||
switch rt.Status {
|
||||
case runtime.StatusDisabled:
|
||||
countErrors++
|
||||
case runtime.StatusWarning:
|
||||
countWarnings++
|
||||
}
|
||||
}
|
||||
|
||||
return §ion{
|
||||
Total: len(routers),
|
||||
Warnings: countWarnings,
|
||||
Errors: countErrors,
|
||||
}
|
||||
}
|
||||
|
||||
func getUDPServiceSection(services map[string]*runtime.UDPServiceInfo) *section {
|
||||
var countErrors int
|
||||
var countWarnings int
|
||||
for _, svc := range services {
|
||||
switch svc.Status {
|
||||
case runtime.StatusDisabled:
|
||||
countErrors++
|
||||
case runtime.StatusWarning:
|
||||
countWarnings++
|
||||
}
|
||||
}
|
||||
|
||||
return §ion{
|
||||
Total: len(services),
|
||||
Warnings: countWarnings,
|
||||
Errors: countErrors,
|
||||
}
|
||||
}
|
||||
|
||||
func getProviders(conf static.Configuration) []string {
|
||||
if conf.Providers == nil {
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue