Initial commit: dnsmasq web UI

- ASP.NET Core 9 Blazor Web App + Web API
- Hosts file management (read/write, hosts(5) format)
- DHCP static hosts (dhcp-host=, dnsmasq config)
- DHCP leases (read-only, dnsmasq lease file format)
- Reload and status commands (configurable)
- Docker: standalone app image + Dockerfile.dnsmasq (app + dnsmasq)
- docker-compose.test.yml: app + dhcp-client, testdata mount
- Unit tests (Hosts, DhcpHost, Leases, DnsmasqConfig parsers) using testdata
This commit is contained in:
2026-01-31 03:06:46 +10:00
commit e99b2d0453
105 changed files with 62565 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
# Test data for docker-compose.test.yml
- **hosts** – Shared by app and dnsmasq (read/write by app, `addn-hosts` for dnsmasq).
- **dnsmasq.conf** – Sample main config (reference only; not used by the test containers).
- **dnsmasq-test.conf** – Config for dnsmasq when run inside the app container (DHCP-only, paths under `/data`).
- **dnsmasq.d/dhcp.conf** – DHCP static hosts; app edits this, dnsmasq loads it via `conf-dir`.
- **dnsmasq.d/01-other.conf** – Other snippet (not managed by app).
- **leases** – Empty at start. dnsmasq creates and populates it when the dhcp-client container gets a lease. App reads it (read-only).
All of this is bind-mounted as `/data` in the **app** container; the app runs as the main process and dnsmasq runs in the background in the same container.
+9
View File
@@ -0,0 +1,9 @@
# Config for the dnsmasq test container only (docker-compose.test.yml).
# DHCP-only; uses same testdata layout so app and dnsmasq share hosts, dhcp.conf, leases.
port=0
interface=eth0
bind-interfaces
dhcp-range=172.28.0.10,172.28.0.50,255.255.255.0,12h
dhcp-leasefile=/data/leases
conf-dir=/data/dnsmasq.d
addn-hosts=/data/hosts
+4
View File
@@ -0,0 +1,4 @@
# Sample main dnsmasq config (not managed by this app).
# In production this would typically be /etc/dnsmasq.conf.
# It includes all .conf files from dnsmasq.d/ (e.g. dhcp.conf managed by this app).
conf-dir=/etc/dnsmasq.d/
+2
View File
@@ -0,0 +1,2 @@
# Not managed by this app. The app only edits dhcp.conf; this file should stay unchanged when saving from the UI.
domain=local
+2
View File
@@ -0,0 +1,2 @@
# Sample dhcp-host entries for integration testing (managed by this app)
dhcp-host=aa:bb:cc:dd:ee:ff,192.168.1.10,testpc,infinite
+2
View File
@@ -0,0 +1,2 @@
127.0.0.1 localhost
::1 localhost
+2
View File
@@ -0,0 +1,2 @@
1738166400 aa:bb:cc:dd:ee:ff 192.168.1.10 testpc 01:02:03:04:05:06
1738166300 11:22:33:44:55:66 192.168.1.11 * *