feat: Windows DNS configuration via netsh #28

Merged
razvandimescu merged 16 commits from feat/windows-dns-config into main 2026-04-01 23:17:52 +08:00
3 changed files with 74 additions and 7 deletions
Showing only changes of commit 787733cbea - Show all commits

View File

@@ -15,16 +15,32 @@ Built from scratch in Rust. Zero DNS libraries. RFC 1035 wire protocol parsed by
## Quick Start ## Quick Start
```bash ```bash
# macOS
brew install razvandimescu/tap/numa brew install razvandimescu/tap/numa
# or: cargo install numa
# or: curl -fsSL https://raw.githubusercontent.com/razvandimescu/numa/main/install.sh | sh
sudo numa # port 53 requires root # Linux
curl -fsSL https://raw.githubusercontent.com/razvandimescu/numa/main/install.sh | sh
# Windows — download from GitHub Releases
# All platforms
cargo install numa
```
```bash
sudo numa # run in foreground (port 53 requires root/admin)
``` ```
Open the dashboard: **http://numa.numa** (or `http://localhost:5380`) Open the dashboard: **http://numa.numa** (or `http://localhost:5380`)
Set as system DNS: `sudo numa install` Set as system DNS:
| Platform | Install | Uninstall |
|----------|---------|-----------|
| macOS | `sudo numa install` | `sudo numa uninstall` |
| Linux | `sudo numa install` | `sudo numa uninstall` |
| Windows | `numa install` (admin) + reboot | `numa uninstall` (admin) + reboot |
On macOS and Linux, numa runs as a system service (launchd/systemd). On Windows, numa auto-starts on login via registry.
## Local Services ## Local Services
@@ -80,7 +96,7 @@ From Machine B: `curl http://api.numa` → proxied to Machine A's port 8000. Ena
| Ad blocking | Yes | Yes | — | 385K+ domains | | Ad blocking | Yes | Yes | — | 385K+ domains |
| Web admin UI | Full | Full | — | Dashboard | | Web admin UI | Full | Full | — | Dashboard |
| Encrypted upstream (DoH) | Needs cloudflared | Yes | — | Native | | Encrypted upstream (DoH) | Needs cloudflared | Yes | — | Native |
| Portable (laptop) | No (appliance) | No (appliance) | Server | Single binary | | Portable (laptop) | No (appliance) | No (appliance) | Server | Single binary, macOS/Linux/Windows |
| Community maturity | 56K stars, 10 years | 33K stars | 20 years | New | | Community maturity | 56K stars, 10 years | 33K stars | 20 years | New |
## Performance ## Performance

View File

@@ -0,0 +1,49 @@
# Windows Support — Implementation Plan
*MarchApril 2026*
## Phase 1: Run on Windows without system integration — DONE (v0.3.0)
- [x] Cross-platform `config_dir()` and `data_dir()`
- [x] `src/system_dns.rs` — Windows DNS discovery via `ipconfig /all`
- [x] Stubs for install/uninstall/service on unsupported OS
- [x] Multicast LAN discovery (`SO_REUSEPORT` skipped on Windows)
- [x] All deps compile on windows-msvc
- [x] CI: `check-windows` job (build + clippy)
- [x] Cross-platform LAN discovery tested: macOS ↔ Windows
## Phase 2: DNS configuration — DONE (PR #28)
- [x] `numa install` — set DNS to 127.0.0.1 via `netsh` for all active interfaces
- [x] `numa uninstall` — restore DNS from backup (DHCP or static with secondaries)
- [x] `ipconfig /all` parser — per-interface adapter name, DHCP status, DNS servers
- [x] Localization — German adapter/DHCP/DNS labels handled
- [x] Disconnected adapters — skipped
- [x] Backup — `%PROGRAMDATA%\numa\original-dns.json`
- [x] Dnscache — disable via registry on install, re-enable on uninstall (reboot required)
- [x] Auto-start — registry Run key (`HKLM\...\Run\Numa`) on install, removed on uninstall
- [x] UDP ConnectionReset — Windows ICMP error 10054 caught and ignored
- [x] IP validation — added to `discover_windows()`
- [x] CI: `cargo test` + binary artifact upload on Windows
- [ ] `README.md` — add Windows install instructions
## Phase 3: Full service integration (future)
### Windows Service
- Use `windows-service` crate to register Numa as a Windows Service
- `sc.exe create numa binPath=...` as alternative
- Auto-start on boot (SYSTEM context, no login required), auto-restart on crash
- Replace registry Run key with proper SCM integration
### CA trust
- `certutil.exe -addstore Root ca.pem` to trust Numa CA system-wide
- Reverse: `certutil.exe -delstore Root "Numa Local CA"`
- Needs admin elevation
### DHCP DNS detection
- Current `detect_dhcp_dns()` returns `None` on Windows
- Could parse `ipconfig /all` for "DHCP Server" + "DNS Servers" lines
- Or use WinAPI `GetNetworkParams()`

View File

@@ -614,5 +614,7 @@ auto-revert. Different audiences: Technitium targets server admins, Numa
targets developers on laptops. targets developers on laptops.
**"Does it support Windows?"** **"Does it support Windows?"**
macOS and Linux are the primary targets. Windows has scaffolding in the code Yes. `numa install` in an admin terminal sets system DNS and auto-starts
but is not tested. If there's demand, it's on the list. numa on boot. Requires a reboot (Windows DNS Client holds port 53 at kernel
level). `numa uninstall` restores everything. Native Windows Service
integration is next.