修复(#1): 服务器用户列表缓存按 protocol 隔离 + 兜底不写缓存

服务器用户列表缓存跨协议污染修复(HIF-1 / 详见 PR #5 四件套):

1. 缓存 key 加 protocol 维度(`server:user:{server_id}:{protocol}`),对齐 ServerConfig 已有约定
2. 显式枚举协议清除用户列表缓存(AllProtocols + ServerUserListCacheKeysForServer),不用 SCAN
3. 三个兜底分支不写缓存 + Errorw 日志(带 server_id + protocol 字段)
4. hysteria2 → hysteria 兼容归一化 + 6 个新单测

Closes HIF-1
This commit is contained in:
2026-06-03 05:37:03 -07:00
committed by GitHub
parent 8ff992e74c
commit 19d28a8f89
6 changed files with 220 additions and 14 deletions
+2 -2
View File
@@ -71,7 +71,7 @@ func (m *defaultSubscribeModel) getCacheKeys(data *Subscribe) []string {
})
if err == nil {
for _, n := range nodes {
keys = append(keys, fmt.Sprintf("%s%d", node.ServerUserListCacheKey, n.ServerId))
keys = append(keys, node.ServerUserListCacheKeysForServer(n.ServerId)...)
}
}
}
@@ -83,7 +83,7 @@ func (m *defaultSubscribeModel) getCacheKeys(data *Subscribe) []string {
})
if err == nil {
for _, n := range nodes {
keys = append(keys, fmt.Sprintf("%s%d", node.ServerUserListCacheKey, n.ServerId))
keys = append(keys, node.ServerUserListCacheKeysForServer(n.ServerId)...)
}
}
}