Files
computer-playbook/cli/contributing/network/diagnose/config.py
T
kevinveenbirkenbachandClaude Opus 4.7 e4e861c261 refactor(cli): move ports/networks suggesters under cli/contributing/network and add diagnose subcommand
Relocates `cli/meta/{ports,networks/suggest}` to
`cli/contributing/network/{ports,address/suggest}` so port and subnet
allocators live alongside the rest of the contributor-side tooling
(mirror, update, changelog) instead of `meta`. Mirrors the tests
into `tests/unit/cli/contributing/network/` and renames the contract
docs to `docs/contributing/tools/network/{port,address}.md`. Prog
names update from `cli meta ports suggest` / `cli meta networks
suggest` to `cli contributing network ports suggest` / `cli
contributing network address suggest`; the corresponding lint
references and `utils.meta.scan` docstring follow.

Adds a third subcommand: `cli contributing network diagnose`
(stdlib-only DNS / TCP / TLS / PMTU probe against the standard
infrastructure hosts plus interface MTU, `/etc/resolv.conf`,
`/etc/hosts`, proxy env, CA-bundle summaries). Split across `cli.py`
(orchestration), `config.py` (SPOT for hosts / per-distro install
commands), `format.py` (output + subprocess helpers), `tools.py`
(distro-aware auto-install of `iputils-ping` + `iproute2`),
`report.py` (system-info dumps + IPv6-default-route detection), and
`probes.py` (per-host probes). Exposed as `make debug-network`.

Companion `docs/contributing/actions/debugging/network.md` absorbs
the diagnose-tool walkthrough (incl. how to read MTU-induced TLS
handshake timeouts) so the merged page covers DNS / MTU / IPv6 /
connectivity end-to-end.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 14:55:10 +02:00

71 lines
1.8 KiB
Python

"""Single point of truth for diagnose constants."""
from __future__ import annotations
DEFAULT_HOSTS: tuple[str, ...] = (
"github.com",
"objects.githubusercontent.com",
"raw.githubusercontent.com",
"ghcr.io",
"registry-1.docker.io",
"auth.docker.io",
"pypi.org",
"files.pythonhosted.org",
"registry.npmjs.org",
)
TOOLS: tuple[str, ...] = ("ping", "ip")
INSTALL_CMDS: dict[str, list[str]] = {
"debian": [
"apt-get",
"install",
"-y",
"--no-install-recommends",
"-o",
"DPkg::Lock::Timeout=120",
"iputils-ping",
"iproute2",
],
"ubuntu": [
"apt-get",
"install",
"-y",
"--no-install-recommends",
"-o",
"DPkg::Lock::Timeout=120",
"iputils-ping",
"iproute2",
],
"arch": ["pacman", "-S", "--noconfirm", "--needed", "iputils", "iproute2"],
"fedora": ["dnf", "install", "-y", "iputils", "iproute"],
"centos": ["dnf", "install", "-y", "iputils", "iproute"],
"rhel": ["dnf", "install", "-y", "iputils", "iproute"],
}
PROXY_ENV_KEYS: tuple[str, ...] = (
"HTTP_PROXY",
"HTTPS_PROXY",
"NO_PROXY",
"http_proxy",
"https_proxy",
"no_proxy",
"SSL_CERT_FILE",
"REQUESTS_CA_BUNDLE",
"CURL_CA_BUNDLE",
"NODE_EXTRA_CA_CERTS",
"CA_TRUST_CERT_HOST",
"CA_TRUST_NAME",
)
CA_BUNDLE_CANDIDATES: tuple[str, ...] = (
"/etc/ssl/certs/ca-certificates.crt",
"/etc/pki/tls/certs/ca-bundle.crt",
"/etc/ssl/ca-bundle.pem",
"/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem",
)
PMTU_PROBE_SIZES: tuple[int, ...] = (1472, 1452, 1400, 1300, 1200, 1024, 576, 256)
EXTRA_HOSTS_ENV = "INFINITO_NET_DEBUG_HOSTS" # nocheck: ad-hoc probe override; not part of the env registry