# th0b1a5/png-cli architecture

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

- Interactive diagram: https://gitdiagram.com/th0b1a5/png-cli
- Repository: https://github.com/th0b1a5/png-cli

## Overview

png is a Linux CLI for managing endpoint groups and checking their health over HTTP/S, TCP, or ICMP. The main workflow loads the user's configuration, selects a group, probes its endpoints concurrently, and prints latency and status. The same command handler supports listing, creating, and deleting groups or endpoints, persisting those changes in the JSON config file. The excerpt shows these responsibilities concentrated in main.go; omitted portions limit certainty about some command branches and configuration details.

Main entry points: [`main.go`](https://github.com/th0b1a5/png-cli/blob/main/main.go) (Command handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and groups"]
  node_commands["Command handler<br/>[main.go]"]
  node_group_ops["Group management<br/>[main.go]"]
  node_endpoint_ops["Endpoint management<br/>[main.go]"]
end

subgraph group_checks["Health checks"]
  node_probe_dispatch["Probe dispatch<br/>[main.go]"]
  node_http_probe["HTTP/S probe<br/>[main.go]"]
  node_tcp_probe["TCP probe<br/>[main.go]"]
  node_icmp_probe["ICMP probe<br/>[main.go]"]
  node_status_output["Status output<br/>[main.go]"]
end

subgraph group_state["Configuration"]
  node_config[("JSON configuration<br/>[main.go]")]
  node_config_path["Config path<br/>[main.go]"]
end

node_user(("CLI user"))
node_http_service{{"HTTP endpoints"}}
node_tcp_service{{"TCP endpoints"}}
node_icmp_service{{"ICMP targets"}}

node_user -->|"runs"| node_commands
node_commands -->|"loads"| node_config
node_commands -->|"dispatches"| node_group_ops
node_commands -->|"dispatches"| node_endpoint_ops
node_group_ops -->|"updates"| node_config
node_endpoint_ops -->|"updates"| node_config
node_commands -->|"pings group"| node_probe_dispatch
node_probe_dispatch -->|"checks HTTP/S"| node_http_probe
node_probe_dispatch -->|"checks TCP"| node_tcp_probe
node_probe_dispatch -->|"checks ICMP"| node_icmp_probe
node_http_probe -->|"sends request"| node_http_service
node_tcp_probe -->|"dials"| node_tcp_service
node_icmp_probe -->|"pings"| node_icmp_service
node_probe_dispatch -->|"prints result"| node_status_output
node_config_path -->|"locates"| node_config

click node_commands "https://github.com/th0b1a5/png-cli/blob/main/main.go"
click node_group_ops "https://github.com/th0b1a5/png-cli/blob/main/main.go"
click node_endpoint_ops "https://github.com/th0b1a5/png-cli/blob/main/main.go"
click node_config "https://github.com/th0b1a5/png-cli/blob/main/main.go"
click node_config_path "https://github.com/th0b1a5/png-cli/blob/main/main.go"
click node_probe_dispatch "https://github.com/th0b1a5/png-cli/blob/main/main.go"
click node_http_probe "https://github.com/th0b1a5/png-cli/blob/main/main.go"
click node_tcp_probe "https://github.com/th0b1a5/png-cli/blob/main/main.go"
click node_icmp_probe "https://github.com/th0b1a5/png-cli/blob/main/main.go"
click node_status_output "https://github.com/th0b1a5/png-cli/blob/main/main.go"

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_commands,node_group_ops,node_endpoint_ops,node_user toneBlue
class node_probe_dispatch,node_http_probe,node_tcp_probe,node_icmp_probe,node_status_output toneAmber
class node_config,node_config_path toneMint
class node_http_service,node_tcp_service,node_icmp_service toneIndigo
```

## Components

### CLI and groups

- [Command handler](https://github.com/th0b1a5/png-cli/blob/main/main.go): `main.go`
- [Group management](https://github.com/th0b1a5/png-cli/blob/main/main.go): `main.go`
- [Endpoint management](https://github.com/th0b1a5/png-cli/blob/main/main.go): `main.go`

### Health checks

- [Probe dispatch](https://github.com/th0b1a5/png-cli/blob/main/main.go): `main.go`
- [HTTP/S probe](https://github.com/th0b1a5/png-cli/blob/main/main.go): `main.go`
- [TCP probe](https://github.com/th0b1a5/png-cli/blob/main/main.go): `main.go`
- [ICMP probe](https://github.com/th0b1a5/png-cli/blob/main/main.go): `main.go`
- [Status output](https://github.com/th0b1a5/png-cli/blob/main/main.go): `main.go`

### Configuration

- [JSON configuration](https://github.com/th0b1a5/png-cli/blob/main/main.go): `main.go`
- [Config path](https://github.com/th0b1a5/png-cli/blob/main/main.go): `main.go`

### Other components

- **CLI user**
- **HTTP endpoints**
- **TCP endpoints**
- **ICMP targets**

## Connections

- CLI user → Command handler: runs (evidence: `main.go`)
- Command handler → JSON configuration: loads (evidence: `main.go`)
- Command handler → Group management: dispatches (evidence: `main.go`)
- Command handler → Endpoint management: dispatches (evidence: `main.go`)
- Group management → JSON configuration: updates (evidence: `main.go`)
- Endpoint management → JSON configuration: updates (evidence: `main.go`)
- Command handler → Probe dispatch: pings group (evidence: `main.go`)
- Probe dispatch → HTTP/S probe: checks HTTP/S (evidence: `main.go`)
- Probe dispatch → TCP probe: checks TCP (evidence: `main.go`)
- Probe dispatch → ICMP probe: checks ICMP (evidence: `main.go`)
- HTTP/S probe → HTTP endpoints: sends request (evidence: `main.go`)
- TCP probe → TCP endpoints: dials (evidence: `main.go`)
- ICMP probe → ICMP targets: pings (evidence: `main.go`)
- Probe dispatch → Status output: prints result (evidence: `main.go`)
- Config path → JSON configuration: locates (evidence: `main.go`)
