How patterniha/pattng works
PattNG is an Android proxy/VPN client fork of v2rayNG, with Aether-core additions and custom TLS/profile settings. Users manage proxy profiles and subscriptions, select a route, then start a VPN/proxy session; the app builds core configuration and runs it through Android services. The README also documents configuration sharing and Xray behavior changes. The graph includes those documented capabilities and routing, testing, and persistence stages. Source excerpts do not expose the full UI-to-service startup path, so unsupported calls are omitted; dashed links mark documented or uncertain integration points.
Main entry points: MmkvManager.kt Profile and subscription store · CoreVpnService.kt VPN service · MainViewModel.kt Connection state · CoreConfigManager.kt Core configuration
Components 21
Profiles and subscriptions
- Profile editor
V2rayNG/app/src/main/java/com/v2ray/ang/ui/server/ProfileEditorViewModel.kt - Profile and subscription store
V2rayNG/app/src/main/java/com/v2ray/ang/handler/MmkvManager.kt - Proxy profile model
V2rayNG/app/src/main/java/com/v2ray/ang/dto/entities/ProfileItem.kt - Subscription updater
V2rayNG/app/src/main/java/com/v2ray/ang/handler/SubscriptionUpdater.kt - Subscription service
V2rayNG/app/src/main/java/com/v2ray/ang/service/SubscriptionUpdateService.kt - Share-link formats
V2rayNG/app/src/main/java/com/v2ray/ang/fmt/FmtBase.kt
Routing and configuration
- Routing editor
V2rayNG/app/src/main/java/com/v2ray/ang/ui/routing/RoutingEditActivity.kt - Settings and rules
V2rayNG/app/src/main/java/com/v2ray/ang/handler/SettingsManager.kt - Core configuration
V2rayNG/app/src/main/java/com/v2ray/ang/core/CoreConfigManager.kt - Aether core manager
V2rayNG/app/src/main/java/com/v2ray/ang/core/AetherCoreManager.kt - Xray extensions
Proxy runtime
- Core lifecycle manager
V2rayNG/app/src/main/java/com/v2ray/ang/core/CoreServiceManager.kt - VPN service
V2rayNG/app/src/main/java/com/v2ray/ang/service/CoreVpnService.kt - Native core
V2rayNG/app/src/main/java/com/v2ray/ang/core/CoreNativeManager.kt - Android VPN
- Root proxy mode
V2rayNG/app/src/main/java/com/v2ray/ang/root/RootProxyManager.kt - Browser dialer
V2rayNG/app/src/main/java/com/v2ray/ang/service/DialerNativeService.kt
App workflows
- Connection screen
V2rayNG/app/src/main/java/com/v2ray/ang/ui/main/MainScreen.kt - Connection state
V2rayNG/app/src/main/java/com/v2ray/ang/ui/main/MainViewModel.kt - Connectivity tests
V2rayNG/app/src/main/java/com/v2ray/ang/service/RealPingWorkerService.kt
Other components
- User
Connections 23
- User → Connection screen: manages connection
- Connection screen → Connection state: updates state
- Connection state → Profile and subscription store: reads profiles
- Profile editor → Profile and subscription store: saves profiles
- Profile and subscription store → Proxy profile model: stores
V2rayNG/app/src/main/java/com/v2ray/ang/handler/MmkvManager.kt - Subscription updater → Subscription service: dispatches updates
- Subscription service → Profile and subscription store: writes profiles
V2rayNG/app/src/main/java/com/v2ray/ang/service/SubscriptionUpdateService.kt - User → Profile editor: edits profiles
- User → Routing editor: edits routing
V2rayNG/app/src/main/java/com/v2ray/ang/ui/routing/RoutingEditActivity.kt - Routing editor → Settings and rules: saves rules
- Share-link formats → Profile and subscription store: imports profiles
- Connection state → Core lifecycle manager: starts core
- Core lifecycle manager → VPN service: controls service
V2rayNG/app/src/main/java/com/v2ray/ang/core/CoreServiceManager.kt - VPN service → Core configuration: builds configuration
V2rayNG/app/src/main/java/com/v2ray/ang/service/CoreVpnService.kt - VPN service → Native core: runs core
- VPN service → Android VPN: establishes tunnel
- Core configuration → Settings and rules: reads routing
- Aether core manager → Native core: manages core
V2rayNG/app/src/main/java/com/v2ray/ang/core/AetherCoreManager.kt - Root proxy mode → Profile and subscription store: reads selection
V2rayNG/app/src/main/java/com/v2ray/ang/root/RootProxyManager.kt - Connectivity tests → Native core: measures latency
V2rayNG/app/src/main/java/com/v2ray/ang/service/RealPingWorkerService.kt - Browser dialer → User: serves browser requests
- Xray extensions → Proxy profile model: adds cipher and fingerprint options
- Xray extensions → Core configuration: supports plaintext public VLESS and Trojan