Conversation
…nt blocker state management and API config generation
…es to include default ignored IPs
…lated constants and interfaces
…_THREADPOOL_SIZE in Dockerfile
…api to version 0.4.1 in package.json and package-lock.json
…age-lock.json; expand default ignored IPs set
…d add-users commands
Greptile SummaryThis release (v2.7.0) introduces a plugin subsystem (torrent-blocker, ingress/egress nftables filters, connection-drop), real-time network stats polling, new protocol support (shadowsocks22, hysteria), and a live webhook feedback loop from xray. Two P1 bugs were found that require fixes before merging. Confidence Score: 3/5Not safe to merge as-is: two P1 defects can leave xray routing in an inconsistent state and allow loopback IPs to bypass the torrent-blocker ignore list. Both P1 findings are present-defect correctness issues on the primary new feature path (torrent-blocker plugin). The CIDR bug silently misclassifies loopback IPs; the restart-guard bug can leave a live xray process with a dangling routing rule referencing a removed outbound. src/common/constants/default-ignored-ips.ts and src/modules/_plugin/plugin.service.ts require fixes before merging. Important Files Changed
Sequence DiagramsequenceDiagram
participant Panel as Remnawave Panel
participant PC as PluginController
participant PS as PluginService
participant PSS as PluginStateService
participant NFT as NftService
participant XS as XrayService
participant XC as XrayCore
participant IC as InternalController
participant XWH as XrayWebhookHandler
Panel->>PC: POST /plugin/sync (plugin config)
PC->>PS: sync(body)
PS->>PSS: capture old torrentBlocker state
PS->>PSS: resetState() / cleanUpActivePlugin()
PS->>NFT: recreateTables()
PS->>PSS: syncTorrentBlocker / syncConnectionDrop
PS->>NFT: syncIngressFilter / syncEgressFilter
alt torrentBlocker disabled and no old includeRuleTags
PS->>XS: RemoveOutboundCommand(tag)
XS->>XC: removeOutbound(RW_TB_OUTBOUND_BLOCK)
else config changed
PS->>XS: StopXrayCommand(withOnlineCheck)
XS->>XC: kill xray processes
end
Panel->>XS: StartXrayCommand
XS->>PSS: GetTorrentBlockerStateQuery
XS->>XS: generateApiConfig (inject TB outbound + routing rule)
XS->>XC: start xray with full config
XC-->>IC: POST /internal/webhook (bittorrent detected)
IC->>XWH: publish XrayWebhookEvent
XWH->>PSS: isIpIgnored / isUserIgnored?
alt IP not ignored
XWH->>NFT: blockIp(ip, duration)
NFT->>XC: nftables add address
XWH->>PSS: addReport(...)
end
Reviews (1): Last reviewed commit: "chore: update XRAY_CORE_VERSION to v26.3..." | Re-trigger Greptile |
| if (wasEnabled && !nowEnabled && !pluginData.torrentBlocker?.includeRuleTags) { | ||
| await this.commandBus.execute( | ||
| new RemoveOutboundCommand(XRAY_TORRENT_BLOCKER_OUTBOUND_TAG), | ||
| ); |
There was a problem hiding this comment.
Incorrect guard for hot-remove vs. full xray restart
The condition !pluginData.torrentBlocker?.includeRuleTags inspects the new config object (which has torrent-blocker disabled, so pluginData.torrentBlocker is typically undefined). This means the expression is almost always !undefined → true, causing the first branch to be taken regardless of what the old running config contained.
Scenario that breaks xray:
- Old config: torrent-blocker enabled with
includeRuleTags: ['my-rule']→ xray's routing rules contain webhook entries formy-rule. - New config: torrent-blocker disabled.
- Guard evaluates
!undefined === true→ onlyRemoveOutboundCommandis dispatched. - Result: xray's routing rules still reference the removed outbound
RW_TB_OUTBOUND_BLOCKand the orphaned webhook entries remain active.
The gate should check the previously captured currentTorrentBlockerIncludeRuleTags (which reflects what xray is actually running with), not the incoming (disabled) plugin config:
| if (wasEnabled && !nowEnabled && !pluginData.torrentBlocker?.includeRuleTags) { | |
| await this.commandBus.execute( | |
| new RemoveOutboundCommand(XRAY_TORRENT_BLOCKER_OUTBOUND_TAG), | |
| ); | |
| if (wasEnabled && !nowEnabled && currentTorrentBlockerIncludeRuleTags.size === 0) { |
This ensures a restart (rather than a hot-remove) is triggered whenever the old config had added webhook rules to xray's routing table.
…h Node.js version 24.x; add TypeScript as a devDependency in package.json
No description provided.