How seydef/dns_changer works
Main Components
• Script Entry Points: There are two scripts – one for Linux (dns.sh) and one for Windows (dns.ps1).
• Interactive UI: Both scripts provide an interactive menu for selecting a DNS server, so you want to capture that component.
• System Operations Layer: The part of the script that:
– Detects the active network connection.
– Displays the current DNS settings.
– Modifies the DNS for the selected connection.
– Restarts the network interface to apply new settings.
• Predefined DNS Server List: Represented in configurable arrays/hashtables in each script, which act as configuration data.
• Environment/Platform Dependencies:
– For Linux: Bash, nmcli (part of NetworkManager), and other OS-level network commands.
– For Windows: PowerShell commands and permissions (Administrator vs. non-admin).
Relationships and Data Flow
• Input Processing: The scripts read the selection, determine the corresponding DNS values from the DNS server list, and then update the network configuration.
• System Modification: The scripts then execute system commands to change the DNS settings and to trigger a restart of the network connection.
• Output Feedback: The changes are applied to the system, and the new settings become active.
Highlighting Architectural Patterns or Design Principles
• Separation of Concerns: Each script is self-contained, managing its user interface, configuration data, and system-level changes.
• Platform-Specific Implementation: Two parallel code paths exist in the repository, one tailored for Linux and one for Windows, with their own environment-specific commands and prerequisites.
• Modularity & Configurability: The scripts allow customization by simply modifying arrays or hashtables for DNS options, demonstrating an easily modifiable design.
Considering Technologies and Frameworks
• Linux: Bash scripting and NetworkManager's nmcli tool.
• Windows: PowerShell scripting and built-in network configuration commands.