# pavel-odintsov/fastnetmon architecture

> Architecture diagram of the GitHub repository pavel-odintsov/fastnetmon, 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/pavel-odintsov/fastnetmon
- Repository: https://github.com/pavel-odintsov/fastnetmon

## Overview

FastNetMon Community Edition is a DDoS detection sensor. Its principal workflow receives flow records or captured packets, interprets traffic, evaluates host and subnet thresholds, then triggers configured responses such as notifications, scripts, or BGP announcements. Separate capabilities include an API, traffic export, metrics integrations, attack PCAP capture, and router-vendor integrations. The README documents these product-level relationships; many implementation files were not sampled, so internal call paths are not asserted.

Main entry points: [`src/fastnetmon_logic.cpp`](https://github.com/pavel-odintsov/fastnetmon/blob/master/src/fastnetmon_logic.cpp) (Traffic detection), [`src/fastnetmon_actions.hpp`](https://github.com/pavel-odintsov/fastnetmon/blob/master/src/fastnetmon_actions.hpp) (Configured actions), [`src/simple_packet_parser_ng.cpp`](https://github.com/pavel-odintsov/fastnetmon/blob/master/src/simple_packet_parser_ng.cpp) (Packet parser), [`src/netflow_plugin`](https://github.com/pavel-odintsov/fastnetmon/tree/master/src/netflow_plugin) (Flow collectors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Traffic ingestion"]
  node_flow_collectors["Flow collectors"]
  node_ipfix_collector["IPFIX collector"]
  node_sflow_collector["sFlow collector"]
  node_packet_collectors["Packet collectors"]
  node_other_captures["Other capture backends<br/>[pcap_collector.cpp]"]
end

subgraph group_analysis["Detection and analysis"]
  node_parser["Packet parser"]
  node_detection["Traffic detection"]
  node_counters["Traffic counters<br/>[speed_counters.cpp]"]
  node_configuration["Threshold configuration"]
  node_pcap_storage["Attack PCAP capture<br/>[packet_storage.hpp]"]
end

subgraph group_response["Response and control"]
  node_actions["Configured actions"]
  node_bgp_actions["BGP announcements<br/>[exabgp_action.cpp]"]
  node_gobgp_action["GoBGP integration<br/>[gobgp_action.cpp]"]
  node_api["Application API<br/>[api.cpp]"]
  node_vendor_plugins["Router integrations"]
end

subgraph group_observability["Export and observability"]
  node_metrics["Metrics exporters"]
  node_traffic_export["Traffic export"]
end

node_network(("Network traffic"))
node_external_metrics[("Metrics services")]
node_routers["Routers"]
node_operators(("Operators and scripts"))

node_network -->|"sends flow records"| node_flow_collectors
node_network -->|"sends IPFIX"| node_ipfix_collector
node_network -->|"sends sFlow"| node_sflow_collector
node_network -->|"mirrors packets"| node_packet_collectors
node_network -->|"provides packets"| node_other_captures
node_flow_collectors -.->|"supplies traffic"| node_detection
node_ipfix_collector -.->|"supplies traffic"| node_detection
node_sflow_collector -.->|"supplies traffic"| node_detection
node_packet_collectors -.->|"passes packets"| node_parser
node_other_captures -.->|"passes packets"| node_parser
node_parser -.->|"normalizes traffic"| node_detection
node_configuration -->|"sets thresholds"| node_detection
node_detection -.->|"tracks traffic"| node_counters
node_detection -->|"triggers response"| node_actions
node_actions -->|"announces blocks"| node_bgp_actions
node_bgp_actions -->|"announces routes"| node_routers
node_actions -->|"notifies or runs scripts"| node_operators
node_actions -->|"announces via GoBGP"| node_gobgp_action
node_actions -.->|"supports router handling"| node_vendor_plugins
node_operators -->|"uses API"| node_api
node_counters -->|"exports metrics"| node_metrics
node_metrics -->|"writes metrics"| node_external_metrics
node_detection -->|"exports traffic"| node_traffic_export
node_detection -->|"captures attack packets"| node_pcap_storage

click node_flow_collectors "https://github.com/pavel-odintsov/fastnetmon/tree/master/src/netflow_plugin"
click node_ipfix_collector "https://github.com/pavel-odintsov/fastnetmon/blob/master/src/netflow_plugin/ipfix_collector.cpp"
click node_sflow_collector "https://github.com/pavel-odintsov/fastnetmon/blob/master/src/sflow_plugin/sflow_collector.cpp"
click node_packet_collectors "https://github.com/pavel-odintsov/fastnetmon/blob/master/src/afpacket_plugin/afpacket_collector.cpp"
click node_other_captures "https://github.com/pavel-odintsov/fastnetmon/blob/master/src/pcap_plugin/pcap_collector.cpp"
click node_parser "https://github.com/pavel-odintsov/fastnetmon/blob/master/src/simple_packet_parser_ng.cpp"
click node_detection "https://github.com/pavel-odintsov/fastnetmon/blob/master/src/fastnetmon_logic.cpp"
click node_counters "https://github.com/pavel-odintsov/fastnetmon/blob/master/src/speed_counters.cpp"
click node_configuration "https://github.com/pavel-odintsov/fastnetmon/blob/master/src/fastnetmon_configuration_scheme.hpp"
click node_pcap_storage "https://github.com/pavel-odintsov/fastnetmon/blob/master/src/packet_storage.hpp"
click node_actions "https://github.com/pavel-odintsov/fastnetmon/blob/master/src/fastnetmon_actions.hpp"
click node_bgp_actions "https://github.com/pavel-odintsov/fastnetmon/blob/master/src/actions/exabgp_action.cpp"
click node_gobgp_action "https://github.com/pavel-odintsov/fastnetmon/blob/master/src/actions/gobgp_action.cpp"
click node_api "https://github.com/pavel-odintsov/fastnetmon/blob/master/src/api.cpp"
click node_vendor_plugins "https://github.com/pavel-odintsov/fastnetmon/tree/master/src/a10_plugin"
click node_metrics "https://github.com/pavel-odintsov/fastnetmon/tree/master/src/metrics"
click node_traffic_export "https://github.com/pavel-odintsov/fastnetmon/blob/master/src/traffic_output_formats/protobuf/protobuf_traffic_format.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_flow_collectors,node_ipfix_collector,node_sflow_collector,node_packet_collectors,node_other_captures toneBlue
class node_parser,node_detection,node_counters,node_configuration,node_pcap_storage,node_external_metrics toneAmber
class node_actions,node_bgp_actions,node_gobgp_action,node_api,node_vendor_plugins,node_routers toneMint
class node_metrics,node_traffic_export toneRose
class node_network,node_operators toneIndigo
```

## Components

### Traffic ingestion

- [Flow collectors](https://github.com/pavel-odintsov/fastnetmon/tree/master/src/netflow_plugin): `src/netflow_plugin`
- [IPFIX collector](https://github.com/pavel-odintsov/fastnetmon/blob/master/src/netflow_plugin/ipfix_collector.cpp): `src/netflow_plugin/ipfix_collector.cpp`
- [sFlow collector](https://github.com/pavel-odintsov/fastnetmon/blob/master/src/sflow_plugin/sflow_collector.cpp): `src/sflow_plugin/sflow_collector.cpp`
- [Packet collectors](https://github.com/pavel-odintsov/fastnetmon/blob/master/src/afpacket_plugin/afpacket_collector.cpp): `src/afpacket_plugin/afpacket_collector.cpp`
- [Other capture backends](https://github.com/pavel-odintsov/fastnetmon/blob/master/src/pcap_plugin/pcap_collector.cpp): `src/pcap_plugin/pcap_collector.cpp`

### Detection and analysis

- [Packet parser](https://github.com/pavel-odintsov/fastnetmon/blob/master/src/simple_packet_parser_ng.cpp): `src/simple_packet_parser_ng.cpp`
- [Traffic detection](https://github.com/pavel-odintsov/fastnetmon/blob/master/src/fastnetmon_logic.cpp): `src/fastnetmon_logic.cpp`
- [Traffic counters](https://github.com/pavel-odintsov/fastnetmon/blob/master/src/speed_counters.cpp): `src/speed_counters.cpp`
- [Threshold configuration](https://github.com/pavel-odintsov/fastnetmon/blob/master/src/fastnetmon_configuration_scheme.hpp): `src/fastnetmon_configuration_scheme.hpp`
- [Attack PCAP capture](https://github.com/pavel-odintsov/fastnetmon/blob/master/src/packet_storage.hpp): `src/packet_storage.hpp`

### Response and control

- [Configured actions](https://github.com/pavel-odintsov/fastnetmon/blob/master/src/fastnetmon_actions.hpp): `src/fastnetmon_actions.hpp`
- [BGP announcements](https://github.com/pavel-odintsov/fastnetmon/blob/master/src/actions/exabgp_action.cpp): `src/actions/exabgp_action.cpp`
- [GoBGP integration](https://github.com/pavel-odintsov/fastnetmon/blob/master/src/actions/gobgp_action.cpp): `src/actions/gobgp_action.cpp`
- [Application API](https://github.com/pavel-odintsov/fastnetmon/blob/master/src/api.cpp): `src/api.cpp`
- [Router integrations](https://github.com/pavel-odintsov/fastnetmon/tree/master/src/a10_plugin): `src/a10_plugin`

### Export and observability

- [Metrics exporters](https://github.com/pavel-odintsov/fastnetmon/tree/master/src/metrics): `src/metrics`
- [Traffic export](https://github.com/pavel-odintsov/fastnetmon/blob/master/src/traffic_output_formats/protobuf/protobuf_traffic_format.cpp): `src/traffic_output_formats/protobuf/protobuf_traffic_format.cpp`

### Other components

- **Network traffic**
- **Metrics services**
- **Routers**
- **Operators and scripts**

## Connections

- Network traffic → Flow collectors: sends flow records
- Network traffic → IPFIX collector: sends IPFIX
- Network traffic → sFlow collector: sends sFlow
- Network traffic → Packet collectors: mirrors packets
- Network traffic → Other capture backends: provides packets
- Flow collectors → Traffic detection: supplies traffic
- IPFIX collector → Traffic detection: supplies traffic
- sFlow collector → Traffic detection: supplies traffic
- Packet collectors → Packet parser: passes packets
- Other capture backends → Packet parser: passes packets
- Packet parser → Traffic detection: normalizes traffic
- Threshold configuration → Traffic detection: sets thresholds
- Traffic detection → Traffic counters: tracks traffic
- Traffic detection → Configured actions: triggers response
- Configured actions → BGP announcements: announces blocks
- BGP announcements → Routers: announces routes
- Configured actions → Operators and scripts: notifies or runs scripts
- Configured actions → GoBGP integration: announces via GoBGP (evidence: `src/actions/gobgp_action.cpp`)
- Configured actions → Router integrations: supports router handling
- Operators and scripts → Application API: uses API
- Traffic counters → Metrics exporters: exports metrics
- Metrics exporters → Metrics services: writes metrics
- Traffic detection → Traffic export: exports traffic
- Traffic detection → Attack PCAP capture: captures attack packets
