Skip to content

fix: add networksetup add, remove, and clear support to DNS plugin (#178) - #215

Open
Linboss9 wants to merge 1 commit into
rgcr:mainfrom
Linboss9:fix/178-dns-features
Open

fix: add networksetup add, remove, and clear support to DNS plugin (#178)#215
Linboss9 wants to merge 1 commit into
rgcr:mainfrom
Linboss9:fix/178-dns-features

Conversation

@Linboss9

Copy link
Copy Markdown

Description

Resolves #178.

This PR enhances plugins/dns by implementing native networksetup DNS management instead of modifying /etc/resolv.conf directly.

Changes Made

  • Added get_primary_service() helper to automatically detect the current active network interface/service (e.g. Wi-Fi, Ethernet).
  • Rewrote adddns() to append DNS servers via sudo networksetup -setdnsservers.
  • Added removedns() (--remove / remove) to remove specific DNS server IPs from network services.
  • Added cleardns() (--clear / clear) to reset DNS servers to DHCP defaults (empty).
  • Updated listdns() to display both configured network service DNS and system resolver addresses.
  • Updated --help and added tests/test_dns.sh unit tests.

Verification

  • Verified ./plugins/dns --help and ./plugins/dns --list.
  • Tested network service detection and syntax.

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.

We can add more features to DNS plugin

1 participant