How jagt/clumsy works
Main Components
• Packet Capture/Injection Layer: This layer is built on top of the WinDivert library (located under external/WinDivert-… directories). It handles interception of live network packets from the Windows network stack.
• Core Packet Processing/Manipulation Modules: In the “src” directory, there are several C source files (e.g., lag.c, drop.c, duplicate.c, tamper.c, throttle.c, packet.c) which indicate that different packet manipulation functions are implemented as separate modules. There is also a “common.h” that likely holds shared definitions.
• User Interface (UI) and Interactive Control: The project leverages IUP (found under external/iup-… directories) to create an interactive GUI. This module receives user input (e.g., when to start dropping or delaying packets) and provides visual feedback (as seen in the demo gif mentioned in the README).
• Configuration and Runtime Resource Files: The “etc” directory contains configuration, manifest, and resource files like clumsy.rc and config.txt, which likely support runtime settings and define application properties.
• Build and Script Infrastructure: Files such as build.zig and the scripts in the “scripts” folder represent the build and execution support, ensuring the project can be configured and launched correctly.
Relationships and Data Flow
• Client/User → UI Module: The user interacts with the GUI (built with IUP), triggering network manipulations.
• UI Module → Core Packet Processing: The UI sends commands to the underlying processing components that are implemented in various “*.c” files. Each module (for example, drop, lag, duplicate) is responsible for a specific network condition simulation.
• Core Processing → WinDivert Driver/Library: The core logic makes calls to the WinDivert library to capture live network packets. The library acts as the bridge between the user-level application and the network driver, manipulating packets as directed by the user.
• Configuration Files → Initialization/Runtime Control: At startup, configuration files (from the “etc” directory) may be read to set initial parameters or modify the behavior of the application.
Architectural Patterns and Design Principles
• Modular Design: The source files are organized functionally such that each packet manipulation behavior is encapsulated in its own module, enhancing clarity and maintainability.
• External Dependency Integration: The design incorporates libraries like WinDivert for low-level packet handling and IUP for the GUI. These should be highlighted as foundational external components that the application relies on.