dchk
v0.1.1
Published
UNIX-style domain availability checker (RDAP-first)
Downloads
26
Maintainers
Readme
dchk (domain availability check)
A fast, UNIX-style domain availability checker using the RDAP protocol.
Overview
dchk is a command-line tool for checking domain name availability using the Registration Data Access Protocol (RDAP). It provides clean, scriptable output with proper UNIX exit codes, making it perfect for automation and batch processing.
Features
- RDAP Protocol: Uses modern RDAP instead of deprecated WHOIS
- Authoritative Sources: Queries authoritative RDAP servers directly
- Concurrent Processing: Check multiple domains simultaneously
- UNIX-Style: Proper exit codes and clean output for scripting
- Flexible Input: Command-line arguments or stdin pipeline
- Detailed Output: Optional verbose mode with response times and sources
- Timeout Handling: Configurable timeouts with graceful error handling
Installation
From npm
npm install -g dchkUsage
Basic Usage
Check a single domain:
dchk example.com
# Output: available
# Exit code: 0 (available) or 1 (registered)Check multiple domains:
dchk google.com facebook.com nonexistent123.com
# Output:
# google.com: registered
# facebook.com: registered
# nonexistent123.com: availableVerbose Output
Get detailed information with response times and sources:
dchk --verbose google.com facebook.com nonexistent123.com
# Output:
# DOMAIN STATUS TIME SOURCE
# ────────────────────────────────────────────
# google.com REGISTERED 634ms rdap.verisign.com
# facebook.com REGISTERED 521ms rdap.verisign.com
# nonexistent123.com AVAILABLE 387ms rdap.orgStdin Input
Process domains from stdin:
echo "example.com" | dchk
cat domains.txt | dchk --verbose
echo "google.com facebook.com" | tr ' ' '\n' | dchkShell Scripting
Use exit codes for conditional logic:
if dchk mydomain.com; then
echo "Domain is available!"
else
echo "Domain is taken or error occurred"
fiCommand Line Options
Usage: dchk [options] [domains...]
UNIX-style domain availability checker (RDAP-first)
Arguments:
domains domain names to check (also reads from stdin)
Options:
-V, --version output the version number
-v, --verbose enable verbose output with response times and sources
-q, --quiet suppress non-error output
-c, --concurrency <number> maximum concurrent checks (default: "10")
-t, --timeout <number> request timeout in milliseconds (default: "5000")
--no-fallback disable authoritative RDAP fallback
-h, --help display help for commandExit Codes
Following UNIX conventions:
- 0: Domain is available (success)
- 1: Domain is registered (failure)
- 2: Error occurred (invalid domain, network error, etc.)
Examples
Check Domain Availability
dchk example.com
# available (exit code 0)
dchk google.com
# registered (exit code 1)Batch Processing
# From file
cat domains.txt | dchk --verbose --concurrency 5
# From command line
dchk domain1.com domain2.com domain3.com --verbose
# Mixed with timeout
dchk --timeout 3000 --verbose example.com test.comAutomation Scripts
#!/bin/bash
# Check if domain is available before proceeding
if dchk "$1" >/dev/null 2>&1; then
echo "Domain $1 is available - proceeding with registration"
# registration logic here
else
echo "Domain $1 is not available"
exit 1
fiPerformance Testing
# Test with high concurrency
echo "google.com facebook.com twitter.com github.com" | \
tr ' ' '\n' | \
dchk --verbose --concurrency 10 --timeout 2000Output Formats
Simple Mode (Default)
available
registered
unknownMultiple Domains
domain1.com: available
domain2.com: registered
domain3.com: unknownVerbose Mode
DOMAIN STATUS TIME SOURCE
────────────────────────────────────────────
domain1.com AVAILABLE 234ms rdap.org
domain2.com REGISTERED 456ms rdap.verisign.comRDAP Protocol
dchk uses the Registration Data Access Protocol (RDAP), the modern successor to WHOIS:
- Structured Data: JSON responses instead of unstructured text
- Standardized: Consistent format across registries
- Authoritative: Queries official registry sources
- Reliable: Better error handling and status codes
The tool automatically:
- Queries
rdap.orgas the primary source - Falls back to authoritative RDAP servers via IANA bootstrap
- Follows HTTP redirects to reach the correct endpoints
- Handles rate limiting and timeout scenarios
Development
Requirements
- Node.js >= 20.0.0
- npm or yarn
Setup
git clone https://github.com/carlrannaberg/dchk.git
cd dchk
npm installBuild
npm run build # Build for production
npm run build:watch # Build and watch for changesTesting
npm test # Run all tests
npm run test:unit # Unit tests only
npm run test:integration # Integration tests only
npm run test:e2e # End-to-end tests onlyProject Structure
├── cli/
│ ├── commands/ # Command implementations
│ ├── lib/ # Core RDAP functionality
│ ├── utils/ # Utility functions
│ └── types/ # TypeScript type definitions
├── tests/
│ ├── unit/ # Unit tests
│ ├── integration/ # Integration tests
│ └── e2e/ # End-to-end tests
└── dist/ # Built outputLibrary Usage
dchk can also be used as a library:
import { checkDomain, isValidDomain } from 'dchk';
// Check single domain
const result = await checkDomain('example.com');
console.log(result.status); // 'available', 'registered', or 'unknown'
// Validate domain format
if (isValidDomain('example.com')) {
// proceed with check
}Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for new functionality
- Ensure all tests pass (
npm test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
MIT License - see LICENSE file for details.
Related Tools
whois- Traditional WHOIS clientdig- DNS lookup utilitynslookup- DNS query toolhost- DNS lookup utility
dchk complements these tools by providing modern RDAP-based domain availability checking with clean, automatable output.
