Skip to content

network-dns-slice (part 1/2): DNS Clean-Arch slice + single injection point#26

Merged
luisguzman-adfa merged 2 commits into
mainfrom
feat/network-dns-slice-part1
Jun 23, 2026
Merged

network-dns-slice (part 1/2): DNS Clean-Arch slice + single injection point#26
luisguzman-adfa merged 2 commits into
mainfrom
feat/network-dns-slice-part1

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

Part 1 of 2 of the DNS feature (sequential, layered). Part 2 (UX) builds on this branch -- see feat/network-dns-slice-part2-ux.

What this does

Introduces the org.iiab.controller.network Clean-Architecture slice and makes it the single DNS injection point, replacing the three scattered hardcoded resolv.conf writes.

  • domain (pure JVM, unit-tested): DnsConfig (primary/secondary, each a single IPv4 or IPv6 -- mixed allowed), DnsValidator (fail-closed), ports DnsConfigRepository + ResolvConfWriter, use cases Get/Save/ApplyDns.
  • data: PrefsDnsConfigRepository (new prefs keys; custom-vs-defaults semantics for the future 'Setup DNS' toggle) + FileResolvConfWriter (overwrites resolv.conf so the UI can change DNS dynamically; guards etc/).
  • wiring: PRootEngine.executeInContainer now writes the effective DNS into the rootfs before every proot launch (boot/bootstrap/install/maps). The hardcoded writes + ensureRuntimeNetworkConfig helper in DeployFragment are removed.

Behavior

Equivalent for default DNS (1.1.1.1 / 8.8.8.8), now applied from one place and ready to honor a user-configured value (Part 2). resolv.conf is overwritten each launch (idempotent).

Layering note (if ever reverting)

Strangler refactor in parts. Reverting part 1 alone breaks part 2; reverting part 2 alone leaves backend on defaults with no UI. Sequence, not independent toggles.

Not in this PR

  • UX panel in Usage (part 2).
  • MainActivity reset/clean-base calls libproot directly and keeps its inline write -- the one documented exception (later cleanup PR).

Domain unit-tested.

…e (PR A)

Introduce org.iiab.controller.network slice (domain + data + JVM tests) and
wire it as the SINGLE DNS injection point:

- domain: DnsConfig (mixed primary/secondary, each IPv4 or IPv6), DnsValidator
  (fail-closed), ports DnsConfigRepository + ResolvConfWriter, use cases
  Get/Save/ApplyDns. Pure JVM, unit-tested.
- data: PrefsDnsConfigRepository (new prefs keys; custom-vs-defaults for the
  'Setup DNS' toggle) + FileResolvConfWriter (overwrites resolv.conf so the UI
  can change DNS dynamically; guards etc/).
- wiring: PRootEngine.executeInContainer applies the effective DNS into the
  rootfs before every proot launch, so the scattered hardcoded writes in
  DeployFragment (fast-install, restore, bootstrap) + its helper are removed.

MainActivity reset/clean-base uses libproot directly and keeps its inline write
for now (the one documented exception). UI (Setup DNS panel) is PR B.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@luisguzman-adfa luisguzman-adfa changed the title feat(network): single-point DNS injection via Clean Architecture slic… network-dns-slice (part 1/2): DNS Clean-Arch slice + single injection point Jun 22, 2026
A DNS server can't be the guest itself: 127.0.0.0/8 and ::1 (loopback) and
0.0.0.0 / :: (unspecified) are now rejected by DnsValidator with a clear reason,
so the UI shows 'invalid' instead of silently failing/'jumping' when the user
enters 127.0.0.1 (it never reaches the probe or gets applied). Unit-tested.
@luisguzman-adfa luisguzman-adfa merged commit 76ca7d4 into main Jun 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant