How sergeydigl3/zapret-discord-youtube-linux works
Project type and purpose
• This is a CLI/DevOps “adapter” project: a set of Bash scripts and a small helper binary (nfqws) that automates installing, configuring, and running a specific network-firewall strategy for bypassing YouTube throttling on Linux via nftables.
• It bundles a hard-coded Flowseal configuration (pulled from a specific commit), lets the user choose among .bat strategy files, applies them via nftables + the nfqws process, and can register itself as a systemd service for automatic startup.
File structure
• Top-level scripts:
• main_script.sh (installer/interactive runner)
• rename_bat.sh (helper to normalize strategy filenames)
• service.sh (creates/updates a systemd unit)
• stop_and_clean_nft.sh (teardown helper)
• nfqws/ directory (compiled binary and support files)
• Config file: a generated conf.env defining strategy, auto_update, and interface.
• No frontend/backend split—this is a single “automation service” component.
• Deployment: systemd unit, leveraging standard Linux filesystem and nftables, plus optional auto-update logic.
README for additional insights
• Describes interactive vs. non-interactive mode, configuration persistence in conf.env, service installation, and cleanup behavior.
• Emphasizes reliance on nftables and systemd.
• Notes external dependency: the Flowseal GitHub repo for .bat strategies.
a. Main components
• User CLI (invokes main_script.sh or service.sh)
• Script layer (Bash scripts)
• Configuration store (conf.env)
• Strategy files (*.bat) fetched/renamed by rename_bat.sh
• Binary process (nfqws)
• Systemd (unit file zapret_discord_youtube.service)
• nftables (kernel firewall subsystem)
• Network interface (e.g., enp0s3)
• External GitHub repo (Flowseal strategies)
b. Relationships and interactions
1. User → CLI
• main_script.sh reads user input or conf.env.
2. CLI → rename-bat sub-script
• Normalizes .bat strategy filenames.
3. CLI → strategy fetch
• Optionally clones/updates zapret-latest from Flowseal.
4. CLI → nftables rules
• Applies or flushes rules via nft commands.
5. CLI → nfqws process
• Launches nfqws, passing the chosen strategy.
6. service.sh → systemd
• Generates a .service file referencing main_script.sh -nointeractive.
7. systemd → script at boot
• Ensures nfqws is running and nftables rules applied.
8. stop-and-clean → teardown
• Removes rules and stops background processes.
c. Architectural patterns / principles
• Separation of concerns:
• Interactive installer vs. non-interactive service mode
• Dedicated helper scripts for renaming and cleanup
• Centralized configuration (conf.env)
• Declarative service definition via systemd
• Idempotent firewall management (flush vs. apply)
d. Key technologies/frameworks
• Bash scripting
• systemd service management
• nftables (via nft CLI)
• nfqueue helper binary (nfqws)
• Git for fetching external configs
Elements
• CLI → rename script
• CLI → Git fetch
• CLI → nfqws
• CLI → nftables
• service.sh → systemd
• systemd → main_script.sh at boot