feat(sub): report why a subscription balancer emits nothing (#7209)

A subscription balancer whose inbounds were deleted, disabled, changed to a protocol with no JSON outbound, left without clients or closed by their hosts simply vanished from the JSON subscription, and nothing in the panel or the log said why.

GET /panel/api/sub-balancers now returns a problems[] array per balancer with stable codes: unknown_inbound, disabled_inbound, json_incapable_protocol, inbound_without_clients, hosts_excluded_from_json and no_members. Settings -> Sub Balancers shows a warning tag whose tooltip names each cause and the affected inbounds, and the log records a balancer's problems when they change instead of on every listing.

The advisories are read from the stored rows and never change what a subscription emits: a balancer with no usable member is still omitted. The list of JSON-incapable protocols is pinned to the renderer, the subscription allowlist and the form by tests.
This commit is contained in:
amirim
2026-11-28 09:23:14 +03:00
committed by GitHub
parent eb99820dd8
commit e071f220e9
30 changed files with 1419 additions and 13 deletions
+4 -1
View File
@@ -81,11 +81,14 @@ func (a *SubBalancerController) parseID(c *gin.Context) (int, error) {
}
func (a *SubBalancerController) list(c *gin.Context) {
balancers, err := a.SubBalancerService.List()
balancers, err := a.SubBalancerService.ListWithProblems()
if err != nil {
jsonMsg(c, I18nWeb(c, "pages.settings.subBalancers.toasts.list"), err)
return
}
for _, balancer := range balancers {
service.LogSubBalancerProblems(&balancer.SubBalancer, balancer.Problems)
}
jsonObj(c, balancers, nil)
}