# lerboe/beeper architecture

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

- Interactive diagram: https://gitdiagram.com/lerboe/beeper
- Repository: https://github.com/lerboe/beeper

## Overview

Beeper is a Rust library that configures application-layer parsers and installs them into eBPF programs, where messages can be parsed and selected fields extracted in-kernel. The main workflow is to configure captures, attach a parser to a target BPF program, then use its parse and extraction stubs on traffic. HTTP/1 and HTTP/2 are documented as supported; RESP2 is work in progress. The graph includes DFA construction and protocol-specific parsing; sampled source does not establish the internals of the example monitor or all RESP2 behavior.

Main entry points: [`beeper/src/http2/parser.rs`](https://github.com/lerboe/beeper/blob/main/beeper/src/http2/parser.rs) (HTTP/2 Configuration), [`beeper/src/http1/parser.rs`](https://github.com/lerboe/beeper/blob/main/beeper/src/http1/parser.rs) (HTTP/1 Configuration), [`beeper/src/resp2/parser.rs`](https://github.com/lerboe/beeper/blob/main/beeper/src/resp2/parser.rs) (RESP2 Parser), [`beeper/include/beeper/http2.h`](https://github.com/lerboe/beeper/blob/main/beeper/include/beeper/http2.h) (HTTP/2 BPF Interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Parser Configuration"]
  node_api["Beeper API<br/>[lib.rs]"]
  node_dfa["DFA Builder<br/>[dfa.rs]"]
  node_bpf_contract["BPF Base Contract<br/>[beeper.h]"]
  node_http_contract["HTTP Parse Contract<br/>[http.h]"]
end

subgraph group_http1["HTTP/1 Parsing"]
  node_http1_config["HTTP/1 Configuration<br/>[parser.rs]"]
  node_http1_actions["HTTP/1 Actions<br/>[action.rs]"]
  node_http1_kernel["HTTP/1 Kernel Parser<br/>[parser.bpf.c]"]
  node_http1_abi["HTTP/1 BPF Interface<br/>[http1.h]"]
end

subgraph group_http2["HTTP/2 Parsing"]
  node_http2_config["HTTP/2 Configuration<br/>[parser.rs]"]
  node_http2_actions["HTTP/2 Actions<br/>[action.rs]"]
  node_hpack["HPACK Handling<br/>[hpack.rs]"]
  node_http2_kernel["HTTP/2 Kernel Parser<br/>[parser.bpf.c]"]
  node_http2_abi["HTTP/2 BPF Interface<br/>[http2.h]"]
end

subgraph group_resp["RESP2 Parsing"]
  node_resp_config["RESP2 Parser<br/>[parser.rs]"]
  node_resp_kernel["RESP2 Kernel Parser<br/>[parser.bpf.c]"]
  node_resp_abi["RESP2 BPF Interface<br/>[resp2.h]"]
end

node_developer(("Application Developer"))
node_target["Target eBPF Program"]
node_traffic(("Application Traffic"))
node_monitor["Example Monitor<br/>[monitor.bpf.c]"]

node_developer -->|"configures captures"| node_api
node_api -->|"builds patterns"| node_dfa
node_developer -.->|"selects protocol"| node_http1_config
node_developer -->|"selects protocol"| node_http2_config
node_http1_config -->|"constructs transitions"| node_dfa
node_http1_config -->|"uses actions"| node_http1_actions
node_http1_config -->|"attaches parser"| node_http1_kernel
node_http1_kernel -->|"implements stubs"| node_http1_abi
node_http1_abi -->|"includes contract"| node_http_contract
node_http_contract -->|"includes base"| node_bpf_contract
node_http2_config -->|"constructs transitions"| node_dfa
node_http2_config -->|"uses actions"| node_http2_actions
node_http2_config -->|"uses HPACK"| node_hpack
node_http2_config -->|"attaches parser"| node_http2_kernel
node_http2_kernel -->|"implements stubs"| node_http2_abi
node_http2_abi -->|"includes contract"| node_http_contract
node_http2_abi -->|"includes base"| node_bpf_contract
node_developer -.->|"selects protocol"| node_resp_config
node_resp_config -.->|"constructs transitions"| node_dfa
node_resp_config -.->|"attaches parser"| node_resp_kernel
node_resp_kernel -.->|"uses interface"| node_resp_abi
node_target -.->|"processes messages"| node_traffic
node_http2_config -->|"attaches to"| node_target
node_http1_config -.->|"attaches to"| node_target
node_resp_config -.->|"attaches to"| node_target
node_monitor -.->|"uses interface"| node_http1_abi
node_monitor -.->|"uses interface"| node_http2_abi

click node_api "https://github.com/lerboe/beeper/blob/main/beeper/src/lib.rs"
click node_dfa "https://github.com/lerboe/beeper/blob/main/beeper/src/dfa.rs"
click node_bpf_contract "https://github.com/lerboe/beeper/blob/main/beeper/include/beeper/beeper.h"
click node_http_contract "https://github.com/lerboe/beeper/blob/main/beeper/include/beeper/http.h"
click node_http1_config "https://github.com/lerboe/beeper/blob/main/beeper/src/http1/parser.rs"
click node_http1_actions "https://github.com/lerboe/beeper/blob/main/beeper/src/http1/action.rs"
click node_http1_kernel "https://github.com/lerboe/beeper/blob/main/beeper/src/http1/parser.bpf.c"
click node_http1_abi "https://github.com/lerboe/beeper/blob/main/beeper/include/beeper/http1.h"
click node_http2_config "https://github.com/lerboe/beeper/blob/main/beeper/src/http2/parser.rs"
click node_http2_actions "https://github.com/lerboe/beeper/blob/main/beeper/src/http2/action.rs"
click node_hpack "https://github.com/lerboe/beeper/blob/main/beeper/src/http2/hpack.rs"
click node_http2_kernel "https://github.com/lerboe/beeper/blob/main/beeper/src/http2/parser.bpf.c"
click node_http2_abi "https://github.com/lerboe/beeper/blob/main/beeper/include/beeper/http2.h"
click node_resp_config "https://github.com/lerboe/beeper/blob/main/beeper/src/resp2/parser.rs"
click node_resp_kernel "https://github.com/lerboe/beeper/blob/main/beeper/src/resp2/parser.bpf.c"
click node_resp_abi "https://github.com/lerboe/beeper/blob/main/beeper/include/beeper/resp2.h"
click node_monitor "https://github.com/lerboe/beeper/blob/main/example/src/monitor.bpf.c"

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_api,node_dfa,node_bpf_contract,node_http_contract toneBlue
class node_http1_config,node_http1_actions,node_http1_kernel,node_http1_abi toneAmber
class node_http2_config,node_http2_actions,node_hpack,node_http2_kernel,node_http2_abi toneMint
class node_resp_config,node_resp_kernel,node_resp_abi toneRose
class node_developer,node_target,node_traffic toneIndigo
class node_monitor toneTeal
```

## Components

### Parser Configuration

- [Beeper API](https://github.com/lerboe/beeper/blob/main/beeper/src/lib.rs): `beeper/src/lib.rs`
- [DFA Builder](https://github.com/lerboe/beeper/blob/main/beeper/src/dfa.rs): `beeper/src/dfa.rs`
- [BPF Base Contract](https://github.com/lerboe/beeper/blob/main/beeper/include/beeper/beeper.h): `beeper/include/beeper/beeper.h`
- [HTTP Parse Contract](https://github.com/lerboe/beeper/blob/main/beeper/include/beeper/http.h): `beeper/include/beeper/http.h`

### HTTP/1 Parsing

- [HTTP/1 Configuration](https://github.com/lerboe/beeper/blob/main/beeper/src/http1/parser.rs): `beeper/src/http1/parser.rs`
- [HTTP/1 Actions](https://github.com/lerboe/beeper/blob/main/beeper/src/http1/action.rs): `beeper/src/http1/action.rs`
- [HTTP/1 Kernel Parser](https://github.com/lerboe/beeper/blob/main/beeper/src/http1/parser.bpf.c): `beeper/src/http1/parser.bpf.c`
- [HTTP/1 BPF Interface](https://github.com/lerboe/beeper/blob/main/beeper/include/beeper/http1.h): `beeper/include/beeper/http1.h`

### HTTP/2 Parsing

- [HTTP/2 Configuration](https://github.com/lerboe/beeper/blob/main/beeper/src/http2/parser.rs): `beeper/src/http2/parser.rs`
- [HTTP/2 Actions](https://github.com/lerboe/beeper/blob/main/beeper/src/http2/action.rs): `beeper/src/http2/action.rs`
- [HPACK Handling](https://github.com/lerboe/beeper/blob/main/beeper/src/http2/hpack.rs): `beeper/src/http2/hpack.rs`
- [HTTP/2 Kernel Parser](https://github.com/lerboe/beeper/blob/main/beeper/src/http2/parser.bpf.c): `beeper/src/http2/parser.bpf.c`
- [HTTP/2 BPF Interface](https://github.com/lerboe/beeper/blob/main/beeper/include/beeper/http2.h): `beeper/include/beeper/http2.h`

### RESP2 Parsing

- [RESP2 Parser](https://github.com/lerboe/beeper/blob/main/beeper/src/resp2/parser.rs): `beeper/src/resp2/parser.rs`
- [RESP2 Kernel Parser](https://github.com/lerboe/beeper/blob/main/beeper/src/resp2/parser.bpf.c): `beeper/src/resp2/parser.bpf.c`
- [RESP2 BPF Interface](https://github.com/lerboe/beeper/blob/main/beeper/include/beeper/resp2.h): `beeper/include/beeper/resp2.h`

### Other components

- **Application Developer**
- **Target eBPF Program**
- **Application Traffic**
- [Example Monitor](https://github.com/lerboe/beeper/blob/main/example/src/monitor.bpf.c): `example/src/monitor.bpf.c`

## Connections

- Application Developer → Beeper API: configures captures (evidence: `README.md`)
- Beeper API → DFA Builder: builds patterns (evidence: `beeper/src/lib.rs`)
- Application Developer → HTTP/1 Configuration: selects protocol
- Application Developer → HTTP/2 Configuration: selects protocol (evidence: `README.md`)
- HTTP/1 Configuration → DFA Builder: constructs transitions (evidence: `beeper/src/http1/parser.rs`)
- HTTP/1 Configuration → HTTP/1 Actions: uses actions (evidence: `beeper/src/http1/mod.rs`)
- HTTP/1 Configuration → HTTP/1 Kernel Parser: attaches parser (evidence: `README.md`)
- HTTP/1 Kernel Parser → HTTP/1 BPF Interface: implements stubs (evidence: `beeper/src/http1/parser.bpf.c`)
- HTTP/1 BPF Interface → HTTP Parse Contract: includes contract (evidence: `beeper/include/beeper/http1.h`)
- HTTP Parse Contract → BPF Base Contract: includes base (evidence: `beeper/include/beeper/http.h`)
- HTTP/2 Configuration → DFA Builder: constructs transitions (evidence: `beeper/src/http2/parser.rs`)
- HTTP/2 Configuration → HTTP/2 Actions: uses actions (evidence: `beeper/src/http2/mod.rs`)
- HTTP/2 Configuration → HPACK Handling: uses HPACK (evidence: `beeper/src/http2/parser.rs`)
- HTTP/2 Configuration → HTTP/2 Kernel Parser: attaches parser (evidence: `README.md`)
- HTTP/2 Kernel Parser → HTTP/2 BPF Interface: implements stubs (evidence: `beeper/src/http2/parser.bpf.c`)
- HTTP/2 BPF Interface → HTTP Parse Contract: includes contract (evidence: `beeper/include/beeper/http2.h`)
- HTTP/2 BPF Interface → BPF Base Contract: includes base
- Application Developer → RESP2 Parser: selects protocol
- RESP2 Parser → DFA Builder: constructs transitions
- RESP2 Parser → RESP2 Kernel Parser: attaches parser
- RESP2 Kernel Parser → RESP2 BPF Interface: uses interface
- Target eBPF Program → Application Traffic: processes messages
- HTTP/2 Configuration → Target eBPF Program: attaches to (evidence: `README.md`)
- HTTP/1 Configuration → Target eBPF Program: attaches to
- RESP2 Parser → Target eBPF Program: attaches to
- Example Monitor → HTTP/1 BPF Interface: uses interface
- Example Monitor → HTTP/2 BPF Interface: uses interface
