Skip to main content

Traceroute visualization on a world map

Project description

TraceViz

Visualize traceroute paths on a world map. Traceroute 路径可视化工具 —— 在世界地图上展示网络数据包的旅行路径。

PyPI Python License CI Ruff

Features / 功能特性

  • Run traceroute and visualize each hop on an interactive world map
  • Auto-detect Chinese ISP backbone segments (ChinaTelecom 163/CN2, ChinaUnicom CUNet, ChinaMobile CMI, etc.)
  • Latency spike detection — automatically flag possible transoceanic hops
  • Cross-platform: macOS / Linux / Windows
  • ICMP and UDP probe modes
  • Pure JSON output for scripting
  • Built-in demo mode — try the frontend without running a real traceroute

Installation / 安装

# Recommended: using uv
uv tool install traceviz

# Or using Homebrew
brew install shixy96/tap/traceviz

# Or using pip
pip install traceviz

Usage / 使用

# Basic — trace to google.com and open the map in your browser
traceviz google.com

# ICMP mode (better penetration, requires sudo/admin)
sudo traceviz google.com --icmp

# JSON-only output
traceviz google.com --json

# Demo mode (simulated data)
traceviz --demo google.com

# Custom parameters
traceviz google.com --max-hops 20 --queries 3 --wait 3

# Use an ipinfo.io token for higher query limits
traceviz google.com --token YOUR_TOKEN

CLI Options

Option Description Default
target Target domain or IP address (required)
--max-hops Maximum number of hops 30
--port Local server port 8890
--token ipinfo.io API token
--icmp Use ICMP mode off
--wait Timeout per hop (seconds) 2
-q, --queries Probes per hop 2
--json JSON output only, no server off
--demo Use simulated demo data off

How It Works / 工作原理

  1. Traceroute — runs the system traceroute / tracert command and parses each hop's IP and RTT
  2. IP Lookup — queries ipinfo.io for geolocation and ASN data; matches built-in backbone rules
  3. Analysis — detects latency spikes (>100 ms jump → possible ocean crossing) and classifies network segments
  4. Visualization — starts a local Flask server and renders the path on a Leaflet world map

Requirements / 系统要求

  • Python 3.12+
  • traceroute (macOS / Linux) or tracert (Windows, built-in)
    • Ubuntu / Debian: sudo apt install traceroute

Development / 开发

# Clone
git clone https://github.com/shixy96/traceviz.git
cd traceviz

# Install dev dependencies
uv sync --extra dev

# Install locally as a tool
uv tool install .

# Run tests
uv run pytest

# Lint
uv run ruff check traceviz/ tests/

# Format check
uv run ruff format --check traceviz/ tests/

To publish a new version:

  1. Land the release changes on main, including the new value in traceviz/__init__.py.
  2. Use a Conventional Commit PR title because squash merge will reuse it as the final commit subject.
  3. Pull the latest clean main locally.
  4. Run the release script from main.
git checkout main
git pull --ff-only origin main
./scripts/tag-release.sh

The script requires git-cliff, generates and commits CHANGELOG.md, creates v<version>, and pushes both the release commit and tag to origin. GitHub Actions then builds the package, publishes to PyPI, updates the Homebrew tap, and creates the GitHub Release.

Release automation prerequisites:

  1. PyPI Trusted Publishing is configured for repository shixy96/traceviz.
  2. Create repository shixy96/homebrew-tap.
  3. Add repository secret HOMEBREW_TAP_TOKEN in shixy96/traceviz.
  4. The token needs Contents: Read and write on shixy96/homebrew-tap.
  5. Install git-cliff on the machine that runs ./scripts/tag-release.sh.

PyPI reference:

Homebrew install:

brew tap shixy96/tap
brew install traceviz

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

traceviz-0.1.3.tar.gz (63.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

traceviz-0.1.3-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file traceviz-0.1.3.tar.gz.

File metadata

  • Download URL: traceviz-0.1.3.tar.gz
  • Upload date:
  • Size: 63.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for traceviz-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c389868b8032ed4cc94a30a0117749d67117ef2b9607ac848d91a69e9fc8649c
MD5 75363819b8909c978895607a1e4b116b
BLAKE2b-256 6ff8a655838109d5b1d42eb393ec466bf4e62403e35a34d11754281e3cb35cbf

See more details on using hashes here.

Provenance

The following attestation bundles were made for traceviz-0.1.3.tar.gz:

Publisher: release.yml on shixy96/traceviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file traceviz-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: traceviz-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for traceviz-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c3d28218c8510bde8a26d6bcdcf80876122e5e7b8658b5ee27704da1bb086dca
MD5 b004d91d345b7ba42a01dda96fe1c94f
BLAKE2b-256 320f96d038899d65d88802323ef5f8b632f41c06e42bdcb8083eb3b3e5c4a123

See more details on using hashes here.

Provenance

The following attestation bundles were made for traceviz-0.1.3-py3-none-any.whl:

Publisher: release.yml on shixy96/traceviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page