vernet

Vernet Architecture Guide

Project Overview

Vernet is a cross-platform network analysis application built with Flutter. The application provides network utilities including device discovery, port scanning, DNS lookup, and internet speed testing.

The application targets:

All primary logic resides in the Flutter/Dart codebase inside lib/.


Architecture Style

The project follows a layered architecture commonly used in Flutter applications.

Layers:

UI Layer ↓ Feature Layer ↓ Service Layer ↓ Network / System Utilities

Each layer depends only on the layer below it.


Repository Structure

root │ ├── android/ ├── ios/ ├── linux/ ├── macos/ ├── windows/ ├── web/

├── assets/

├── lib/ │ │ ├── main.dart │ │ │ ├── pages/ │ │ Feature screens for each network tool │ │ │ ├── widgets/ │ │ Reusable UI components │ │ │ ├── services/ │ │ Core networking functionality │ │ │ ├── models/ │ │ Data models used across the app │ │ │ ├── utils/ │ │ Helper functions and utilities │ │ │ ├── providers/ │ │ Application state management │ │ │ └── routing/ │ Navigation configuration │ ├── test/ ├── integration_test/ ├── scripts/ └── pubspec.yaml


Module Dependency Graph

pages ↓ widgets ↓ providers ↓ services ↓ utils ↓ models

Key rule:

UI components must not directly perform network operations. Networking should always go through the services layer.


Feature Modules

Each network tool functions as a feature module.

Example feature structure:

lib/pages/host_scan_page/ lib/services/scanner_service.dart lib/models/device.dart

Typical module responsibilities:

Device Discovery

Detect devices on the local network.

Responsibilities:

Service location:

lib/services/network_scanner/


Device Trust

Remember which discovered devices the user trusts and alert when an untrusted one joins.

Responsibilities:

The registry is a drift table (KnownDevice), read through KnownDeviceRepository and orchestrated by lib/services/device_trust_service.dart. Scan results reach it from the host scan BLoC and the home page startup scan; both call recordScan(), which evaluates the batch, persists sightings, and raises the notification.


Port Scanner

Scan TCP ports on a target host.

Responsibilities:

Service location:

lib/services/port_scanner/


Vulnerability Analysis

Turn the ports a scan already stored into local security findings.

Responsibilities:

Service location:

lib/services/network_analysis/

Findings are NetworkFinding values in lib/models/network_finding.dart and render through lib/ui/network_finding_tile.dart. The device detail page shows them in its security findings card. Host scans are LAN-only, so SMB and NetBIOS are warnings rather than the critical they would be on an internet-facing host; Telnet is critical everywhere.


Device Risk

Sort each discovered device into the Low, Medium and High tiers its chip shows.

Responsibilities:

Service location:

lib/services/network_analysis/device_risk_analyzer.dart (pure per-device assessment) and device_risk_service.dart (adds the scan-history signal).

DeviceRiskService reads the stored device rows and scans once per report page. Live scan rows call the analyzer directly and show their tier without the history flag, because their scan is still running. Locally administered MACs are exempt from the unrecognized-vendor rule: phones rotate them by design, so an unmatched OUI says nothing there. The model lives in lib/models/device_risk.dart and renders through lib/ui/device_risk_chip.dart, using the green, amber and red semantic colors.


Network Health Report

Turn one scan’s findings into a graded, full-page report.

Scoring is a product baseline:

Each scan’s summary (score, grade, counts, scan start) is stored in the health_report drift table. The report compares against the most recent earlier scan that has a row; five points or more reads as improving or degrading, anything smaller as stable.

The page rebuilds its finding lists from the scan’s stored device rows, so only the snapshot is persisted. The export is the report as text on the clipboard, matching how the app copies other values.

Service location:

lib/services/network_analysis/network_health_report_service.dart builds the report and saves the snapshot, lib/repository/drift/health_report_repository.dart owns the table, and lib/pages/health_report/network_health_report_page.dart renders it. The scan report opens the page from its app bar, and a finished host scan stores its snapshot without waiting for the page.


Network Score

One 0-100 score across Security, Health, Reliability, Speed and Vulnerabilities, shown on the home card and the detail page.

The Security and Vulnerabilities dimensions read a NetworkScanAnalysis (lib/models/network_scan_analysis.dart) built from the latest scan’s device rows. The score service can also receive that analysis through the BLoC: a finished host scan dispatches it after its trust pass, so the verdicts it just stored are part of the score straight away.

Because the dimensions are rebuilt from whatever the latest scan stored, resolving an exposure raises the score on the next scan without extra state. Service location: lib/services/network_score_service.dart; the NetworkScoreBloc singleton lives under lib/pages/network_score/bloc/.


DNS Tools

Network lookup utilities.

Responsibilities:

Service location:

lib/services/dns_tools/


Wake on LAN

Send a magic packet to power on a device that supports Wake-on-LAN.

Responsibilities:

Service location:

lib/services/wake_on_lan_service.dart


Speed Test

Internet performance measurement.

Responsibilities:

Service location:

lib/services/speedtest/


UI Architecture

The UI is composed of Flutter widgets organized by feature screens.

Flow:

main.dart → Home screen → Feature screens → Widgets

Reusable components include:

All reusable components are located in:

lib/widgets/

Responsive chrome

The shell (TabBarPage) branches at TabBarPage.largeLayoutBreakpoint (600px): at or below it, it shows a drawer plus its own AppBar carrying the destination’s navigation label; above it, it shows the SidebarX rail and no bar of its own.


State Management

State is managed per feature screen.

Possible patterns:

