How 2dust/v2rayng works
Main Components
• UI Layer – Represent the Android Activities, Fragments, and adapters under the “ui” package. This layer handles user interactions (e.g., MainActivity, SettingsActivity, LogcatActivity, etc.) and connects with viewmodels (e.g., MainViewModel, SettingsViewModel).
• Service Layer – Include Android services such as V2RayVpnService, ProcessService, NotificationService, and other background services that manage VPN connections, network tests, and subscription updates.
• Native Library Integration – Create a component for native cores where the v2ray core (and the Xray alternative) are integrated. Note that the aar is built from separate Go projects (AndroidLibXrayLite, AndroidLibV2rayLite) and that additional native tools like tun2socks, hysteria, and others are interfaced.
• Data Resources & Assets – Consider assets (configuration files, json files, open_source_licenses, geoip/geosite data) as a separate repository component that supplies data to the app.
Relationships and Interactions
• Plugin & Extension: Illustrate the plugin interface connecting external plugins (NativePlugin, PluginList) with the core management logic, emphasizing extensibility.
Architectural Patterns and Design Principles
• Layered/MVC (or MVVM) – Indicate that the app structure follows a separation between view (XML layouts, Activities), business logic (ViewModels, Managers) and data access (configuration loading/persistence).
• Modularity – Reflect that there is a clear separation between the UI, services, and the native integration (as separate libraries and modules).
• Dependency Inversion – Note that the plugins and configuration handlers abstract underlying platform or native functionality.
Relevant Technologies, Frameworks, and Libraries
• Kotlin as the programming language and Android Studio with Gradle as the build system.
• Integration with native libraries compiled from Go (AndroidLibXrayLite and potentially AndroidLibV2rayLite).
• Fastlane for deployment and GitHub Actions for Continuous Integration.
• Android’s architectural components (Activities/Fragment, ViewModels, Services) which are evident from the directory structure.