# r12f/rnp architecture

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

- Interactive diagram: https://gitdiagram.com/r12f/rnp
- Repository: https://github.com/r12f/rnp

## Overview

Rnp is a cloud-oriented layer-4 reachability tool with a CLI for running timed TCP or QUIC connection probes, plus a separate TCP stub-server executable. The main workflow parses options, configures a runner, schedules probes using rotating source ports, records ping results, and sends them to configured output processors. The README also documents parallel probing and multiple result formats. Some runner orchestration and processor wiring is not visible in the excerpts, so those relationships are marked unverified rather than asserted.

Main entry points: [`src/ping_runners/ping_worker.rs`](https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_worker.rs) (Ping workers), [`src/bin/rnp/main.rs`](https://github.com/r12f/rnp/blob/main/src/bin/rnp/main.rs) (Ping CLI), [`src/bin/rnp_server/main.rs`](https://github.com/r12f/rnp/blob/main/src/bin/rnp_server/main.rs) (Server CLI), [`src/ping_runners/ping_clients/ping_client_factory.rs`](https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_clients/ping_client_factory.rs) (Client factory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command-line apps"]
  node_ping_cli["Ping CLI<br/>[main.rs]"]
  node_ping_options["Ping options<br/>[rnp_cli_options.rs]"]
  node_server_cli["Server CLI<br/>[main.rs]"]
  node_server_options["Server options"]
end

subgraph group_probe["Probe execution"]
  node_config["Configuration types<br/>[rnp_config.rs]"]
  node_runner["Ping runner"]
  node_worker["Ping workers<br/>[ping_worker.rs]"]
  node_port_picker["Source port picker"]
  node_client_factory["Client factory"]
  node_tcp_client["TCP client<br/>[ping_client_tcp.rs]"]
  node_quic_client["QUIC client"]
end

subgraph group_results["Results and outputs"]
  node_ping_result["Ping result<br/>[ping_result.rs]"]
  node_result_worker["Result worker"]
  node_processors["Output processors"]
end

subgraph group_server["Stub server"]
  node_server_factory["Server factory"]
  node_tcp_server["TCP stub server<br/>[stub_server_tcp.rs]"]
end

node_user(("Operator"))
node_target(("Network target"))

node_user -->|"runs"| node_ping_cli
node_ping_cli -->|"parses options"| node_ping_options
node_ping_cli -->|"starts runner"| node_runner
node_ping_options -.->|"creates config"| node_config
node_runner -.->|"starts workers"| node_worker
node_worker -.->|"selects ports"| node_port_picker
node_worker -->|"creates client"| node_client_factory
node_client_factory -.->|"selects protocol"| node_tcp_client
node_client_factory -.->|"selects protocol"| node_quic_client
node_tcp_client -->|"connects to"| node_target
node_quic_client -->|"connects to"| node_target
node_worker -->|"creates result"| node_ping_result
node_worker -.->|"sends results"| node_result_worker
node_result_worker -.->|"dispatches results"| node_processors
node_user -.->|"runs"| node_server_cli
node_server_cli -->|"parses options"| node_server_options
node_server_cli -->|"starts server"| node_server_factory
node_server_factory -->|"starts TCP server"| node_tcp_server

click node_ping_cli "https://github.com/r12f/rnp/blob/main/src/bin/rnp/main.rs"
click node_ping_options "https://github.com/r12f/rnp/blob/main/src/bin/rnp/rnp_cli_options.rs"
click node_server_cli "https://github.com/r12f/rnp/blob/main/src/bin/rnp_server/main.rs"
click node_server_options "https://github.com/r12f/rnp/blob/main/src/bin/rnp_server/rnp_server_cli_options.rs"
click node_config "https://github.com/r12f/rnp/blob/main/src/rnp_config.rs"
click node_runner "https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_runner_core.rs"
click node_worker "https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_worker.rs"
click node_port_picker "https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_port_picker.rs"
click node_client_factory "https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_clients/ping_client_factory.rs"
click node_tcp_client "https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_clients/ping_client_tcp.rs"
click node_quic_client "https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_clients/ping_client_quic.rs"
click node_ping_result "https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_result.rs"
click node_result_worker "https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_result_processing_worker.rs"
click node_processors "https://github.com/r12f/rnp/tree/main/src/ping_runners/ping_result_processors"
click node_server_factory "https://github.com/r12f/rnp/blob/main/src/stub_servers/stub_server_factory.rs"
click node_tcp_server "https://github.com/r12f/rnp/blob/main/src/stub_servers/stub_server_tcp.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_ping_cli,node_ping_options,node_server_cli,node_server_options toneBlue
class node_config,node_runner,node_worker,node_port_picker,node_client_factory,node_tcp_client,node_quic_client toneAmber
class node_ping_result,node_result_worker,node_processors toneMint
class node_server_factory,node_tcp_server toneRose
class node_user,node_target toneIndigo
```

## Components

### Command-line apps

- [Ping CLI](https://github.com/r12f/rnp/blob/main/src/bin/rnp/main.rs): `src/bin/rnp/main.rs`
- [Ping options](https://github.com/r12f/rnp/blob/main/src/bin/rnp/rnp_cli_options.rs): `src/bin/rnp/rnp_cli_options.rs`
- [Server CLI](https://github.com/r12f/rnp/blob/main/src/bin/rnp_server/main.rs): `src/bin/rnp_server/main.rs`
- [Server options](https://github.com/r12f/rnp/blob/main/src/bin/rnp_server/rnp_server_cli_options.rs): `src/bin/rnp_server/rnp_server_cli_options.rs`

### Probe execution

- [Configuration types](https://github.com/r12f/rnp/blob/main/src/rnp_config.rs): `src/rnp_config.rs`
- [Ping runner](https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_runner_core.rs): `src/ping_runners/ping_runner_core.rs`
- [Ping workers](https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_worker.rs): `src/ping_runners/ping_worker.rs`
- [Source port picker](https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_port_picker.rs): `src/ping_runners/ping_port_picker.rs`
- [Client factory](https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_clients/ping_client_factory.rs): `src/ping_runners/ping_clients/ping_client_factory.rs`
- [TCP client](https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_clients/ping_client_tcp.rs): `src/ping_runners/ping_clients/ping_client_tcp.rs`
- [QUIC client](https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_clients/ping_client_quic.rs): `src/ping_runners/ping_clients/ping_client_quic.rs`

### Results and outputs

- [Ping result](https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_result.rs): `src/ping_runners/ping_result.rs`
- [Result worker](https://github.com/r12f/rnp/blob/main/src/ping_runners/ping_result_processing_worker.rs): `src/ping_runners/ping_result_processing_worker.rs`
- [Output processors](https://github.com/r12f/rnp/tree/main/src/ping_runners/ping_result_processors): `src/ping_runners/ping_result_processors`

### Stub server

- [Server factory](https://github.com/r12f/rnp/blob/main/src/stub_servers/stub_server_factory.rs): `src/stub_servers/stub_server_factory.rs`
- [TCP stub server](https://github.com/r12f/rnp/blob/main/src/stub_servers/stub_server_tcp.rs): `src/stub_servers/stub_server_tcp.rs`

### Other components

- **Operator**
- **Network target**

## Connections

- Operator → Ping CLI: runs (evidence: `README.md`)
- Ping CLI → Ping options: parses options (evidence: `src/bin/rnp/main.rs`)
- Ping CLI → Ping runner: starts runner (evidence: `src/bin/rnp/main.rs`)
- Ping options → Configuration types: creates config
- Ping runner → Ping workers: starts workers
- Ping workers → Source port picker: selects ports
- Ping workers → Client factory: creates client (evidence: `src/ping_runners/ping_worker.rs`)
- Client factory → TCP client: selects protocol
- Client factory → QUIC client: selects protocol
- TCP client → Network target: connects to (evidence: `src/ping_runners/ping_clients/ping_client_tcp.rs`)
- QUIC client → Network target: connects to (evidence: `src/ping_runners/ping_clients/ping_client_quic.rs`)
- Ping workers → Ping result: creates result (evidence: `src/ping_runners/ping_worker.rs`)
- Ping workers → Result worker: sends results
- Result worker → Output processors: dispatches results
- Operator → Server CLI: runs
- Server CLI → Server options: parses options (evidence: `src/bin/rnp_server/main.rs`)
- Server CLI → Server factory: starts server (evidence: `src/bin/rnp_server/main.rs`)
- Server factory → TCP stub server: starts TCP server (evidence: `src/stub_servers/stub_server_factory.rs`)
