# d80y6/yemenantiddos architecture

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

- Interactive diagram: https://gitdiagram.com/d80y6/yemenantiddos
- Repository: https://github.com/d80y6/yemenantiddos

## Overview

YemenAntiDDoS is a distributed DDoS detection and response platform. Nodes observe traffic through XDP/eBPF, flow receivers, and Layer 7 inspection, then stream telemetry to the Controller. The Controller ingests node data, detects attacks using thresholds and learned baselines, and dispatches mitigation actions; operators configure and review the system through the Vue console. The README documents capabilities such as inline scrubbing, BGP Flowspec, and connector integrations, but their detailed internal wiring is not fully sampled, so those links are omitted where unverified.

Main entry points: [`node/main.go`](https://github.com/d80y6/yemenantiddos/blob/main/node/main.go) (Node Runtime), [`controller/internal/action/engine.go`](https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/action/engine.go) (Response Engine), [`controller/internal/store/postgres/postgres.go`](https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/store/postgres/postgres.go) (TimescaleDB), [`controller/internal/ingestion/grpc_handler.go`](https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/ingestion/grpc_handler.go) (gRPC Ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_node["Node Sensors"]
  node_node_runtime["Node Runtime<br/>[main.go]"]
  node_bpf_capture["XDP Capture<br/>[xsight.c]"]
  node_flow_capture["Flow Collection<br/>[listener.go]"]
  node_sampling["Packet Sampling<br/>[sampler.go]"]
  node_l7_inspection["L7 Inspection<br/>[collector.go]"]
  node_reporter["Node Reporter<br/>[reporter.go]"]
end

subgraph group_controller["Controller Plane"]
  node_grpc_ingestion["gRPC Ingestion<br/>[grpc_handler.go]"]
  node_ingestion_writers["Telemetry Writers<br/>[db_writer.go]"]
  node_detection_engine["Detection Engine<br/>[detector.go]"]
  node_baseline_engine["Baseline Detection<br/>[calculator.go]"]
  node_attack_tracking["Attack Tracking<br/>[tracker.go]"]
  node_response_engine["Response Engine<br/>[engine.go]"]
  node_controller_api["HTTP API<br/>[router.go]"]
  node_database[("TimescaleDB<br/>[postgres.go]")]
end

subgraph group_console["Operator Console"]
  node_console_app["Console Application<br/>[main.ts]"]
  node_console_routes["Console Routes<br/>[router.ts]"]
  node_console_shell["Console Shell<br/>[Shell.vue]"]
  node_console_api["Console API Client<br/>[client.ts]"]
  node_attack_views["Attack Views<br/>[AttackDetail.vue]"]
  node_operations_views["Operations Views<br/>[Overview.vue]"]
end

subgraph group_mitigation["Mitigation Integrations"]
  node_bgp["BGP Speaker<br/>[gobgp.go]"]
  node_xdp_rules["Inline BPF Rules<br/>[inline.go]"]
  node_external_integrations["Webhook, xDrop<br/>[webhook.go]"]
end

node_operator(("Operator"))

node_node_runtime -->|"attaches XDP"| node_bpf_capture
node_node_runtime -.->|"starts collection"| node_flow_capture
node_node_runtime -->|"starts sampler"| node_sampling
node_node_runtime -.->|"starts inspection"| node_l7_inspection
node_node_runtime -->|"starts reporter"| node_reporter
node_reporter -->|"streams telemetry"| node_grpc_ingestion
node_grpc_ingestion -->|"submits samples"| node_ingestion_writers
node_grpc_ingestion -->|"reads node records"| node_database
node_ingestion_writers -.->|"writes telemetry"| node_database
node_detection_engine -.->|"raises detections"| node_attack_tracking
node_baseline_engine -.->|"raises deviations"| node_attack_tracking
node_attack_tracking -->|"dispatches events"| node_response_engine
node_response_engine -->|"loads action state"| node_database
node_response_engine -->|"announces routes"| node_bgp
node_response_engine -.->|"executes responses"| node_external_integrations
node_operator -->|"uses"| node_console_app
node_console_app -->|"installs router"| node_console_routes
node_console_app -->|"mounts application"| node_console_shell
node_console_routes -->|"routes attacks"| node_attack_views
node_console_routes -->|"routes overview"| node_operations_views
node_attack_views -->|"requests data"| node_console_api
node_operations_views -.->|"requests data"| node_console_api
node_console_api -.->|"sends HTTP requests"| node_controller_api
node_controller_api -.->|"serves stored data"| node_database
node_response_engine -.->|"pushes inline rules"| node_xdp_rules

click node_node_runtime "https://github.com/d80y6/yemenantiddos/blob/main/node/main.go"
click node_bpf_capture "https://github.com/d80y6/yemenantiddos/blob/main/node/bpf/xsight.c"
click node_flow_capture "https://github.com/d80y6/yemenantiddos/blob/main/node/internal/flow/listener.go"
click node_sampling "https://github.com/d80y6/yemenantiddos/blob/main/node/internal/sampler/sampler.go"
click node_l7_inspection "https://github.com/d80y6/yemenantiddos/blob/main/node/internal/l7collector/collector.go"
click node_reporter "https://github.com/d80y6/yemenantiddos/blob/main/node/internal/reporter/reporter.go"
click node_grpc_ingestion "https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/ingestion/grpc_handler.go"
click node_ingestion_writers "https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/ingestion/db_writer.go"
click node_detection_engine "https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/engine/threshold/detector.go"
click node_baseline_engine "https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/engine/baseline/calculator.go"
click node_attack_tracking "https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/tracker/tracker.go"
click node_response_engine "https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/action/engine.go"
click node_controller_api "https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/api/router.go"
click node_database "https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/store/postgres/postgres.go"
click node_console_app "https://github.com/d80y6/yemenantiddos/blob/main/controller/console/src/main.ts"
click node_console_routes "https://github.com/d80y6/yemenantiddos/blob/main/controller/console/src/router.ts"
click node_console_shell "https://github.com/d80y6/yemenantiddos/blob/main/controller/console/src/components/Shell.vue"
click node_console_api "https://github.com/d80y6/yemenantiddos/blob/main/controller/console/src/api/client.ts"
click node_attack_views "https://github.com/d80y6/yemenantiddos/blob/main/controller/console/src/views/attacks/AttackDetail.vue"
click node_operations_views "https://github.com/d80y6/yemenantiddos/blob/main/controller/console/src/views/overview/Overview.vue"
click node_bgp "https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/bgp/gobgp.go"
click node_xdp_rules "https://github.com/d80y6/yemenantiddos/blob/main/node/internal/bpf/inline.go"
click node_external_integrations "https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/action/webhook.go"

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_node_runtime,node_bpf_capture,node_flow_capture,node_sampling,node_l7_inspection,node_reporter toneBlue
class node_grpc_ingestion,node_ingestion_writers,node_detection_engine,node_baseline_engine,node_attack_tracking,node_response_engine,node_controller_api,node_database toneAmber
class node_console_app,node_console_routes,node_console_shell,node_console_api,node_attack_views,node_operations_views toneMint
class node_bgp,node_xdp_rules,node_external_integrations toneRose
class node_operator toneIndigo
```

## Components

### Node Sensors

- [Node Runtime](https://github.com/d80y6/yemenantiddos/blob/main/node/main.go): `node/main.go`
- [XDP Capture](https://github.com/d80y6/yemenantiddos/blob/main/node/bpf/xsight.c): `node/bpf/xsight.c`
- [Flow Collection](https://github.com/d80y6/yemenantiddos/blob/main/node/internal/flow/listener.go): `node/internal/flow/listener.go`
- [Packet Sampling](https://github.com/d80y6/yemenantiddos/blob/main/node/internal/sampler/sampler.go): `node/internal/sampler/sampler.go`
- [L7 Inspection](https://github.com/d80y6/yemenantiddos/blob/main/node/internal/l7collector/collector.go): `node/internal/l7collector/collector.go`
- [Node Reporter](https://github.com/d80y6/yemenantiddos/blob/main/node/internal/reporter/reporter.go): `node/internal/reporter/reporter.go`

### Controller Plane

- [gRPC Ingestion](https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/ingestion/grpc_handler.go): `controller/internal/ingestion/grpc_handler.go`
- [Telemetry Writers](https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/ingestion/db_writer.go): `controller/internal/ingestion/db_writer.go`
- [Detection Engine](https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/engine/threshold/detector.go): `controller/internal/engine/threshold/detector.go`
- [Baseline Detection](https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/engine/baseline/calculator.go): `controller/internal/engine/baseline/calculator.go`
- [Attack Tracking](https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/tracker/tracker.go): `controller/internal/tracker/tracker.go`
- [Response Engine](https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/action/engine.go): `controller/internal/action/engine.go`
- [HTTP API](https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/api/router.go): `controller/internal/api/router.go`
- [TimescaleDB](https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/store/postgres/postgres.go): `controller/internal/store/postgres/postgres.go`

### Operator Console

- [Console Application](https://github.com/d80y6/yemenantiddos/blob/main/controller/console/src/main.ts): `controller/console/src/main.ts`
- [Console Routes](https://github.com/d80y6/yemenantiddos/blob/main/controller/console/src/router.ts): `controller/console/src/router.ts`
- [Console Shell](https://github.com/d80y6/yemenantiddos/blob/main/controller/console/src/components/Shell.vue): `controller/console/src/components/Shell.vue`
- [Console API Client](https://github.com/d80y6/yemenantiddos/blob/main/controller/console/src/api/client.ts): `controller/console/src/api/client.ts`
- [Attack Views](https://github.com/d80y6/yemenantiddos/blob/main/controller/console/src/views/attacks/AttackDetail.vue): `controller/console/src/views/attacks/AttackDetail.vue`
- [Operations Views](https://github.com/d80y6/yemenantiddos/blob/main/controller/console/src/views/overview/Overview.vue): `controller/console/src/views/overview/Overview.vue`

### Mitigation Integrations

- [BGP Speaker](https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/bgp/gobgp.go): `controller/internal/bgp/gobgp.go`
- [Inline BPF Rules](https://github.com/d80y6/yemenantiddos/blob/main/node/internal/bpf/inline.go): `node/internal/bpf/inline.go`
- [Webhook, xDrop](https://github.com/d80y6/yemenantiddos/blob/main/controller/internal/action/webhook.go): `controller/internal/action/webhook.go`

### Other components

- **Operator**

## Connections

- Node Runtime → XDP Capture: attaches XDP (evidence: `node/main.go`)
- Node Runtime → Flow Collection: starts collection
- Node Runtime → Packet Sampling: starts sampler (evidence: `node/main.go`)
- Node Runtime → L7 Inspection: starts inspection
- Node Runtime → Node Reporter: starts reporter (evidence: `node/main.go`)
- Node Reporter → gRPC Ingestion: streams telemetry (evidence: `README.md`)
- gRPC Ingestion → Telemetry Writers: submits samples (evidence: `controller/internal/ingestion/grpc_handler.go`)
- gRPC Ingestion → TimescaleDB: reads node records (evidence: `controller/internal/ingestion/grpc_handler.go`)
- Telemetry Writers → TimescaleDB: writes telemetry
- Detection Engine → Attack Tracking: raises detections
- Baseline Detection → Attack Tracking: raises deviations
- Attack Tracking → Response Engine: dispatches events (evidence: `controller/internal/action/engine.go`)
- Response Engine → TimescaleDB: loads action state (evidence: `controller/internal/action/engine.go`)
- Response Engine → BGP Speaker: announces routes (evidence: `controller/internal/action/engine.go`)
- Response Engine → Webhook, xDrop: executes responses
- Operator → Console Application: uses (evidence: `README.md`)
- Console Application → Console Routes: installs router (evidence: `controller/console/src/main.ts`)
- Console Application → Console Shell: mounts application
- Console Routes → Attack Views: routes attacks (evidence: `controller/console/src/router.ts`)
- Console Routes → Operations Views: routes overview (evidence: `controller/console/src/router.ts`)
- Attack Views → Console API Client: requests data (evidence: `controller/console/src/views/attacks/AttackDetail.vue`)
- Operations Views → Console API Client: requests data
- Console API Client → HTTP API: sends HTTP requests
- HTTP API → TimescaleDB: serves stored data
- Response Engine → Inline BPF Rules: pushes inline rules
