wgprobe Python package
The optional wgprobe package provides typed synchronous bindings to the
generic Rust probe. It has no provider API or account coupling and uses Python's
stable ABI for Python 3.10 and newer.
Warning: Configuration and private-key files contain secrets. Restrict their permissions, keep them out of version control, and never put key values in source, logs, command-line arguments, or environment variables.
Install
Install a Python 3.10+ wheel from PyPI:
python -m pip install wgprobe
Build from Source
Requirements are Python 3.10 or newer, a Rust toolchain, and a PEP 517 wheel builder. Build from the workspace root without installing Maturin globally:
uv run --isolated --with 'maturin>=1.14,<2' \
maturin build --release --out dist
Install the exact platform-specific wheel emitted under dist/:
WHEEL='dist/wgprobe-0.1.0-<python-abi-platform>.whl'
python -m pip install "$WHEEL"
Usage
Probe a one-peer configuration:
from wgprobe import probe_file
report = probe_file(
"path/to/test.conf",
ping=("10.5.0.1",),
resolve=("example.com",),
)
print(report.verdict)
for phase in report.phases:
print(phase.phase, phase.status, phase.detail)
The configuration must contain one peer. Data checks require IPv4
Interface.Address, matching peer AllowedIPs, and an IPv4 DNS server for DNS
queries.
Probe explicit key and endpoint inputs:
from wgprobe import probe_key_file
report = probe_key_file(
"path/to/private-key",
"<server-public-key>",
"<server-host-or-ip>:51820",
address="10.5.0.2/32",
allowed_ips=("0.0.0.0/0",),
ping=("1.1.1.1",),
resolve=("example.com",),
dns_server="103.86.96.100",
)
print(report.verdict, report.resolved_endpoint)
Omit all data-check arguments for a handshake-only call. Raw-key data checks
require address and at least one allowed_ips entry; DNS also requires
dns_server.
For a provider-specific integration, see the editable
examples/nord_find.py script:
uv run --with . examples/nord_find.py
It probes sequentially, tries each candidate once, and enforces six seconds
between starts that share a server key. Progress goes to standard error; a
confirmed result is compact JSON on standard output. Exit statuses are 0 for a
confirmation, 1 for none, and 2 for inventory or configuration errors. The
script has no cache or export; use native nordprobe find for those features.
API Contracts
The checked _wgprobe.pyi stub is the canonical function
signature reference.
| Contract | Detail |
|---|---|
| Paths | str or os.PathLike[str] |
| Collections | Lists or tuples of strings; bare strings are rejected |
| Network values | Ping and DNS servers are IPv4; addresses and routes are IPv4 CIDRs |
ProbeReport |
Frozen schema_version, verdict, configured/resolved endpoint, local UDP address, client public key, duration, byte counts, and immutable phases tuple |
PhaseResult |
Frozen phase, target, status, duration, byte counts, and detail |
| Serialization | Both report classes provide to_json() |
| Exceptions | WgprobeError is the package base exception; ConfigurationError covers invalid local inputs and plans |
| Version | wgprobe.__version__ reports the package version |
Verdicts and Errors
Reports use the stable verdict and phase-status names defined in the
wgprobe evidence contract. A
passed ping or DNS phase confirms only that exchange, not general connectivity.
Invalid files, keys, addresses, routes, DNS arguments, timeouts, and plans raise
ConfigurationError before probing. Operational unconfirmed and local_error
outcomes return reports for inspection.
Synchronous and Async Use
Calls are synchronous. Rust releases the global interpreter lock while reading and parsing secret files and while probing. Offload calls from an asyncio event loop:
import asyncio
from wgprobe import probe_file
report = await asyncio.to_thread(probe_file, "path/to/test.conf")
Cancelling the awaiting task does not cancel the Rust probe or an operating- system resolver call.
Limits and Security
| Limit | Value |
|---|---|
| Configuration file | Regular file, at most 1,048,576 bytes |
| Private-key file | Regular file, at most 4096 bytes |
| Secret paths | Symbolic links, directories, devices, and FIFOs are rejected |
| Timeout arguments | Integers from 1 through 86,400,000 milliseconds |
| Resolver capacity | Four outstanding operating-system resolver calls |
| Data checks | Inner IPv4 only, sequential, no retries |
The overall deadline caps phase timeouts. Shared probe and resolver behavior is documented in the core limits.
Secret files are read into zeroizing Rust buffers. Reports and representations contain the derived client public key but no private or preshared key. Treat reports as sensitive operational metadata.
Verify the Packaged Wheel
Cargo tests do not validate an installed extension. Set the exact wheel path emitted by Maturin, then run:
WHEEL='./dist/wgprobe-0.1.0-cp310-abi3-<platform>.whl'
uv run --isolated --with "$WHEEL" --with 'pytest>=9,<10' \
pytest python/tests
uv run --isolated --with "$WHEEL" --with 'mypy>=1.19,<2' mypy
uv run --isolated --with "$WHEEL" --with 'ruff>=0.14,<1' ruff check .
Run Rust tests separately:
cargo test --workspace
Metadata
Release files for wgprobe 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| wgprobe-0.1.6-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| wgprobe-0.1.6-cp310-abi3-manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| wgprobe-0.1.6-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| wgprobe-0.1.6-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
| wgprobe-0.1.6-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 2.5 MB
Release files / wgprobe-0.1.6-cp310-abi3-win_amd64.whl
| Download URL | wgprobe-0.1.6-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 547.1 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
85edf241637d13fe0255e5494e41d8b1b0634eff1547ccfb162171b0359eec25
|
|
BLAKE2b-256 checksum How to use checksums |
b559350e47388964cad9511e6fd41c1f7526019ff7355de2ec47c88eaecba7d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / wgprobe-0.1.6-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | wgprobe-0.1.6-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 517.9 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
666a6349d9063fdc76e552af73c566bb55a2b91e59fbf583479fbf47d970694f
|
|
BLAKE2b-256 checksum How to use checksums |
1ba2d7ca5c3429d35949d83677e46c7ce9a1a2af5afeb5ea8b7e7890676f4b9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / wgprobe-0.1.6-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | wgprobe-0.1.6-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 495.1 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
f8193a56a088c72749419559ba651ece7550254ccac8d4255483c53c0482a831
|
|
BLAKE2b-256 checksum How to use checksums |
30105c01d0e957a857dc0a98b7374d4f9f0a7eb6efdc99e36a3b933458cbfba2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / wgprobe-0.1.6-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | wgprobe-0.1.6-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 464.5 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
2a027c878148db8fffd6528e4010cc289c42e937eb38e8f25e98ea50118ee399
|
|
BLAKE2b-256 checksum How to use checksums |
4b42a469f51c67d75d38a223a1310c8a4f9c2dd46b6ca1c428dfc96399f64dec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / wgprobe-0.1.6-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | wgprobe-0.1.6-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 490.3 kB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
a3559013a769100c4cc77d65e16330566ddbf09f765926d1db2af23052232fdf
|
|
BLAKE2b-256 checksum How to use checksums |
b26e7bbd9ec37dcd69a343d1c0db099523ce7a6b3c399903f40d6f7a51f624d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|