From e718679f2624db02fd8b6a0b2a2cda13dc55f40d Mon Sep 17 00:00:00 2001 From: HamidReza Date: Thu, 19 Mar 2026 00:09:46 +0330 Subject: [PATCH] fix: Disconnect only the supported protocols client --- web/job/check_client_ip_job.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/web/job/check_client_ip_job.go b/web/job/check_client_ip_job.go index d9aecec1..19c22e6d 100644 --- a/web/job/check_client_ip_job.go +++ b/web/job/check_client_ip_job.go @@ -414,6 +414,16 @@ func (j *CheckClientIpJob) disconnectClientTemporarily(inbound *model.Inbound, c return } + // Only perform remove/re-add for protocols supported by XrayAPI.AddUser + protocol := string(inbound.Protocol) + switch protocol { + case "vmess", "vless", "trojan", "shadowsocks": + // supported protocols, continue + default: + logger.Warningf("[LIMIT_IP] Temporary disconnect is not supported for protocol %s on inbound %s", protocol, inbound.Tag) + return + } + // Remove user to disconnect all connections err = xrayAPI.RemoveUser(inbound.Tag, clientEmail) if err != nil { @@ -425,7 +435,7 @@ func (j *CheckClientIpJob) disconnectClientTemporarily(inbound *model.Inbound, c time.Sleep(100 * time.Millisecond) // Re-add user to allow new connections - err = xrayAPI.AddUser(string(inbound.Protocol), inbound.Tag, clientConfig) + err = xrayAPI.AddUser(protocol, inbound.Tag, clientConfig) if err != nil { logger.Warningf("[LIMIT_IP] Failed to re-add user %s: %v", clientEmail, err) }