State objects should remain independent from networking logic.


Data Flow

Typical execution flow:

User action → UI screen → Provider / controller → Service layer → Network utilities → Result returned to UI

Example:

Scan button → DeviceScannerScreen → NetworkScannerService → Ping / ARP scan → List<Device>{=html}


Platform Integrations

Platform specific code exists in:

android/ ios/ linux/ macos/ windows/

These layers provide:

The Flutter layer interacts with these through plugins or platform channels.


Testing Strategy

Two testing layers exist.

Unit Tests

test/

Integration Tests

integration_test/

Integration tests simulate full feature workflows.

Coverage folder

coverage/

Combined unit test file

coverage/lcov.info


Build and Distribution

The project supports building for multiple platforms using Flutter.

Example commands:

flutter build apk flutter build macos flutter build linux flutter build windows

Packaging scripts are located in:

scripts/installers/

Build flavors

Android builds in three flavors (dev, fdroid, store). Only store carries the proprietary SDKs, so the committed pubspec.yaml never declares them and the ad-free builds stay F-Droid compliant:

The release pipeline publishes from one build: release-android ships the ad-free APKs, then builds the store bundle in the same job and publish-play-store supplies it to Google Play, at the same stage as publish-snap does for the Snap Store.

Windows follows the same shape: release-windows builds the x64 and ARM64 packages, publish-windows packs them into one .msixbundle, and publish-ms-store hands that bundle to the live product through ms_store_release.yml. That workflow publishes the Store listing too, in the same submission: it uploads the package into a draft with --noCommit, overlays msstore/ onto a capture of that draft, and commits once. Listing text used to follow the package in a second submission through ms_store_metadata.yml, which could not work: submission update writes to the pending submission, and after the release commits that submission is already in certification. The ms-store-publish concurrency group now has a single writer, and the Store CLI only updates a product that is already live, which is why the first publication had to happen in Partner Center.

The listing is assembled rather than stored. msstore/<locale>/ holds one directory per language — title.txt, description.txt, features.txt, keywords.txt, release_notes.txt, and short_description.txt when that field is written — and dart run scripts/ms_store_listing.dart overlays those files onto a fresh msstore submission get capture. Screenshots, packages, markets and hardware come from the Store because nothing in git owns them; the prose comes from git because that is where a rewrite gets reviewed. The same script enforces the Store’s per-field limits — the 21 keyword words one listing may use, out of the 21 the whole submission shares, counted the way the server counts them: hyphens split and repeats are not de-duplicated, so Wi-Fi device scanner is four words. msstore/keyword_locales.txt names who spends that budget, currently en-us alone, and the assembler publishes an empty list everywhere else, because a field it leaves alone keeps the keywords the captured draft already serves and those words are charged against the same 21. Reading KeywordsTotalCount as a count of locales instead cost three refused releases, the last one sending ten locales at 192 words. The script also repairs the placeholder price a free product is captured with, and reports each field it changes by size, so a public CI log shows what moved without copying the listing into it.

The tree is named msstore/ at the repository root rather than metadata/store/, because F-Droid builds this same checkout and fdroidserver scans build/<package>/metadata/<locale>, copying any text it finds there over the listing it read from fastlane. A metadata/ directory here would quietly turn the Windows prose into the Android listing, whose summary limit is 80 characters, and pending/ would arrive there as languages no store serves.

Store copy is gated on wording as well as size. play_store_listing.dart and ms_store_listing.dart enforce each store’s field limits and locale parity; check_store_claims.dart reads the same two trees plus the snap description, the README and the landing page, and refuses a sentence claiming the app free, ad-free or free of tracking unless that sentence names the build the claim is true of. A single unqualified line would be a false statement about the Play bundle and an under-statement about F-Droid’s, so the check is on placement, which a script can decide, and not on truth, which it cannot. It runs in the unit matrix on every pull request, because a publish lane only reports the problem after the copy is already live.

An update replaces the whole submission, so a locale that git does not declare is carried through from the capture rather than dropped, and a locale in git that the product does not serve is refused until it is enabled in Partner Center — Store listing > Add/remove languages — with --allow-new-locales saying that has happened. Listing text has no publish lane of its own any more: a commit to msstore/** reaches shoppers with the next release, which is the run that can put a package and its words into one submission. The checked-in metadata.json capture this replaced went stale against the release that followed it, and a run publishing a listing whose package set no longer matched was a rollback waiting to happen.

The Android integration workflow runs the whole suite once per flavor as a matrix. flutter test --flavor injects the same define a build does, which is the only route to the gated branches: --dart-define=FLUTTER_APP_FLAVOR is rejected as a reserved tool name, so unit tests can never reach them. A suite that reaches flavor-gated UI has to read the gate constants instead of assuming one flavor — fdroid has no update tile, and store prepends a banner row to the host, port and DNS lists.


Design Principles

The repository follows these principles:

  1. Feature-based UI organization
  2. Service abstraction for networking
  3. Reusable widgets
  4. Minimal platform-specific logic
  5. Cross-platform compatibility

Rules for Contributors and AI Agents

When modifying this repository:

UI components → screens/ or widgets/

Networking functionality → services/

Data structures → models/

Helper utilities → utils/

Avoid placing network logic inside UI code.

Always reuse existing services when implementing new network features.


Typical Modification Examples

Adding a new network tool:

  1. Create new screen in screens/
  2. Create service in services/
  3. Create models if necessary
  4. Connect UI to service

Fixing UI:

Modify widgets or screen components only.

Fixing network logic:

Modify service layer without touching UI where possible.