Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zigmir

🚀 A blazing-fast Linux distro mirror speed tester written in Zig

Zigmir automatically finds the fastest pacman mirrors for your location using multi-metric analysis and weighted scoring.

Languages: English | 中文 | 日本語 | Español | Français | Português

Supported distros: Arch-based (including Manjaro), Ubuntu-based, Debian-based, Fedora, and openSUSE.

Features

  • Concurrent Testing - Tests multiple mirrors simultaneously using thread pools
  • 📊 Multi-Metric Analysis - Measures download speed, TTFB, TCP latency, and packet loss
  • 🎯 Weighted Scoring - Combines all metrics into a single score for optimal selection
  • 📈 Statistical Accuracy - Uses median of multiple samples for stable results
  • 🔄 Auto-Retry - Automatically retries failed tests
  • ✏️ One-Click Update - Update Arch mirrorlist or APT sources on Debian/Ubuntu families

Installation

Install via yay (AUR)

yay -S zigmir-bin

Install via APT (Debian/Ubuntu)

curl -fsSL https://rownix101.github.io/zigmir/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/zigmir.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/zigmir.gpg] https://rownix101.github.io/zigmir stable main" | sudo tee /etc/apt/sources.list.d/zigmir.list
sudo apt-get update
sudo apt-get install zigmir

Build from Source

Requires Zig 0.15.2 or later.

git clone https://github.com/rownix101/zigmir.git
cd zigmir
zig build -Doptimize=ReleaseFast

The binary will be at zig-out/bin/pacman_mirror_speedtest.

Usage

# Find top 10 mirrors globally
zigmir

# Find top 5 mirrors in the US
zigmir -c US -t 5

# Find mirrors in the US with high concurrency
zigmir -c US -n 50

# Use custom scoring weights (speed, ttfb, stability, packet_loss)
zigmir -w 0.5,0.2,0.2,0.1

# Generate shell completion
zigmir --completion bash

Options

Option Description Default
-c, --country <NAME|CODE> Filter by country (e.g., CN, Germany) All
-t, --top <N> Show top N mirrors 10
-n, --concurrency <N> Number of concurrent tests 10
-r, --max-retries <N> Max retry attempts 2
-s, --speed-samples <N> Speed test samples (1-3) 3
-w, --weights <S,T,L,P> Custom weights 0.4,0.3,0.2,0.1
-4, --ipv4 Force IPv4 only -
-6, --ipv6 Force IPv6 only -
-p, --profile <NAME> Use preset profile (throughput, connection) -
-v, --verbose Show verbose test output -
-q, --quiet Suppress non-error output -
--no-color Disable ANSI colors -
--no-update Skip source update prompt -
--yes Update sources without prompt -
--weekly Quiet weekly mode (auto-update sources + repo sync) -
--completion <SHELL> Print completion script (bash, zsh, fish) -
-h, --help Show help -

Shell Completion

# Bash
zigmir --completion bash | sudo tee /usr/share/bash-completion/completions/zigmir >/dev/null

# Zsh
zigmir --completion zsh | sudo tee /usr/share/zsh/site-functions/_zigmir >/dev/null

# Fish
zigmir --completion fish | sudo tee /usr/share/fish/vendor_completions.d/zigmir.fish >/dev/null

Scoring Profiles

  • Default: Balanced (Speed 40%, TTFB 30%, Stability 20%, Reliability 10%)
  • Throughput: Speed-focused (Speed 70%, TTFB 10%, Stability 10%, Reliability 10%)
  • Connection: Latency-focused (Speed 20%, TTFB 60%, Stability 10%, Reliability 10%)

Output Example

==========================================================================================
Top Fast Mirrors (sorted by weighted score):
------------------------------------------------------------------------------------------
URL                                      Country      Proto      Speed    TTFB Latency  Loss   Score
------------------------------------------------------------------------------------------
https://mirrors.kernel.org/archlinux/     United States  https   9123.15   110ms    38ms    0%    94.8
https://mirror.rackspace.com/archlinux/   United States  https   8012.44   128ms    41ms    0%    89.6
https://mirrors.edge.kernel.org/archlinux/ United States https   7324.89   136ms    44ms    0%    85.1

==========================================================================================
Update mirrorlist?
Write top 3 mirrors to /etc/pacman.d/mirrorlist? [y/N]: 

Weekly Mode (systemd timer)

Weekly mode runs a test and updates distro sources without prompts, then runs the repo sync command (pacman -Syy or apt-get update). You can edit the country and other flags in the service file.

Install the weekly timer (recommended):

sudo zigmir --install-weekly --country US --top 3

Manual setup:

Create /etc/systemd/system/zigmir-weekly.service:

[Unit]
Description=Weekly mirror speed test (zigmir)

[Service]
Type=oneshot
ExecStart=/usr/bin/zigmir --weekly --country US --top 3

Create /etc/systemd/system/zigmir-weekly.timer:

[Unit]
Description=Run zigmir weekly

[Timer]
OnCalendar=weekly
Persistent=true

[Install]
WantedBy=timers.target

Enable the timer:

sudo systemctl daemon-reload
sudo systemctl enable --now zigmir-weekly.timer

How It Works

  1. Fetch - Downloads official mirror list from Arch/Ubuntu/Debian sources
  2. Filter - Applies country and protocol filters
  3. Test - Concurrently tests each mirror:
    • TCP connection latency
    • Time to First Byte (TTFB)
    • Download speed (multiple samples → median)
  4. Score - Calculates weighted composite score
  5. Rank - Sorts by score and displays results
  6. Update - Optionally writes top mirrors to Arch mirrorlist or APT sources

License

MIT

Contributing

Issues and PRs are welcome!

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages