# jinwyp/one_click_script architecture

> Architecture diagram of the GitHub repository jinwyp/one_click_script, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jinwyp/one_click_script
- Repository: https://github.com/jinwyp/one_click_script

## Overview

##### Main Components of the System
- User Interface & Command Input: The scripts are invoked from the command line, with the README describing several “choose X to do Y” sequential menus. Represent this as the entry point where the user triggers the installation process.
- Kernel Management Module: This group includes the main install script (install_kernel.sh), kernel-specific scripts, and related documentation (KERNEL.md, KERNEL_CN.md). It handles the download and installation of various kernel versions as well as enabling BBR/BBR Plus.
- Network Optimization Module: This covers the scripts for installing and configuring Wireguard, Cloudflare WARP, and related proxy/VPN settings. It is also responsible for unlocking geo-restricted content.
- V2Ray, Trojan, and Related Installers: The repository contains several scripts and files (README2.md, README2_CN.md, trojan_v2ray_install.sh, and assets in the download folder) designed to install and configure applications like xray/v2ray and trojan.
- Netflix Check Module: A dedicated “netflix_check.sh” script is provided to test if the unlocking mechanisms (via IPv6 or WARP sock5) are working correctly.
- Supporting Utilities and Documentation: This comprises auxiliary scripts (acuteangle folder scripts, bench.sh, linux_install_software.sh, etc.), configuration files (.editorconfig, .gitignore), and additional documentation in both English and Chinese.

##### Relationships and Interactions
- The User invokes a primary script (e.g., install_kernel.sh, netflix_check.sh) from the terminal.
- The Kernel Management Module first validates the current operating system state, offers choices for installing a new kernel, and subsequently reboots the system (twice per instructions).
- If the user wishes to test connectivity (e.g., to Netflix), the system directs control to the “Netflix Check Module”, which internally may depend on already-installed network enhancements.
- The supporting utilities intersect with multiple modules (for logging, automation, or additional diagnostic purposes).

##### Architectural Patterns and Design Principles
- Modular and Script-Oriented: Each function (kernel installation, network configuration, test checking) is encapsulated in its own script file. Represent each as a separate module.
- Sequential Orchestration: The scripts follow a linear workflow (where a selection from the menu directs which script is executed) with clear dependencies such as “reboot after kernel installation.”
- External Dependency Management: The project manages external packages (such as prebuilt binary distributions or ipk packages for mosdns, etc.) that must be downloaded and used during execution. Represent these as outside “assets” that are integrated during runtime.
- Language Variants and Localization: There are files in both English and Chinese. You might note this as a design characteristic (supporting multi-language documentation and usage).

##### Relevant Technologies/Frameworks
- Shell Scripting (Bash): The whole project is implemented as a collection of bash scripts.
- Linux Kernel & Networking Tools: The project interacts directly with system kernels, network congestion controls (BBR, FQ, CAKE, etc.), and VPN/proxy configurations (Wireguard, Cloudflare WARP, V2Ray, Trojan).
- Package Management: There are installation packages provided for different systems (DEB, IPK for OpenWRT/Debian/Ubuntu, etc.).

##### Elements
- Clear Labels: Each component should be labeled clearly (e.g., “Kernel Installation Module”, “BBR/BBR Plus Enabler”, “Network Proxy Installer”, “Netflix Checker”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    U["User Command Entry"]:::user

    %% Kernel Management Module
    subgraph "Kernel Management Module"
        km_sh["install_kernel.sh"]:::kernel
        km_doc1["KERNEL.md"]:::kernel
        km_doc2["KERNEL_CN.md"]:::kernel
    end

    KR["System Reboot (After Kernel Update)"]:::kernel

    %% Network Optimization Module
    subgraph "Network Optimization Module"
        nm_sh["trojan_v2ray_install.sh"]:::network
        nm_doc1["README2.md"]:::network
        nm_doc2["README2_CN.md"]:::network
    end

    d_download["Download Assets/Third-party Packages"]:::external

    %% Netflix Check Module
    subgraph "Netflix Check Module"
        nf_sh["netflix_check.sh"]:::netflix
    end

    %% Supporting Utilities & Documentation
    subgraph "Supporting Utilities & Documentation"
        su_dir["acuteangle folder"]:::support
        su_bench["bench.sh"]:::support
        su_linux["linux_install_software.sh"]:::support
        su_dsm["dsm folder"]:::support
        su_docs[".editorconfig, .gitignore, DNS.md, HOWTOUSEGO.md, TOOL.md, TOOL_CN.md"]:::support
    end

    %% Flow Connections
    U -->|"trigger"| km_sh
    km_sh -->|"documents"| km_doc1
    km_sh --> km_doc2
    km_sh -->|"proceeds to"| KR
    KR -->|"after reboot"| nm_sh
    nm_sh -->|"reference"| nm_doc1
    nm_sh --> nm_doc2
    nm_sh -->|"requires"| d_download
    U -->|"select test"| nf_sh

    %% Supporting Utilities dotted connections
    su_docs -.-> km_sh
    su_docs -.-> nm_sh
    su_docs -.-> nf_sh

    %% Click Events for Kernel Management Module
    click km_sh "https://github.com/jinwyp/one_click_script/blob/master/install_kernel.sh"
    click km_doc1 "https://github.com/jinwyp/one_click_script/blob/master/KERNEL.md"
    click km_doc2 "https://github.com/jinwyp/one_click_script/blob/master/KERNEL_CN.md"

    %% Click Events for Network Optimization Module
    click nm_sh "https://github.com/jinwyp/one_click_script/blob/master/trojan_v2ray_install.sh"
    click nm_doc1 "https://github.com/jinwyp/one_click_script/blob/master/README2.md"
    click nm_doc2 "https://github.com/jinwyp/one_click_script/blob/master/README2_CN.md"

    %% Click Event for Netflix Check Module
    click nf_sh "https://github.com/jinwyp/one_click_script/blob/master/netflix_check.sh"

    %% Click Events for Supporting Utilities & Documentation
    click su_dir "https://github.com/jinwyp/one_click_script/tree/master/acuteangle"
    click su_bench "https://github.com/jinwyp/one_click_script/blob/master/bench.sh"
    click su_linux "https://github.com/jinwyp/one_click_script/blob/master/linux_install_software.sh"
    click su_dsm "https://github.com/jinwyp/one_click_script/tree/master/dsm"
    click su_docs "https://github.com/jinwyp/one_click_script/blob/master/.editorconfig, .gitignore, DNS.md, HOWTOUSEGO.md, TOOL.md, TOOL_CN.md"

    %% Click Event for Download Assets
    click d_download "https://github.com/jinwyp/one_click_script/tree/master/download"

    %% Styles
    classDef user fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef kernel fill:#FFA500,stroke:#000,stroke-width:2px;
    classDef network fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef netflix fill:#FFFF99,stroke:#000,stroke-width:2px;
    classDef support fill:#DDA0DD,stroke:#000,stroke-width:2px;
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:2px;
```
