# hmz777/netstalker architecture

> Architecture diagram of the GitHub repository hmz777/netstalker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hmz777/netstalker
- Repository: https://github.com/hmz777/netstalker

## Overview

NetStalker is a Windows desktop tool for discovering LAN devices and managing their network access and bandwidth. Users select an adapter, monitor discovered devices, then block or redirect devices, set per-device limits, or inspect and export captured packets. Main coordinates the interface and device actions; Scanner handles discovery, while separate traffic-control and packet-sniffing components provide the core network capabilities. The README documents several user-facing features whose exact wiring is not visible in the excerpts; those links are shown only where documented.

Main entry points: [`NetStalker/NetStalker/Forms/Main/Main.cs`](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/Forms/Main/Main.cs) (Main window), [`NetStalker/NetStalker/Forms/Main/Sniffer.cs`](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/Forms/Main/Sniffer.cs) (Sniffer viewer), [`NetStalker/NetStalker/MainLogic/Scanner.cs`](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/Scanner.cs) (LAN scanner), [`NetStalker/NetStalker/MainLogic/Controller.cs`](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/Controller.cs) (App controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop interface"]
  node_main["Main window<br/>[Main.cs]"]
  node_nic["Adapter selection<br/>[NicSelection.cs]"]
  node_limiter["Speed limiter<br/>[LimiterSpeed.cs]"]
  node_options["Options<br/>[Options.cs]"]
  node_snifferui["Sniffer viewer<br/>[Sniffer.cs]"]
  node_message["Message dialog<br/>[MessageBoxForm.cs]"]
end

subgraph group_discovery["Device discovery"]
  node_scanner["LAN scanner<br/>[Scanner.cs]"]
  node_device["Device state<br/>[Device.cs]"]
  node_vendor["Vendor lookup<br/>[VendorAPI.cs]"]
end

subgraph group_control["Traffic control"]
  node_blocker["Block and redirect"]
end

subgraph group_sniff["Packet inspection"]
  node_packet["Packet record<br/>[AcceptedPacket.cs]"]
end

subgraph group_support["App services"]
  node_configuration["App configuration"]
  node_controller["App controller<br/>[Controller.cs]"]
  node_tools["Network utilities<br/>[Tools.cs]"]
  node_toast["Toast notifications<br/>[ToastAPI.cs]"]
end

node_user(("User"))
node_network(("Local network"))

node_user -->|"uses"| node_main
node_main -->|"opens"| node_nic
node_main -->|"refreshes clients"| node_controller
node_controller -->|"starts scan"| node_scanner
node_scanner -->|"probes devices"| node_network
node_scanner -->|"creates state"| node_device
node_scanner -->|"looks up vendor"| node_vendor
node_main -->|"manages access"| node_blocker
node_main -->|"opens limiter"| node_limiter
node_limiter -->|"sets device caps"| node_device
node_main -->|"opens sniffer"| node_snifferui
node_snifferui -->|"captures packets"| node_network
node_snifferui -->|"records packets"| node_packet
node_main -->|"reads settings"| node_configuration
node_scanner -->|"reads network settings"| node_configuration
node_snifferui -->|"reads capture options"| node_configuration
node_main -->|"shows notifications"| node_toast
node_controller -->|"cleans notifications"| node_toast
node_toast -->|"dispatches actions"| node_main
node_main -->|"opens options"| node_options
node_snifferui -->|"shows dialog"| node_message
node_main -->|"shows dialog"| node_message
node_scanner -->|"uses network helpers"| node_tools
node_snifferui -->|"uses packet helpers"| node_tools
node_user -->|"configures preferences"| node_options
node_user -->|"inspects and exports"| node_snifferui
node_network -->|"access is redirected or blocked"| node_blocker
node_network -->|"traffic is captured"| node_snifferui

click node_main "https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/Forms/Main/Main.cs"
click node_nic "https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/Forms/Main/NicSelection.cs"
click node_limiter "https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/Forms/Main/LimiterSpeed.cs"
click node_options "https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/Forms/Options/Options.cs"
click node_snifferui "https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/Forms/Main/Sniffer.cs"
click node_scanner "https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/Scanner.cs"
click node_device "https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/Device.cs"
click node_vendor "https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/MacVendors/VendorAPI.cs"
click node_blocker "https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/Blocker-Redirector.cs"
click node_packet "https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/AcceptedPacket.cs"
click node_configuration "https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/AppConfiguration.cs"
click node_controller "https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/Controller.cs"
click node_tools "https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/Tools.cs"
click node_toast "https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/ToastNotifications/ToastAPI.cs"
click node_message "https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/Forms/Information/MessageBoxForm.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_nic,node_limiter,node_options,node_snifferui,node_message,node_user toneBlue
class node_scanner,node_device,node_vendor toneAmber
class node_blocker toneMint
class node_packet toneRose
class node_configuration,node_controller,node_tools,node_toast,node_network toneIndigo
```

## Components

### Desktop interface

- [Main window](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/Forms/Main/Main.cs): `NetStalker/NetStalker/Forms/Main/Main.cs`
- [Adapter selection](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/Forms/Main/NicSelection.cs): `NetStalker/NetStalker/Forms/Main/NicSelection.cs`
- [Speed limiter](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/Forms/Main/LimiterSpeed.cs): `NetStalker/NetStalker/Forms/Main/LimiterSpeed.cs`
- [Options](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/Forms/Options/Options.cs): `NetStalker/NetStalker/Forms/Options/Options.cs`
- [Sniffer viewer](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/Forms/Main/Sniffer.cs): `NetStalker/NetStalker/Forms/Main/Sniffer.cs`
- [Message dialog](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/Forms/Information/MessageBoxForm.cs): `NetStalker/NetStalker/Forms/Information/MessageBoxForm.cs`

### Device discovery

- [LAN scanner](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/Scanner.cs): `NetStalker/NetStalker/MainLogic/Scanner.cs`
- [Device state](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/Device.cs): `NetStalker/NetStalker/MainLogic/Device.cs`
- [Vendor lookup](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/MacVendors/VendorAPI.cs): `NetStalker/NetStalker/MainLogic/MacVendors/VendorAPI.cs`

### Traffic control

- [Block and redirect](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/Blocker-Redirector.cs): `NetStalker/NetStalker/MainLogic/Blocker-Redirector.cs`

### Packet inspection

- [Packet record](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/AcceptedPacket.cs): `NetStalker/NetStalker/MainLogic/AcceptedPacket.cs`

### App services

- [App configuration](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/AppConfiguration.cs): `NetStalker/NetStalker/MainLogic/AppConfiguration.cs`
- [App controller](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/Controller.cs): `NetStalker/NetStalker/MainLogic/Controller.cs`
- [Network utilities](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/MainLogic/Tools.cs): `NetStalker/NetStalker/MainLogic/Tools.cs`
- [Toast notifications](https://github.com/hmz777/netstalker/blob/master/NetStalker/NetStalker/ToastNotifications/ToastAPI.cs): `NetStalker/NetStalker/ToastNotifications/ToastAPI.cs`

### Other components

- **User**
- **Local network**

## Connections

- User → Main window: uses (evidence: `README.md`)
- Main window → Adapter selection: opens (evidence: `NetStalker/NetStalker/Forms/Main/Main.cs`)
- Main window → App controller: refreshes clients (evidence: `NetStalker/NetStalker/MainLogic/Controller.cs`)
- App controller → LAN scanner: starts scan (evidence: `NetStalker/NetStalker/MainLogic/Controller.cs`)
- LAN scanner → Local network: probes devices (evidence: `NetStalker/NetStalker/MainLogic/Scanner.cs`)
- LAN scanner → Device state: creates state (evidence: `NetStalker/NetStalker/MainLogic/Scanner.cs`)
- LAN scanner → Vendor lookup: looks up vendor (evidence: `NetStalker/NetStalker/MainLogic/Scanner.cs`)
- Main window → Block and redirect: manages access (evidence: `NetStalker/NetStalker/MainLogic/Blocker-Redirector.cs`)
- Main window → Speed limiter: opens limiter (evidence: `NetStalker/NetStalker/Forms/Main/Main.cs`)
- Speed limiter → Device state: sets device caps (evidence: `NetStalker/NetStalker/Forms/Main/LimiterSpeed.cs`)
- Main window → Sniffer viewer: opens sniffer (evidence: `NetStalker/NetStalker/Forms/Main/Main.cs`)
- Sniffer viewer → Local network: captures packets (evidence: `NetStalker/NetStalker/Forms/Main/Sniffer.cs`)
- Sniffer viewer → Packet record: records packets (evidence: `NetStalker/NetStalker/Forms/Main/Sniffer.cs`)
- Main window → App configuration: reads settings (evidence: `NetStalker/NetStalker/Forms/Main/Main.cs`)
- LAN scanner → App configuration: reads network settings (evidence: `NetStalker/NetStalker/MainLogic/Scanner.cs`)
- Sniffer viewer → App configuration: reads capture options (evidence: `NetStalker/NetStalker/Forms/Main/Sniffer.cs`)
- Main window → Toast notifications: shows notifications (evidence: `NetStalker/NetStalker/Forms/Main/Main.cs`)
- App controller → Toast notifications: cleans notifications (evidence: `NetStalker/NetStalker/MainLogic/Controller.cs`)
- Toast notifications → Main window: dispatches actions (evidence: `NetStalker/NetStalker/ToastNotifications/ToastAPI.cs`)
- Main window → Options: opens options (evidence: `NetStalker/NetStalker/Forms/Main/Main.cs`)
- Sniffer viewer → Message dialog: shows dialog (evidence: `NetStalker/NetStalker/Forms/Main/Sniffer.cs`)
- Main window → Message dialog: shows dialog (evidence: `NetStalker/NetStalker/Forms/Main/Main.cs`)
- LAN scanner → Network utilities: uses network helpers (evidence: `NetStalker/NetStalker/MainLogic/Scanner.cs`)
- Sniffer viewer → Network utilities: uses packet helpers (evidence: `NetStalker/NetStalker/Forms/Main/Sniffer.cs`)
- User → Options: configures preferences (evidence: `README.md`)
- User → Sniffer viewer: inspects and exports (evidence: `README.md`)
- Local network → Block and redirect: access is redirected or blocked (evidence: `README.md`)
- Local network → Sniffer viewer: traffic is captured (evidence: `README.md`)
