docs(limit-ip): correct what the temporary disconnect can actually do (#6551)

* docs(limit-ip): correct what the temporary disconnect can actually do

The comment claimed removing and re-adding a user "disconnect[s] all
connections". RemoveUser only clears the core's credential validator in vless,
vmess, trojan, shadowsocks and hysteria alike, so a session already up keeps
running and the fail2ban ban on the logged IP is what ends the traffic. Comment
only: the protocol gate and its test are untouched.

* docs(limit-ip): say what the disconnect cycle really does per protocol
This commit is contained in:
BlindMaster24
2026-09-15 15:30:55 +03:00
committed by GitHub
parent 4a8fdceed6
commit d089adeeea
+6 -3
View File
@@ -612,7 +612,8 @@ func (j *CheckClientIpJob) filterAdvancedSinceLastBan(email string, banned []IPW
return actionable
}
// disconnectClientTemporarily removes and re-adds a client to force disconnect banned connections
// disconnectClientTemporarily drops a client's credential for a moment, so new
// handshakes are refused; the fail2ban ban is what ends live traffic.
func (j *CheckClientIpJob) disconnectClientTemporarily(inbound *model.Inbound, clientEmail string, clients []model.Client) {
var xrayAPI xray.XrayAPI
apiPort := j.resolveXrayAPIPort()
@@ -663,14 +664,16 @@ func (j *CheckClientIpJob) disconnectClientTemporarily(inbound *model.Inbound, c
}
}
// Remove user to disconnect all connections
// The core's RemoveUser clears its validator, so a session already up keeps
// running -- except vless, where it also drops a reverse handler.
err = xrayAPI.RemoveUser(inbound.Tag, clientEmail)
if err != nil {
logger.Warningf("[LIMIT_IP] Failed to remove user %s: %v", clientEmail, err)
return
}
// Wait a moment for disconnection to take effect
// Nothing is pending here: AlterInbound applies the removal inline, so this
// only widens the window in which new handshakes fail.
time.Sleep(100 * time.Millisecond)
// Re-add user to allow new connections