Skip to content

Latest commit

 

History

History
207 lines (129 loc) · 7.98 KB

README_en.md

File metadata and controls

207 lines (129 loc) · 7.98 KB

Project Introduction

This project utilizes the open-source tool Clash (discontinued) as its core program, combined with custom scripts to implement a simple proxy solution.
Backup repository for Clash: Clash-backup

The primary purpose of this project is to address the slow download speeds for GitHub and other overseas resources on servers.


Disclaimer

  1. This project is licensed under the GNU General Public License (GPL) v3.0. Please review the LICENSE file in this repository for details.

  2. The original authors of this project retain all intellectual property rights. Users must comply with the requirements of the GPL v3.0 and bear all risks associated with using this project.

  3. This project is provided "as is" without any explicit or implicit guarantees. To the fullest extent permitted by law, the original authors are not liable for any direct, indirect, special, incidental, or consequential damages.

  4. This project and its repository are entirely unrelated to the creator and maintainer. It is solely a backup repository, and any disputes, conflicts, or losses arising from using this project are entirely unrelated to the author or maintainer.

  5. Users must adhere to the laws and regulations of their own country and resolve any legal or regulatory issues arising from the use of this project on their own.


Additional Notes

Since the original author has discontinued this project, this repository serves as a backup only. If any of its content infringes on your rights, please submit an issue, and I will address it promptly.

(Note dated 2024/06/07): Due to limited time, I may not respond to all issues. My apologies! Contributions to maintain and resolve repository issues are welcome.

This is a backup of Clash for Linux (Backup ID: 202311091510).
If you enjoy this project, please give it a star!


Usage Notes

  • It is recommended to run this project as the root user or with sudo privileges.
  • If issues arise during usage, please first consult the existing Issues.
  • When submitting an issue, ensure that sensitive information (e.g., subscription URLs) is removed or replaced.
  • This project integrates configurations from Clash (discontinued) and YACD. For detailed configurations, please refer to the original projects.
  • This project does not provide any subscription information. You must prepare your own Clash subscription URL.
  • Before running, manually modify the CLASH_URL variable in the .env file, or the program will not work correctly.
  • Tested on RHEL series, Debian, Kali Linux, Ubuntu, and other Linux systems. Other distributions may require minor script modifications.
  • Supports x86_64 and aarch64 platforms.
  • Note: For some Linux desktop systems, you may need to set the proxy in your browser for proper usage.
  • If the system proxy doesn't work, but you need it, try modifying the port in start.sh and reloading the environment variables.
  • If issues persist, consider changing your network environment (this may also be a factor).
  • On some Linux systems, sites like Google, Twitter, or YouTube may not respond to ping requests—this is normal.

Tip: If you encounter issues you cannot resolve independently, please prioritize checking the Issues section. Due to limited availability, repeated questions regarding resolved or documented issues may not receive responses.


Usage Guide

Download the Project

Clone the project repository:

$ git clone https://github.com/Elegycloud/clash-for-linux-backup.git

Navigate to the project directory and edit the .env file to modify the CLASH_URL variable.

$ cd clash-for-linux
$ vim .env

Note: The CLASH_SECRET variable in the .env file is used for the custom Clash secret. If left empty, a random string will be automatically generated by the script.


Start the Program

Run the start.sh script:

  • Navigate to the project directory:
$ cd clash-for-linux
  • Run the startup script:
$ sudo bash start.sh

Checking subscription URL...
Clash subscription URL is accessible!                     [  OK  ]

Downloading Clash configuration file...
Config file `config.yaml` downloaded successfully!         [  OK  ]

Starting Clash service...
Service started successfully!                              [  OK  ]

Clash Dashboard URL: http://<ip>:9090/ui
Secret: xxxxxxxxxxxxxxx

Execute the following command to load environment variables: source /etc/profile.d/clash.sh

Enable the system proxy using: proxy_on

To temporarily disable the system proxy, use: proxy_off
$ source /etc/profile.d/clash.sh
$ proxy_on
  • Check service ports:
$ netstat -tln | grep -E '9090|789.'
tcp        0      0 127.0.0.1:9090          0.0.0.0:*               LISTEN     
tcp6       0      0 :::7890                 :::*                    LISTEN     
tcp6       0      0 :::7891                 :::*                    LISTEN     
tcp6       0      0 :::7892                 :::*                    LISTEN
  • Check environment variables:
$ env | grep -E 'http_proxy|https_proxy'
http_proxy=http://127.0.0.1:7890
https_proxy=http://127.0.0.1:7890

If the above steps are successful, the Clash program is running, and you can now experience faster downloads for GitHub resources.


Restart the Program

To modify Clash configurations, edit the conf/config.yaml file. Then restart the program using the restart.sh script.

Note:
The restart.sh script does not update subscription information.


Stop the Program

  • Navigate to the project directory:
$ cd clash-for-linux
  • Stop the service:
$ sudo bash shutdown.sh

Stop the system proxy:

$ proxy_off

Verify that the program's ports, processes, and environment variables (http_proxy|https_proxy) are no longer active. If none are active, the service has successfully stopped.


Clash Dashboard

  • Access the Clash Dashboard:

Use a browser to visit the URL provided in the start.sh output, e.g., http://192.168.0.1:9090/ui.

  • Log in to the management interface:

Enter http://<ip>:9090 in the API Base URL field and the secret provided in the start.sh output in the Secret (optional) field.

Click "Add" and select the newly added management interface to configure Clash via the browser.

  • Additional Tutorials:

This Clash Dashboard uses the YACD project. For more detailed usage instructions, refer to the YACD repository.


Terminal-Based Proxy Node Selection

For users unable to use the browser-based Clash Dashboard to select proxy nodes or modify proxy modes, a simple script is provided to configure these settings via the Linux terminal.

The script is located at: scripts/clash_proxy-selector.sh

Note:
Before using the script, ensure that the Secret variable in the script matches the secret provided during the start.sh execution or the CLASH_SECRET value defined in the .env file.


FAQs

  1. Issue with /bin/sh being replaced by dash on some Linux systems:
    If errors occur while running scripts (e.g., -en [ OK ]), use bash xxx.sh to run the scripts.

  2. Proxy nodes not appearing in the UI:
    This may occur if the Clash configuration file provided by your subscription is base64-encoded or does not conform to Clash standards. The project includes automatic recognition and conversion of such configurations. If the issue persists, consider converting the subscription URL using self-hosted or third-party tools (not recommended due to potential privacy risks).

  3. Error unsupported rule type RULE-SET in logs:
    Refer to the official Clash FAQ for resolution.