# kioubit/pndpd architecture

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

- Interactive diagram: https://gitdiagram.com/kioubit/pndpd
- Repository: https://github.com/kioubit/pndpd

## Overview

##### Main Components

a) Core Components:
- NDP Packet Processing Engine (in /pndp directory)
- Module System (in /modules directory)
- Configuration Handler
- Network Interface Monitors

b) External Interfaces:
- Network Interfaces (physical/virtual)
- Linux Kernel BPF Integration
- Netlink Communication

- Configuration File Input
- Command Line Interface

- Module System
- NDP Proxy/Responder Logic

- BPF Filters
- Netlink Communication
- Interface Monitoring

##### Component Relationships

- Configuration → Module System
- Module System → NDP Processing Engine
- NDP Processing Engine ↔ Network Interfaces
- Interface Monitor → NDP Processing Engine

- Module System → Interface Monitoring
- Configuration → NDP Processing Rules

##### Specific Implementation Details

Technical elements:
- Module extension points
- Network interface pairs (external/internal)

- Blue: Core NDP processing components
- Green: Network interface related components
- Yellow: Configuration and user interface components
- Gray: External system components (kernel, network)

##### Technical Details

Annotations for:
- CAP_NET_RAW capability requirement
- IPv6 specific handling
- Whitelist functionality
- Auto-detection features

- Component type indicators
- Interface boundaries

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph User_Layer
        Config["Configuration File"]:::config
        CLI["Command Line Interface"]:::config
    end

    subgraph Core_Processing
        ModSys["Module System"]:::core
        NDPEngine["NDP Packet Processing Engine"]:::core
        FlowCtrl["Flow Controller"]:::core
        NDPReq["NDP Request Handler"]:::core
        NDPResp["NDP Responder"]:::core
    end

    subgraph Network_Layer
        BPF["BPF Filters"]:::network
        Netlink["Netlink Communication"]:::network
        IntMon["Interface Monitor"]:::network
        IntMgmt["Interface Management"]:::network
        NetListen["Network Listener"]:::network
    end

    subgraph External_Systems
        Kernel["Linux Kernel"]:::external
        NetInt["Network Interfaces"]:::external
    end

    %% Connections
    Config --> ModSys
    CLI --> ModSys
    ModSys --> NDPEngine
    NDPEngine <--> FlowCtrl
    FlowCtrl <--> NDPReq
    NDPReq <--> NDPResp
    NDPEngine <--> Netlink
    IntMon --> NDPEngine
    IntMon <--> IntMgmt
    NetListen --> NDPEngine
    Netlink <--> Kernel
    BPF <--> Kernel
    Kernel <--> NetInt

    %% Click Events
    click NDPEngine "https://github.com/Kioubit/pndpd/blob/master/pndp/packet.go"
    click ModSys "https://github.com/Kioubit/pndpd/blob/master/modules/modules.go"
    click Config "https://github.com/Kioubit/pndpd/blob/master/config.go"
    click IntMon "https://github.com/Kioubit/pndpd/blob/master/pndp/interfaceMon.go"
    click IntMgmt "https://github.com/Kioubit/pndpd/blob/master/pndp/interface.go"
    click Netlink "https://github.com/Kioubit/pndpd/blob/master/pndp/netlink.go"
    click NDPReq "https://github.com/Kioubit/pndpd/blob/master/pndp/NDPRequest.go"
    click FlowCtrl "https://github.com/Kioubit/pndpd/blob/master/pndp/flow.go"
    click NDPResp "https://github.com/Kioubit/pndpd/blob/master/pndp/responder.go"
    click CLI "https://github.com/Kioubit/pndpd/blob/master/modules/userInterface/userInterface.go"
    click Config "https://github.com/Kioubit/pndpd/blob/master/pndpd.conf"
    click NetListen "https://github.com/Kioubit/pndpd/blob/master/pndp/listener.go"

    %% Styles
    classDef core fill:#2374ab
    classDef network fill:#47a025
    classDef config fill:#ffb347
    classDef external fill:#808080
    
    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Network Components"]:::network
        L3["Configuration Components"]:::config
        L4["External Systems"]:::external
    end
```
