mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6551] [MERGED] docs(limit-ip): correct what the temporary disconnect can actually do #6349
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6349
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6551
Author: @BlindMaster24
Created: 9/15/2026
Status: ✅ Merged
Merged: 9/15/2026
Merged by: @BlindMaster24
Base:
main← Head:docs/limit-ip-disconnect-scope📝 Commits (2)
baca0f0docs(limit-ip): correct what the temporary disconnect can actually doe9b31c1docs(limit-ip): say what the disconnect cycle really does per protocol📊 Changes
1 file changed (+6 additions, -3 deletions)
View changed files
📝
internal/web/job/check_client_ip_job.go(+6 -3)📄 Description
What the comment claimed vs what the core does
disconnectClientTemporarilysaid it "removes and re-adds a client to force disconnect banned connections", and the call site repeated it ("Remove user to disconnect all connections"). Reading the core at the version this repo pins, removal cannot end a live session for any protocol the function's gate admits:check_client_ip_job.go:644)RemoveUserreachesproxy/vless/inbound/inbound.go:245—RemoveReverse+validator.Del(e)proxy/vmess/inbound/inbound.go:177—usersByEmail.Remove(email)+clients.Remove(email)proxy/trojan/server.go:124—validator.Del(e)proxy/shadowsocks/server.go:62—validator.Del(e)proxy/hysteria/server.go:66→account/config.go:64-76— deletes the auth and the uuid from two mapsEvery one of them touches a credential store. A session was validated once at handshake and lives in its own goroutine afterwards, so it never consults that store again. The core exposes exactly two user operations —
AddUserOperationandRemoveUserOperation(app/proxyman/command/command.proto) — and noKickUser,DisconnectUserorCloseUserConnectionsexists anywhere in the module. There is no API that closes one client's session.What actually enforces the IP limit is one layer down: the job logs
[LIMIT_IP] Email = ... || Disconnecting OLD IP = ...(:561) for the fail2banfailregexdocumented right above it (:557, installed byx-ui.sh/DockerEntrypoint.sh), so the banned IP is dropped in the kernel. The remove-and-re-add is a nudge at best: it makes new handshakes fail for those 100 ms.This is the same root as #6533, which I fixed separately in #6550: the panel can only end a session by replacing the process that owns it.
What this PR changes
Comments only — three of them:
RemoveUseronly clears the validator, naming the five protocols;Behaviour, the protocol gate and
TestDisconnectClientTemporarilyAllowsHysteriaare untouched — that test pins the gate, and its own comment ("the skip left over-limit Hysteria2 sessions alive until the fail2ban ban caught up") is compatible with what I describe here: the ban is what ends the session.If you want a real immediate disconnect
Three options, my recommendation first:
disconnectClientTemporarilyand its test can go, saving a gRPC round trip and 100 ms per banned client per scan. Needs your say-so because it removes a feature-shaped call.Verification
go test ./internal/web/job— green (local run through a-overlaysupplying a pure-Go SQLite driver; the tree'sgo.mod/go.sumare unchanged), includingTestDisconnectClientTemporarilyAllowsHysteria.gofmt -lclean; the change is comment-only, so no runtime behaviour is claimed and no red-first test applies.Not verified, stated plainly: this is a reading of the pinned
xray-coresources, not a reproduction. I have no Xray binary in this environment (XRAY_E2E_BINARYunset), so I did not observe a live session surviving a removal — I observed that nothing in the code path could end one. If you want that settled empirically before deciding between the options above, say so and I will build the test.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.