# internet-equity/traceneck architecture

> Architecture diagram of the GitHub repository internet-equity/traceneck, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/internet-equity/traceneck
- Repository: https://github.com/internet-equity/traceneck

## Overview

##### Main Components

a. Core Components:
- Network Probing System
- Speed Testing Integration
- Packet Capture System
- Configuration Management
- Data Collection & Archive

b. External Dependencies:
- NDT7 Client
- Ookla Speedtest Client
- libpcap
- TShark (optional)

##### Component Organization

**┌─ User Interface Layer ─────────────────────┐**
- Command-line Interface (main.go)           │
- ┬─────────────────────────┘
- ↓
**┌─ Core Services Layer ──────────────────────┐**
- ┌─────────────┐ ┌──────────┐ ┌──────────┐ │
- Network   │ │   Ping   │ │  Config  │ │
- Module    │ │  Module  │ │  Module  │ │
- ┘ └──────────┘ └──────────┘ │
- ┬─────────────────────────┘
- ↓
**┌─ Integration Layer ──────────────────────────┐**
- ┌─────────────┐ ┌──────────┐ ┌──────────┐  │
- NDT7     │ │  Ookla   │ │ libpcap  │  │
- Client    │ │  Client  │ │          │  │
- ┘ └──────────┘ └──────────┘  │
- ┘

##### Component Relationships

a. Data Flow:
- CLI → Network Module
- Network Module ↔ Speed Test Clients
- Network Module ↔ Packet Capture
- Ping Module ↔ Network Interfaces

b. Dependencies:
- Config Module → All Components
- Archive Module → Data Collection

##### Specific Implementation Details

Important architectural elements:

a. Network Probing:
- ICMP/UDP ping capabilities
- TTL-based hop discovery
- Direct hop ping support

b. Speed Testing:
- NDT7 integration
- Ookla integration
- Packet capture during tests

c. Data Collection:
- Metadata gathering
- Archive creation
- Output formatting

##### The data collection and output options

Keep the abstraction level focused on the major components while showing the key integration points with external tools and libraries. This will help maintain clarity while providing sufficient technical detail for implementation understanding.

Remember to highlight the system's primary purpose: network bottleneck analysis in access networks, and how each component contributes to this goal.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI["User Interface Layer"]
        CLI["Command Line Interface"]:::ui
    end

    subgraph Core["Core Services Layer"]
        Network["Network Module"]:::core
        Ping["Ping Module"]:::core
        Config["Configuration Module"]:::core
        Archive["Archive System"]:::core
        Meta["Metadata Collection"]:::core
        Channel["Channel Management"]:::core
    end

    subgraph Integration["Integration Layer"]
        NDT7["NDT7 Client"]:::integration
        Ookla["Ookla Client"]:::integration
        Pcap["Packet Capture"]:::integration
        ICMP["ICMP Implementation"]:::integration
        UDP["UDP Implementation"]:::integration
    end

    subgraph Utils["Utility Layer"]
        OSUtil["OS Utilities"]:::util
        TermUtil["Terminal Utilities"]:::util
        TimeUtil["Time Utilities"]:::util
    end

    %% Relationships
    CLI --> Network
    CLI --> Config
    Network --> NDT7
    Network --> Ookla
    Network --> Pcap
    Ping --> ICMP
    Ping --> UDP
    Config --> Network
    Config --> Ping
    Config --> Archive
    Meta --> Archive
    Channel --> Network
    Channel --> Ping

    %% Click Events
    click CLI "https://github.com/internet-equity/traceneck/blob/main/main.go"
    click Network "https://github.com/internet-equity/traceneck/tree/main/internal/network"
    click Ping "https://github.com/internet-equity/traceneck/tree/main/internal/ping"
    click Config "https://github.com/internet-equity/traceneck/tree/main/internal/config"
    click Archive "https://github.com/internet-equity/traceneck/blob/main/internal/archive/tar.go"
    click Meta "https://github.com/internet-equity/traceneck/blob/main/internal/meta/metadata.go"
    click Channel "https://github.com/internet-equity/traceneck/blob/main/internal/channel/channels.go"
    click NDT7 "https://github.com/internet-equity/traceneck/blob/main/internal/network/client_ndt.go"
    click Ookla "https://github.com/internet-equity/traceneck/blob/main/internal/network/client_ookla.go"
    click Pcap "https://github.com/internet-equity/traceneck/blob/main/internal/network/packet_capture.go"
    click ICMP "https://github.com/internet-equity/traceneck/blob/main/internal/ping/icmp.go"
    click UDP "https://github.com/internet-equity/traceneck/blob/main/internal/ping/udp.go"
    click OSUtil "https://github.com/internet-equity/traceneck/blob/main/internal/util/os/os.go"
    click TermUtil "https://github.com/internet-equity/traceneck/blob/main/internal/util/term/term.go"
    click TimeUtil "https://github.com/internet-equity/traceneck/blob/main/internal/util/time/time.go"

    %% Styles
    classDef core fill:#2374ab
    classDef integration fill:#57a773
    classDef ui fill:#ffc857
    classDef util fill:#929292

    %% Legend
    subgraph Legend
        L1["Core Component"]:::core
        L2["Integration Component"]:::integration
        L3["User Interface"]:::ui
        L4["Utility Component"]:::util
    end
```
