Skip to content

Commit 7d3ed7b

Browse files
committed
Add IANA WHOIS server sync automation
Features: - fetch-iana-servers.js: Sync WHOIS servers from IANA Root Zone Database - GitHub Action: Auto-sync weekly on Sunday at 2 AM UTC + on every push - Auto-update README.md with last sync date - Support for all 1,439 TLDs from IANA (up from 1,260) Scripts: - npm run sync-iana: Full sync from IANA - npm run sync-iana:dry-run: Preview changes without saving Data source: https://data.iana.org/TLD/tlds-alpha-by-domain.txt Updates: - README.md: Added WHOIS server dictionary maintenance section - package.json: Added sync scripts and node-fetch dependency - .github/workflows/sync-iana.yml: Weekly automated sync workflow
1 parent 607110a commit 7d3ed7b

4 files changed

Lines changed: 392 additions & 2 deletions

File tree

.github/workflows/sync-iana.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Sync IANA WHOIS Servers
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
schedule:
7+
# Run weekly on Sunday at 2 AM UTC to catch IANA updates
8+
- cron: '0 2 * * 0'
9+
workflow_dispatch: # Allow manual trigger
10+
11+
jobs:
12+
sync:
13+
runs-on: ubuntu-latest
14+
15+
permissions:
16+
contents: write # Required to push changes
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
with:
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '18'
28+
29+
- name: Install dependencies
30+
run: npm install
31+
32+
- name: Run IANA sync
33+
run: npm run sync-iana
34+
35+
- name: Check for changes
36+
id: changes
37+
run: |
38+
if git diff --quiet whois_dict.json README.md; then
39+
echo "changed=false" >> $GITHUB_OUTPUT
40+
echo "No changes detected"
41+
else
42+
echo "changed=true" >> $GITHUB_OUTPUT
43+
echo "Changes detected in whois_dict.json or README.md"
44+
fi
45+
46+
- name: Commit and push changes
47+
if: steps.changes.outputs.changed == 'true'
48+
run: |
49+
git config --local user.name "github-actions[bot]"
50+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
51+
git add whois_dict.json README.md
52+
git commit -m "chore: auto-sync IANA WHOIS servers [skip ci]
53+
54+
- Updated whois_dict.json from IANA Root Zone Database
55+
- Updated last sync date in README.md
56+
- Triggered by: ${{ github.event_name }}
57+
58+
Data source: https://data.iana.org/TLD/tlds-alpha-by-domain.txt"
59+
git push
60+
61+
- name: Create backup artifact
62+
if: steps.changes.outputs.changed == 'true'
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: whois-dict-backup-${{ github.run_number }}
66+
path: whois_dict.json.backup.*
67+
retention-days: 30
68+
69+
- name: Summary
70+
run: |
71+
if [ "${{ steps.changes.outputs.changed }}" == "true" ]; then
72+
echo "✅ WHOIS dictionary updated successfully" >> $GITHUB_STEP_SUMMARY
73+
echo "" >> $GITHUB_STEP_SUMMARY
74+
echo "Changes have been committed and pushed to the repository." >> $GITHUB_STEP_SUMMARY
75+
else
76+
echo "ℹ️ No updates needed" >> $GITHUB_STEP_SUMMARY
77+
echo "" >> $GITHUB_STEP_SUMMARY
78+
echo "WHOIS dictionary is already up-to-date with IANA." >> $GITHUB_STEP_SUMMARY
79+
fi

README.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
Last updated: 2025-10-30
2+
13
# WHOIS Parser for ccTLDs
24

3-
A comprehensive, battle-tested WHOIS parser with support for 169 country-code TLDs (ccTLDs). Built for [DomainDetails.com](https://domaindetails.com) by Simple Bytes LLC.
5+
A comprehensive, battle-tested WHOIS parser with support for 169 country-code TLDs (ccTLDs) and 1,260+ TLDs total. Built for [DomainDetails.com](https://domaindetails.com) by Simple Bytes LLC.
6+
7+
## WHOIS Server Dictionary
8+
9+
This repository includes `whois_dict.json` with WHOIS servers for **1,260+ TLDs** (updated from IANA Root Zone Database).
410

511
## Overview
612

@@ -83,6 +89,45 @@ The 99 "partial data" ccTLDs are often **policy limitations, not bugs**:
8389
- **Robust Error Handling**: Graceful fallbacks for missing fields
8490
- **Comprehensive Testing**: 169 ccTLD test suite included
8591

92+
## WHOIS Server Dictionary Maintenance
93+
94+
The `whois_dict.json` file is automatically synced with the [IANA Root Zone Database](https://www.iana.org/domains/root/db).
95+
96+
### Sync from IANA
97+
98+
```bash
99+
# Install dependencies first
100+
npm install
101+
102+
# Sync WHOIS servers from IANA (updates whois_dict.json)
103+
npm run sync-iana
104+
105+
# Preview changes without saving
106+
npm run sync-iana:dry-run
107+
```
108+
109+
The sync script:
110+
- Fetches complete TLD list from `https://data.iana.org/TLD/tlds-alpha-by-domain.txt` (1,439 TLDs)
111+
- Gets WHOIS server for each TLD from individual IANA pages
112+
- Updates `whois_dict.json` with sorted results
113+
- Creates dated backups before making changes
114+
- Updates README with last sync date
115+
116+
### Automated Updates
117+
118+
A GitHub Action automatically syncs the dictionary:
119+
- **On every push** to main/master branch
120+
- **Weekly on Sunday at 2 AM UTC** to catch IANA updates
121+
- **Manual trigger** via GitHub Actions UI
122+
123+
When changes are detected, the action:
124+
- Updates `whois_dict.json` with new/changed TLD servers
125+
- Updates README with current date
126+
- Creates dated backups
127+
- Commits and pushes changes automatically
128+
129+
See `.github/workflows/sync-iana.yml` for details.
130+
86131
## Installation
87132

88133
```bash

0 commit comments

Comments
 (0)