How ukanth/afwall works
Main Components
a. Core Components:
• IPTables Management Layer
• Firewall Rules Engine
• Application Interface Layer
• Storage & Persistence Layer
• System Services Layer
b. Supporting Components:
• Native Binary Components (busybox, iptables)
• Root Access Management
• Event Handling System
• Profile Management
• Logging System
Component Relationships
a. User Interface Layer:
• Main Activity (MainActivity.java)
• Preference Management (preferences/*)
• Profile Management (profiles/*)
• Log Viewer (log/*)
• Custom Rules Interface (customrules/*)
b. Business Logic Layer:
• Firewall Service (service/FirewallService.java)
• Rules Application Service (service/RulesApplyService.java)
• Root Shell Service (service/RootShellService.java)
• Interface Tracker (InterfaceTracker.java)
c. Data Layer:
• Profile Database (profiles/ProfilesDatabase.java)
• Log Database (log/LogDatabase.java)
• Custom Rules Database (customrules/CustomRuleDatabase.java)
• Preferences Storage (preferences/*)
Architectural Patterns to Highlight
• Event-driven architecture (using RxJava events)
• Service-oriented architecture for background operations
• Repository pattern for data access
• Observer pattern for interface tracking
• Factory pattern for rule creation
External Integrations
• Root Access Interface
• System IPTables
• Network Interfaces
• VPN Service
• Xposed Framework Integration
Data Flow Indicators
Following flows:
• User input → Rules Engine → IPTables
• Network Events → Interface Tracker → Rule Application
• Application Events → Log Service → Storage
• Profile Selection → Rules Application
Security Boundaries
Highlight:
• Root access boundary
• System service boundary
• Application sandbox boundary
• Network interface boundary
┌─ User Interface Layer ─────────────────────┐
• Activities | Fragments | Preferences | UI │
• Business Logic Layer ────────────────────┤
• Services | Rules Engine | Event Handlers │
• Data Access Layer ──────────────────────┤
• Databases | Preferences | File Storage │
• System Integration Layer ───────────────┤
• Root Access | IPTables | Network Interface│
• ┘
• Component types and their visual representations
• Security boundary markings
• Integration points
• Event flow indicators
Keep the abstraction level high enough to show the overall architecture while including sufficient detail to understand the system's operation. Focus on the security-critical paths and data flows, as this is a firewall application.