# pyxi1s/s2e-server-picker architecture

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

- Interactive diagram: https://gitdiagram.com/pyxi1s/s2e-server-picker
- Repository: https://github.com/pyxi1s/s2e-server-picker

## Overview

S2e Server Picker is a terminal app for choosing which game relay locations to allow or block, comparing their live latency, and applying those choices to the operating-system firewall. The user selects locations in the TUI; it reads region data, monitors pings, and applies or resets rules through platform-specific firewall backends. A separate utility refreshes the relay IPs from Steam’s SDR configuration. The excerpts show the main calls and command runner; links for documented but unsampled details are identified by README evidence.

Main entry points: [`src/main.cpp`](https://github.com/pyxi1s/s2e-server-picker/blob/main/src/main.cpp) (Picker TUI), [`src/firewall.cpp`](https://github.com/pyxi1s/s2e-server-picker/blob/main/src/firewall.cpp) (OS Firewall Rules), [`src/process.cpp`](https://github.com/pyxi1s/s2e-server-picker/blob/main/src/process.cpp) (Command Runner), [`tools/update_servers.py`](https://github.com/pyxi1s/s2e-server-picker/blob/main/tools/update_servers.py) (Relay IP Updater)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_picker["Picker UI"]
  node_tui["Picker TUI<br/>[main.cpp]"]
end

subgraph group_latency["Latency Monitoring"]
  node_monitor["Ping Monitor<br/>[ping.cpp]"]
  node_pingcmd["Ping Probe<br/>[ping.cpp]"]
end

subgraph group_firewall["Firewall Control"]
  node_firewall_manager["Firewall Manager<br/>[firewall.cpp]"]
  node_os_rules["OS Firewall Rules<br/>[firewall.cpp]"]
  node_runner["Command Runner<br/>[process.cpp]"]
end

subgraph group_data["Relay Data"]
  node_regions["Region List<br/>[servers.hpp]"]
  node_updater["Relay IP Updater<br/>[update_servers.py]"]
end

node_user(("User"))
node_system["System Commands"]
node_steam["Steam SDR Config"]

node_user -->|"selects locations"| node_tui
node_tui -->|"loads locations"| node_regions
node_tui -->|"starts and reads"| node_monitor
node_tui -->|"applies or resets"| node_firewall_manager
node_monitor -->|"measures latency"| node_pingcmd
node_pingcmd -->|"runs ping"| node_runner
node_firewall_manager -->|"dispatches rules"| node_os_rules
node_os_rules -->|"runs firewall commands"| node_runner
node_runner -->|"executes commands"| node_system
node_updater -->|"fetches relay config"| node_steam
node_updater -->|"rewrites IP list"| node_regions
node_os_rules -->|"changes OS firewall"| node_system

click node_tui "https://github.com/pyxi1s/s2e-server-picker/blob/main/src/main.cpp"
click node_regions "https://github.com/pyxi1s/s2e-server-picker/blob/main/src/servers.hpp"
click node_monitor "https://github.com/pyxi1s/s2e-server-picker/blob/main/src/ping.cpp"
click node_pingcmd "https://github.com/pyxi1s/s2e-server-picker/blob/main/src/ping.cpp"
click node_firewall_manager "https://github.com/pyxi1s/s2e-server-picker/blob/main/src/firewall.cpp"
click node_os_rules "https://github.com/pyxi1s/s2e-server-picker/blob/main/src/firewall.cpp"
click node_runner "https://github.com/pyxi1s/s2e-server-picker/blob/main/src/process.cpp"
click node_updater "https://github.com/pyxi1s/s2e-server-picker/blob/main/tools/update_servers.py"

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_tui,node_user toneBlue
class node_monitor,node_pingcmd toneAmber
class node_firewall_manager,node_os_rules,node_runner toneMint
class node_regions,node_updater toneRose
class node_system,node_steam toneIndigo
```

## Components

### Picker UI

- [Picker TUI](https://github.com/pyxi1s/s2e-server-picker/blob/main/src/main.cpp): `src/main.cpp`

### Latency Monitoring

- [Ping Monitor](https://github.com/pyxi1s/s2e-server-picker/blob/main/src/ping.cpp): `src/ping.cpp`
- [Ping Probe](https://github.com/pyxi1s/s2e-server-picker/blob/main/src/ping.cpp): `src/ping.cpp`

### Firewall Control

- [Firewall Manager](https://github.com/pyxi1s/s2e-server-picker/blob/main/src/firewall.cpp): `src/firewall.cpp`
- [OS Firewall Rules](https://github.com/pyxi1s/s2e-server-picker/blob/main/src/firewall.cpp): `src/firewall.cpp`
- [Command Runner](https://github.com/pyxi1s/s2e-server-picker/blob/main/src/process.cpp): `src/process.cpp`

### Relay Data

- [Region List](https://github.com/pyxi1s/s2e-server-picker/blob/main/src/servers.hpp): `src/servers.hpp`
- [Relay IP Updater](https://github.com/pyxi1s/s2e-server-picker/blob/main/tools/update_servers.py): `tools/update_servers.py`

### Other components

- **User**
- **System Commands**
- **Steam SDR Config**

## Connections

- User → Picker TUI: selects locations (evidence: `README.md`)
- Picker TUI → Region List: loads locations (evidence: `src/main.cpp`)
- Picker TUI → Ping Monitor: starts and reads (evidence: `src/main.cpp`)
- Picker TUI → Firewall Manager: applies or resets (evidence: `src/main.cpp`)
- Ping Monitor → Ping Probe: measures latency (evidence: `src/ping.cpp`)
- Ping Probe → Command Runner: runs ping (evidence: `src/ping.cpp`)
- Firewall Manager → OS Firewall Rules: dispatches rules (evidence: `src/firewall.cpp`)
- OS Firewall Rules → Command Runner: runs firewall commands (evidence: `src/firewall.cpp`)
- Command Runner → System Commands: executes commands (evidence: `src/process.cpp`)
- Relay IP Updater → Steam SDR Config: fetches relay config (evidence: `tools/update_servers.py`)
- Relay IP Updater → Region List: rewrites IP list (evidence: `tools/update_servers.py`)
- OS Firewall Rules → System Commands: changes OS firewall (evidence: `README.md`)
