# jacobryu/sentinel-flow-rs architecture

> Architecture diagram of the GitHub repository jacobryu/sentinel-flow-rs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jacobryu/sentinel-flow-rs
- Repository: https://github.com/jacobryu/sentinel-flow-rs

## Overview

SentinelFlow-rs is a host-level network security sensor: it captures Ethernet traffic, parses packets, aggregates bidirectional flows, and exports flow records. Configuration and Prometheus metrics support the sensor runtime. The README also describes ClickHouse/Grafana, detection, and Kubernetes enrichment; the excerpts do not show those features wired into the running sensor, so those links are marked as documented or unverified rather than asserted as runtime calls.

Main entry points: [`crates/sentinel-parser/src/lib.rs`](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-parser/src/lib.rs) (Frame parser), [`crates/sentinel-sensor/src/flow.rs`](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-sensor/src/flow.rs) (Flow processor), [`crates/sentinel-sensor/src/main.rs`](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-sensor/src/main.rs) (Sensor runtime), [`crates/sentinel-flow/src/export.rs`](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-flow/src/export.rs) (Flow exporter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensor["Sensor runtime"]
  node_main["Sensor runtime<br/>[main.rs]"]
  node_config["Sensor config<br/>[config.rs]"]
  node_capture["Packet capture<br/>[capture.rs]"]
  node_metrics["Sensor metrics<br/>[metrics.rs]"]
end

subgraph group_parse["Packet parsing"]
  node_parser["Frame parser<br/>[lib.rs]"]
  node_ethernet["Ethernet headers<br/>[ethernet.rs]"]
  node_ip["IP headers<br/>[ip.rs]"]
  node_packet["Parsed packet<br/>[packet.rs]"]
  node_tcp["TCP headers<br/>[tcp.rs]"]
  node_udp["UDP headers<br/>[udp.rs]"]
end

subgraph group_flow["Flow processing"]
  node_processor["Flow processor<br/>[flow.rs]"]
  node_table[("Flow table<br/>[table.rs]")]
  node_key["Flow key<br/>[key.rs]"]
  node_entry["Flow entry<br/>[entry.rs]"]
  node_exporter["Flow exporter<br/>[export.rs]"]
end

subgraph group_security["Security and observability"]
  node_clickhouse[("ClickHouse")]
  node_grafana["Grafana"]
  node_detection["Detection engine<br/>[engine.rs]"]
  node_rules["Detection rules<br/>[rules.rs]"]
  node_enrichment["Kubernetes enrichment<br/>[kubernetes.rs]"]
end

node_traffic(("Host traffic"))

node_traffic -->|"supplies frames"| node_capture
node_main -->|"loads config"| node_config
node_main -->|"starts capture"| node_capture
node_capture -->|"parses frames"| node_parser
node_parser -->|"parses link header"| node_ethernet
node_parser -->|"parses IP header"| node_ip
node_parser -->|"parses TCP header"| node_tcp
node_parser -->|"parses UDP header"| node_udp
node_parser -->|"builds packet"| node_packet
node_main -->|"processes packets"| node_processor
node_main -->|"updates counters"| node_metrics
node_processor -->|"updates and sweeps"| node_table
node_processor -->|"creates flow keys"| node_key
node_table -->|"updates entries"| node_entry
node_processor -->|"exports flows"| node_exporter
node_processor -->|"records flow metrics"| node_metrics
node_exporter -.->|"sends flow batches"| node_clickhouse
node_clickhouse -.->|"feeds dashboards"| node_grafana
node_exporter -.->|"provides flow telemetry"| node_detection
node_detection -->|"checks rules"| node_rules

click node_main "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-sensor/src/main.rs"
click node_config "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-sensor/src/config.rs"
click node_capture "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-sensor/src/capture.rs"
click node_metrics "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-sensor/src/metrics.rs"
click node_parser "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-parser/src/lib.rs"
click node_ethernet "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-parser/src/ethernet.rs"
click node_ip "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-parser/src/ip.rs"
click node_packet "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-parser/src/packet.rs"
click node_tcp "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-parser/src/tcp.rs"
click node_udp "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-parser/src/udp.rs"
click node_processor "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-sensor/src/flow.rs"
click node_table "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-flow/src/table.rs"
click node_key "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-flow/src/key.rs"
click node_entry "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-flow/src/entry.rs"
click node_exporter "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-flow/src/export.rs"
click node_detection "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-detection/src/engine.rs"
click node_rules "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-detection/src/rules.rs"
click node_enrichment "https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-enrichment/src/kubernetes.rs"

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_main,node_config,node_capture,node_metrics toneBlue
class node_parser,node_ethernet,node_ip,node_packet,node_tcp,node_udp toneAmber
class node_processor,node_table,node_key,node_entry,node_exporter toneMint
class node_clickhouse,node_grafana,node_detection,node_rules,node_enrichment toneRose
class node_traffic toneIndigo
```

## Components

### Sensor runtime

- [Sensor runtime](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-sensor/src/main.rs): `crates/sentinel-sensor/src/main.rs`
- [Sensor config](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-sensor/src/config.rs): `crates/sentinel-sensor/src/config.rs`
- [Packet capture](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-sensor/src/capture.rs): `crates/sentinel-sensor/src/capture.rs`
- [Sensor metrics](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-sensor/src/metrics.rs): `crates/sentinel-sensor/src/metrics.rs`

### Packet parsing

- [Frame parser](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-parser/src/lib.rs): `crates/sentinel-parser/src/lib.rs`
- [Ethernet headers](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-parser/src/ethernet.rs): `crates/sentinel-parser/src/ethernet.rs`
- [IP headers](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-parser/src/ip.rs): `crates/sentinel-parser/src/ip.rs`
- [Parsed packet](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-parser/src/packet.rs): `crates/sentinel-parser/src/packet.rs`
- [TCP headers](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-parser/src/tcp.rs): `crates/sentinel-parser/src/tcp.rs`
- [UDP headers](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-parser/src/udp.rs): `crates/sentinel-parser/src/udp.rs`

### Flow processing

- [Flow processor](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-sensor/src/flow.rs): `crates/sentinel-sensor/src/flow.rs`
- [Flow table](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-flow/src/table.rs): `crates/sentinel-flow/src/table.rs`
- [Flow key](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-flow/src/key.rs): `crates/sentinel-flow/src/key.rs`
- [Flow entry](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-flow/src/entry.rs): `crates/sentinel-flow/src/entry.rs`
- [Flow exporter](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-flow/src/export.rs): `crates/sentinel-flow/src/export.rs`

### Security and observability

- **ClickHouse**
- **Grafana**
- [Detection engine](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-detection/src/engine.rs): `crates/sentinel-detection/src/engine.rs`
- [Detection rules](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-detection/src/rules.rs): `crates/sentinel-detection/src/rules.rs`
- [Kubernetes enrichment](https://github.com/jacobryu/sentinel-flow-rs/blob/develop/crates/sentinel-enrichment/src/kubernetes.rs): `crates/sentinel-enrichment/src/kubernetes.rs`

### Other components

- **Host traffic**

## Connections

- Host traffic → Packet capture: supplies frames (evidence: `crates/sentinel-sensor/src/capture.rs`)
- Sensor runtime → Sensor config: loads config (evidence: `crates/sentinel-sensor/src/main.rs`)
- Sensor runtime → Packet capture: starts capture (evidence: `crates/sentinel-sensor/src/main.rs`)
- Packet capture → Frame parser: parses frames (evidence: `crates/sentinel-sensor/src/capture.rs`)
- Frame parser → Ethernet headers: parses link header (evidence: `crates/sentinel-parser/src/lib.rs`)
- Frame parser → IP headers: parses IP header (evidence: `crates/sentinel-parser/src/lib.rs`)
- Frame parser → TCP headers: parses TCP header (evidence: `crates/sentinel-parser/src/lib.rs`)
- Frame parser → UDP headers: parses UDP header (evidence: `crates/sentinel-parser/src/lib.rs`)
- Frame parser → Parsed packet: builds packet (evidence: `crates/sentinel-parser/src/lib.rs`)
- Sensor runtime → Flow processor: processes packets (evidence: `crates/sentinel-sensor/src/main.rs`)
- Sensor runtime → Sensor metrics: updates counters (evidence: `crates/sentinel-sensor/src/main.rs`)
- Flow processor → Flow table: updates and sweeps (evidence: `crates/sentinel-sensor/src/flow.rs`)
- Flow processor → Flow key: creates flow keys (evidence: `crates/sentinel-sensor/src/flow.rs`)
- Flow table → Flow entry: updates entries (evidence: `crates/sentinel-flow/src/table.rs`)
- Flow processor → Flow exporter: exports flows (evidence: `crates/sentinel-sensor/src/flow.rs`)
- Flow processor → Sensor metrics: records flow metrics (evidence: `crates/sentinel-sensor/src/flow.rs`)
- Flow exporter → ClickHouse: sends flow batches (evidence: `README.md`)
- ClickHouse → Grafana: feeds dashboards (evidence: `README.md`)
- Flow exporter → Detection engine: provides flow telemetry (evidence: `README.md`)
- Detection engine → Detection rules: checks rules (evidence: `crates/sentinel-detection/src/engine.rs`)
