fix(job): force-disconnect over-limit Hysteria2 clients

disconnectClientTemporarily still gated on the protocol list from before
XrayAPI.AddUser learned hysteria, so an over-limit Hysteria2 client kept
its QUIC session until the fail2ban ban aged out, while a VLESS client in
the same situation was dropped at once. buildUserAccount handles hysteria
and model.Client already marshals the auth field the re-add needs, so admit
the protocol. wireguard stays excluded: its keepAlive marshals as a JSON
number, which the string-only user-field parsing rejects after the user was
already removed.

Closes #6256
This commit is contained in:
Sanaei
2026-08-24 13:27:40 +02:00
parent 7a595cb46d
commit d175050f2e
2 changed files with 45 additions and 2 deletions
+3 -2
View File
@@ -634,10 +634,11 @@ func (j *CheckClientIpJob) disconnectClientTemporarily(inbound *model.Inbound, c
return
}
// Only perform remove/re-add for protocols supported by XrayAPI.AddUser
// Protocols XrayAPI can remove and re-add from a marshaled model.Client.
// wireguard stays out: keepAlive marshals as a number, AddUser wants a string.
protocol := string(inbound.Protocol)
switch protocol {
case "vmess", "vless", "trojan", "shadowsocks":
case "vmess", "vless", "trojan", "shadowsocks", "hysteria":
// supported protocols, continue
default:
logger.Warningf("[LIMIT_IP] Temporary disconnect is not supported for protocol %s on inbound %s", protocol, inbound.Tag)