Skip to main content

CLI Mode

Starting with v3.0.0, DNS-MNS supports full non-interactive CLI mode via subcommands and flags. This is perfect for scripting, automation, and CI/CD pipelines.

Commands

Test DNS Servers

# Test all DNS servers
dns-mns test

# Test specific category
dns-mns test gaming
dns-mns test regional
dns-mns test international

# Output JSON
dns-mns test gaming --json --top 5
Available categories: international, regional, gaming, vpn, additional, all

Smart Recommendation

# Default balanced profile
dns-mns recommend

# Gaming profile (prioritizes latency)
dns-mns recommend --profile gaming

# Privacy profile (prioritizes encryption)
dns-mns recommend --profile privacy --json

Test Encrypted DNS

# Test DoH/DoT providers
dns-mns test-doh

# Test DNSCrypt providers
dns-mns test-dnscrypt

Set / Clear DNS

# Set DNS
dns-mns set 1.1.1.1 1.0.0.1

# Reset to DHCP
dns-mns clear

Live Dashboard

dns-mns dashboard
Launches a live-updating TUI that monitors DNS server health, shows current DNS configuration, and proxy status.

Auto-Update

dns-mns update
Checks GitLab for new releases and self-updates the binary.

Advanced Proxy (Sing-box)

# Start VLESS + REALITY proxy
dns-mns singbox start \
  --protocol vless \
  --server your-server.com:443 \
  --uuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
  --public-key YOUR_PUBLIC_KEY \
  --short-id YOUR_SHORT_ID \
  --sni www.microsoft.com

# Start with configuration file
dns-mns singbox start --config /path/to/config.json

# Check proxy status
dns-mns singbox status

# Stop proxy
dns-mns singbox stop

# Test configuration
dns-mns singbox test --protocol vless --server example.com:443 --uuid xxx

# Generate example config
dns-mns singbox config-example --protocol vless-reality
Supports protocols: vless, vmess, trojan, hysteria2, shadowtls, tuic

Global Flags

FlagDescription
--jsonOutput results in JSON format
--no-colorDisable colored output
--top NNumber of top results (default 3)
--versionShow version
--helpShow help
The NO_COLOR environment variable is also respected.

JSON Output Examples

DNS Test Results

[
  {
    "rank": 1,
    "name": "Shecan",
    "primary": "178.22.122.100",
    "secondary": "185.51.200.2",
    "location": "Iran",
    "category": "Regional/Middle East DNS",
    "ping_ms": 5.2,
    "dns_ms": 8.1,
    "score": 13.3
  }
]

Recommendation Results

[
  {
    "rank": 1,
    "name": "Shecan",
    "total_score": 86.0,
    "ping_ms": 5.2,
    "dns_ms": 8.1,
    "ping_score": 100,
    "dns_score": 95,
    "protocol_score": 20,
    "privacy_score": 40,
    "iran_score": 100,
    "geo_score": 100,
    "reason": "excellent ping, fast DNS resolution, reliable in Iran, nearby server",
    "protocol_support": ["plain"]
  }
]

Scripting Examples

Find the best DNS and set it automatically

BEST=$(dns-mns test gaming --json --top 1 | jq -r '.[0].primary')
dns-mns set "$BEST"

Monitor DNS health in a cron job

# Add to crontab: check DNS every hour
0 * * * * dns-mns test --json --top 1 --no-color >> /var/log/dns-health.json