Skip to content

Conversation

@kastov
Copy link
Collaborator

@kastov kastov commented Dec 4, 2025

No description provided.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 4, 2025

Greptile Overview

Greptile Summary

This release (v2.3.0) focuses on API improvements, code cleanup, and infrastructure enhancements. Major changes include:

  • Breaking Changes: Removed deprecated SSL_CERT and APP_PORT environment variables - migration to SECRET_KEY and NODE_PORT is now mandatory
  • API Contract Improvements: Refactored start command to use structured request body with typed internals (hashes, forceRestart) instead of headers, improving type safety and API clarity
  • New Feature: Added combined stats endpoint (/stats/combined) that fetches both inbound and outbound statistics in a single API call, reducing network overhead
  • Code Cleanup: Removed unused decorators (HashPayload, XForceRestart), constants, and deprecated user types (socks, http)
  • Infrastructure: Added HTTP server timeout configuration (keepAliveTimeout: 60s, headersTimeout: 61s) to prevent connection issues, increased ulimits in docker-compose for better scalability
  • Health Check Enhancement: Added nodeVersion field to health check response for better monitoring

Confidence Score: 5/5

  • This release is safe to merge - it's a well-structured version bump with clean refactoring and no security concerns
  • All changes are cohesive and follow a clear pattern: deprecated features are cleanly removed, new structured API contracts improve type safety, the combined stats endpoint is a straightforward optimization, and infrastructure improvements (timeouts, ulimits) address real production concerns. No breaking logic changes or security vulnerabilities detected.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
src/main.ts 4/5 Added HTTPS server keep-alive and headers timeout configuration, removed deprecated SSL_CERT and APP_PORT migration warnings
src/common/config/app-config/config.schema.ts 5/5 Cleaned up deprecated environment variable handling, now requires SECRET_KEY and NODE_PORT without fallbacks
src/modules/xray-core/xray.service.ts 5/5 Refactored startXray to use structured request body instead of separate parameters, improved type safety
libs/contract/commands/xray/start.command.ts 5/5 Changed from generic record to strongly-typed schema with internals.hashes and xrayConfig fields
src/modules/stats/stats.service.ts 5/5 Added getCombinedStats method to fetch inbound and outbound stats in a single API call
libs/contract/commands/handler/add-user.command.ts 5/5 Removed level field from all user types, removed deprecated socks and http user types
docker-compose-prod.yml 5/5 Added ulimits configuration with nofile limits set to 1048576 for better connection handling
src/modules/internal/internal.service.ts 5/5 Updated to use new structured hashes format from StartXrayCommand.Request

Sequence Diagram

sequenceDiagram
    participant Panel as Remnawave Panel
    participant Controller as XrayController
    participant XrayService as XrayService
    participant InternalService as InternalService
    participant XtlsSDK as Xtls SDK
    participant XrayCore as Xray Core

    Note over Panel,XrayCore: Start Xray Flow (v2.3.0)
    Panel->>Controller: POST /xray/start<br/>{internals: {hashes, forceRestart}, xrayConfig}
    Controller->>XrayService: startXray(body, ip)
    
    alt Xray Online & !forceRestart & !disableHashedSetCheck
        XrayService->>XtlsSDK: getSysStats()
        XtlsSDK-->>XrayService: {isOk: true}
        XrayService->>InternalService: isNeedRestartCore(body.internals.hashes)
        InternalService-->>XrayService: shouldRestart: boolean
        
        alt shouldRestart = false
            XrayService-->>Controller: Skip restart (config unchanged)
            Controller-->>Panel: {isRestarted: false}
        end
    end
    
    alt Restart Required
        XrayService->>XrayService: generateApiConfig(body.xrayConfig)
        XrayService->>InternalService: extractUsersFromConfig(hashes, config)
        InternalService->>InternalService: Parse inbounds & build HashedSet
        XrayService->>XrayCore: Restart via supervisord
        XrayCore-->>XrayService: Process restarted
        XrayService-->>Controller: {isRestarted: true}
        Controller-->>Panel: Success response
    end

    Note over Panel,XrayCore: Get Combined Stats (New in v2.3.0)
    Panel->>Controller: POST /stats/combined<br/>{reset: boolean}
    Controller->>StatsService: getCombinedStats(reset)
    par Parallel Fetches
        StatsService->>XtlsSDK: getAllInboundsStats(reset)
        XtlsSDK->>XrayCore: Query inbound stats
        XrayCore-->>XtlsSDK: inbounds data
        XtlsSDK-->>StatsService: {isOk, data}
    and
        StatsService->>XtlsSDK: getAllOutboundsStats(reset)
        XtlsSDK->>XrayCore: Query outbound stats
        XrayCore-->>XtlsSDK: outbounds data
        XtlsSDK-->>StatsService: {isOk, data}
    end
    StatsService->>StatsService: Combine results
    StatsService-->>Controller: {inbounds, outbounds}
    Controller-->>Panel: Combined stats response
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

40 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@kastov kastov merged commit 81d64b4 into main Dec 7, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants