Feature: Add "Ban IP" to log message context menu in main dialog

- Add "Ban IP" menu item to the log message list (m_CList_Message)
  right-click context menu, allowing users to extract IPv4 addresses from
  selected log entries and add them directly to the IP blacklist
- Reuses ExtractFirstIPFromMessage() from the previous commit for
  dependency-free IPv4 parsing with per-segment 0-255 validation
- Checks against whitelist before banning (whitelisted IPs cannot be
  banned) and skips IPs already in blacklist with clear feedback
- Immediately persists via THIS_CFG.SetStr to the config ini file;
  IPBlacklist singleton takes effect instantly — subsequent connections
  from banned IPs are rejected in IOCPServer::OnAccept() which already
  calls IsIPBlacklisted() on every new connection
- Menu item is grayed out when no log entry is selected
- Sync en_US / zh_TW language files with new translation strings

Co-Authored-By: DeepSeek V4 Pro
This commit is contained in:
yuanyuanxiang
2026-08-06 20:44:33 +02:00
parent eeacbe5d61
commit 7bbc47a0ee
5 changed files with 88 additions and 2 deletions

View File

@@ -1968,3 +1968,8 @@ FRPC Զ
所选日志消息中未检测到有效的 IP 地址=No valid IP address detected in the selected log messages
所有解析出的 IP 已在上线提醒列表中=All extracted IPs are already in the login notify list
已添加 %d 个 IP 到上线提醒列表=Added %d IP(s) to login notify list
封禁IP=Ban IP
已封禁 %d 个 IP=Banned %d IP(s)
%d 个 IP 已在黑名单中=%d IP(s) already in blacklist
%d 个 IP 在白名单中,已跳过=%d IP(s) in whitelist, skipped
未执行任何操作=No action taken

View File

@@ -1959,3 +1959,8 @@ FRPC Զ
所有解析出的 IP 已在上线提醒列表中=所有解析出的 IP 已在上線提醒列表中
已添加 %d 个 IP 到上线提醒列表=已新增 %d 個 IP 到上線提醒列表
所选日志消息中未检测到有效的 IP 地址=所選日誌消息中未檢測到有效的 IP 位址
封禁IP=封禁IP
已封禁 %d 个 IP=已封禁 %d 個 IP
%d 个 IP 已在黑名单中=%d 個 IP 已在黑名單中
%d 个 IP 在白名单中,已跳过=%d 個 IP 在白名單中,已跳過
未执行任何操作=未執行任何操作