# kilop206/kns architecture

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

- Interactive diagram: https://gitdiagram.com/kilop206/kns
- Repository: https://github.com/kilop206/kns

## Overview

KNS is a deterministic discrete-event network simulator with GUI and headless entry points. Users load or edit a topology, configure a run, and execute simulated packet and TCP traffic; the engine applies routing, links, queues, services, and events, then exposes statistics or CSV output. The desktop app also provides topology discovery/editing, route and packet inspection, analysis, and optional conversational analysis and translation. Some UI subsystems are represented by their source directories because their implementation excerpts were not provided; edges rely on README statements or indexed references.

Main entry points: [`core/src/engine/core/SimulationEngine.cpp`](https://github.com/kilop206/kns/blob/main/core/src/engine/core/SimulationEngine.cpp) (Simulation engine), [`app/gui/src`](https://github.com/kilop206/kns/tree/main/app/gui/src) (GUI panels), [`app/main.cpp`](https://github.com/kilop206/kns/blob/main/app/main.cpp) (Application runner), [`core/src/network/Topology.cpp`](https://github.com/kilop206/kns/blob/main/core/src/network/Topology.cpp) (Topology model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_main["Application runner<br/>[main.cpp]"]
  node_console["Device CLI<br/>[DeviceConsole.cpp]"]
end

subgraph group_topology["Topology and discovery"]
  node_topoloader["Topology loader<br/>[TopologyLoader.cpp]"]
  node_topology["Topology model<br/>[Topology.cpp]"]
  node_discovery["Live discovery"]
  node_hub["Topology Hub"]
end

subgraph group_runtime["Simulation runtime"]
  node_engine["Simulation engine"]
  node_routing["Route selection<br/>[Routing.cpp]"]
  node_links["Link behavior<br/>[Link.cpp]"]
  node_events["Event processing<br/>[EventQueue.cpp]"]
  node_tcp["TCP transport<br/>[TCPSession.cpp]"]
  node_services["Simulated services<br/>[ServiceRuntime.cpp]"]
end

subgraph group_insight["Analysis and services"]
  node_analysis["Network analysis"]
  node_intelligence["Topology intelligence"]
end

subgraph group_desktop["Desktop experience"]
  node_gui["GUI panels"]
  node_visualization["Packet visualization"]
  node_translation["GUI translation"]
end

node_user(("Operator"))
node_kiwi["KiWi service"]
node_translator["Translation API"]
node_csv["CSV results"]

node_user -->|"runs"| node_main
node_main -->|"loads topology"| node_topoloader
node_main -->|"fetches or saves"| node_hub
node_main -->|"configures and runs"| node_engine
node_main -->|"opens interface"| node_gui
node_main -->|"exports statistics"| node_csv
node_console -.->|"operates devices"| node_engine
node_topoloader -->|"creates topology"| node_topology
node_hub -->|"parses topology"| node_topoloader
node_gui -->|"edits topology"| node_topology
node_gui -->|"shows discovery"| node_discovery
node_engine -->|"uses topology"| node_topology
node_engine -->|"builds routes"| node_routing
node_routing -->|"reads links"| node_topology
node_engine -.->|"sends packets"| node_links
node_engine -->|"processes events"| node_events
node_engine -->|"manages sessions"| node_tcp
node_engine -->|"hosts runtime"| node_services
node_gui -->|"configures simulation"| node_engine
node_gui -.->|"observes packets"| node_visualization
node_gui -.->|"requests analysis"| node_analysis
node_analysis -.->|"provides context"| node_intelligence
node_intelligence -->|"sends chat"| node_kiwi
node_gui -->|"requests translations"| node_translation
node_translation -->|"translates asynchronously"| node_translator
node_gui -->|"offers device CLI"| node_console

click node_main "https://github.com/kilop206/kns/blob/main/app/main.cpp"
click node_console "https://github.com/kilop206/kns/blob/main/app/cli/DeviceConsole.cpp"
click node_topoloader "https://github.com/kilop206/kns/blob/main/core/src/network/TopologyLoader.cpp"
click node_topology "https://github.com/kilop206/kns/blob/main/core/src/network/Topology.cpp"
click node_discovery "https://github.com/kilop206/kns/blob/main/core/src/network/LiveTopologyWatcher.cpp"
click node_hub "https://github.com/kilop206/kns/blob/main/app/hub/TopologyHubClient.cpp"
click node_engine "https://github.com/kilop206/kns/blob/main/core/src/engine/core/SimulationEngine.cpp"
click node_routing "https://github.com/kilop206/kns/blob/main/core/src/network/Routing.cpp"
click node_links "https://github.com/kilop206/kns/blob/main/core/src/network/Link.cpp"
click node_events "https://github.com/kilop206/kns/blob/main/core/src/engine/core/EventQueue.cpp"
click node_tcp "https://github.com/kilop206/kns/blob/main/core/src/network/transport/tcp/TCPSession.cpp"
click node_services "https://github.com/kilop206/kns/blob/main/core/src/network/services/ServiceRuntime.cpp"
click node_analysis "https://github.com/kilop206/kns/blob/main/core/src/analysis/NetworkAnalyzer.cpp"
click node_intelligence "https://github.com/kilop206/kns/blob/main/app/intelligence/IntelligenceService.cpp"
click node_gui "https://github.com/kilop206/kns/tree/main/app/gui/src"
click node_visualization "https://github.com/kilop206/kns/blob/main/app/gui/src/VisualPacketManager.cpp"
click node_translation "https://github.com/kilop206/kns/blob/main/app/gui/src/TranslationService.cpp"

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_console toneBlue
class node_topoloader,node_topology,node_discovery,node_hub toneAmber
class node_engine,node_routing,node_links,node_events,node_tcp,node_services,node_translator toneMint
class node_analysis,node_intelligence toneRose
class node_gui,node_visualization,node_translation,node_user,node_kiwi,node_csv toneIndigo
```

## Components

### Application entry

- [Application runner](https://github.com/kilop206/kns/blob/main/app/main.cpp): `app/main.cpp`
- [Device CLI](https://github.com/kilop206/kns/blob/main/app/cli/DeviceConsole.cpp): `app/cli/DeviceConsole.cpp`

### Topology and discovery

- [Topology loader](https://github.com/kilop206/kns/blob/main/core/src/network/TopologyLoader.cpp): `core/src/network/TopologyLoader.cpp`
- [Topology model](https://github.com/kilop206/kns/blob/main/core/src/network/Topology.cpp): `core/src/network/Topology.cpp`
- [Live discovery](https://github.com/kilop206/kns/blob/main/core/src/network/LiveTopologyWatcher.cpp): `core/src/network/LiveTopologyWatcher.cpp`
- [Topology Hub](https://github.com/kilop206/kns/blob/main/app/hub/TopologyHubClient.cpp): `app/hub/TopologyHubClient.cpp`

### Simulation runtime

- [Simulation engine](https://github.com/kilop206/kns/blob/main/core/src/engine/core/SimulationEngine.cpp): `core/src/engine/core/SimulationEngine.cpp`
- [Route selection](https://github.com/kilop206/kns/blob/main/core/src/network/Routing.cpp): `core/src/network/Routing.cpp`
- [Link behavior](https://github.com/kilop206/kns/blob/main/core/src/network/Link.cpp): `core/src/network/Link.cpp`
- [Event processing](https://github.com/kilop206/kns/blob/main/core/src/engine/core/EventQueue.cpp): `core/src/engine/core/EventQueue.cpp`
- [TCP transport](https://github.com/kilop206/kns/blob/main/core/src/network/transport/tcp/TCPSession.cpp): `core/src/network/transport/tcp/TCPSession.cpp`
- [Simulated services](https://github.com/kilop206/kns/blob/main/core/src/network/services/ServiceRuntime.cpp): `core/src/network/services/ServiceRuntime.cpp`

### Analysis and services

- [Network analysis](https://github.com/kilop206/kns/blob/main/core/src/analysis/NetworkAnalyzer.cpp): `core/src/analysis/NetworkAnalyzer.cpp`
- [Topology intelligence](https://github.com/kilop206/kns/blob/main/app/intelligence/IntelligenceService.cpp): `app/intelligence/IntelligenceService.cpp`

### Desktop experience

- [GUI panels](https://github.com/kilop206/kns/tree/main/app/gui/src): `app/gui/src`
- [Packet visualization](https://github.com/kilop206/kns/blob/main/app/gui/src/VisualPacketManager.cpp): `app/gui/src/VisualPacketManager.cpp`
- [GUI translation](https://github.com/kilop206/kns/blob/main/app/gui/src/TranslationService.cpp): `app/gui/src/TranslationService.cpp`

### Other components

- **Operator**
- **KiWi service**
- **Translation API**
- **CSV results**

## Connections

- Operator → Application runner: runs (evidence: `README.md`)
- Application runner → Topology loader: loads topology (evidence: `README.md`)
- Application runner → Topology Hub: fetches or saves (evidence: `app/main.cpp`)
- Application runner → Simulation engine: configures and runs (evidence: `app/main.cpp`)
- Application runner → GUI panels: opens interface (evidence: `README.md`)
- Application runner → CSV results: exports statistics (evidence: `README.md`)
- Device CLI → Simulation engine: operates devices
- Topology loader → Topology model: creates topology
- Topology Hub → Topology loader: parses topology (evidence: `app/hub/TopologyHubClient.cpp`)
- GUI panels → Topology model: edits topology (evidence: `README.md`)
- GUI panels → Live discovery: shows discovery (evidence: `README.md`)
- Simulation engine → Topology model: uses topology
- Simulation engine → Route selection: builds routes
- Route selection → Topology model: reads links (evidence: `core/src/network/Routing.cpp`)
- Simulation engine → Link behavior: sends packets
- Simulation engine → Event processing: processes events
- Simulation engine → TCP transport: manages sessions
- Simulation engine → Simulated services: hosts runtime
- GUI panels → Simulation engine: configures simulation (evidence: `README.md`)
- GUI panels → Packet visualization: observes packets
- GUI panels → Network analysis: requests analysis
- Network analysis → Topology intelligence: provides context
- Topology intelligence → KiWi service: sends chat (evidence: `README.md`)
- GUI panels → GUI translation: requests translations
- GUI translation → Translation API: translates asynchronously (evidence: `README.md`)
- GUI panels → Device CLI: offers device CLI (evidence: `README.md`)
