How lthero-big/smartdns_sniproxy_installer works
1. The “被解锁机” (the machine that “cannot unlock” content) which uses smartdns to manage DNS resolution and apply rules for media streaming services.
2. The “解锁机” (the machine that “can unlock” content) where sniproxy is installed to work as a transparent reverse proxy for streaming platforms.
Main Components
• Installer Script: At the core is the “smtdns_install.sh” script that acts as the interactive one-click configuration tool.
• Configuration File: “StreamConfig.yaml” which may be used to store or manage configuration options.
• README/Documentation: Although not an active component, the README outlines how commands map to functionalities.
• SmartDNS Service: Installed and configured on the “被解锁机”; its components include:
• Upstream DNS configuration (with either direct IP addresses or nameserver choices).
• DNS domains assigned for different streaming platforms and the grouping mechanism.
• Sniproxy Service: Installed on the “解锁机” and configured through options (e.g., starting, stopping services, adding proxy rules).
• User Input/CLI Menu: This offers a simple text-based UI for selecting different functions like installing smartdns, adding streaming platforms, configuring firewall rules, etc.
• External DNS Unlock Services: For example, the free Alice DNS unlocking service, which may be referenced if users do not operate their own unlocking VPS.
Relationships and Interactions
• The installer script (smtdns_install.sh) is the entry point; it takes user input and then configures the SmartDNS and/or sniproxy services.
• For the “被解锁机”: The script will install SmartDNS, configure upstream DNS, and establish domain-to-DNS mappings.
• For the “解锁机”: The script installs and configures sniproxy, linking it to the proper network interfaces and opening necessary ports (80/443/53) for secure reverse proxying.
• There's a clear connection between user selection in the CLI and changes applied to SmartDNS/sniproxy configurations. Additionally, there is a flow between smartdns acting on DNS resolution and sniproxy handling reverse proxy requests.
• Including external unlocking services (Alice) as part of the flow where if a user chooses nameserver over address, then lookup redirection is performed.
Architectural Patterns and Design Principles
• Separation of Concerns: Differentiating configuration and management tasks for smartdns (DNS manipulation) versus sniproxy (streaming proxy).
• Modular Design: Each function in the menu (installation, reconfiguration, DNS grouping, proxy configuration, firewall setup) is modular and follows a clear branch in the overall flow.
• Interactive CLI-driven orchestration: The installer script drives service installation and configuration based on input choices.
• Scalability in configuration: The possibility of running smartdns on “解锁机” for a nested unlocking configuration showcases flexibility in design.
Relevant Technologies and Frameworks
• Shell Scripting (Bash), which is used for the installer.
• SmartDNS and sniproxy as the primary services.
• Typical Linux firewall and service management utilities (such as ufw and systemctl) for controlling service status and port access.
• YAML for configuration representation (StreamConfig.yaml).
Elements
• Labels: Ensure every component is clearly labeled with its role (e.g., “Installer Script”, “SmartDNS Service (被解锁机)”, “sniproxy Service (解锁机)”).