Command line tool for using clash service without sudo.
ladder is a script based on Clash that enables proxy functionality within a session, and it automatically stops when the session is closed.
Note 0: For the reason that the ladder.sh script uses export, users should do source ladder.sh for using it.
Note 1: Due to the design of the Linux system, the automatically configured proxy is only effective within the current session (SSH connection, terminal window, desktop environment). If other windows need to use the proxy opened by another window, please refer to the Linux proxy configuration and configure it according to the output of the ladder command.
Note 2: The proxy opened by the ladder command will automatically exit when the session is closed (window closed, connection disconnected, exit command).
Note 3: Environment Variables:
-
CLASH_EXECwhere clash locates, by defaultclash -
CLASH_UPDATE_AFTER_SECinterval time (measured in second) to update the subscription file, by default 1 day -
CLASH_MIN_PORTandCLASH_MAX_PORTminimum and maximum ports available to clash, by default 30000 and 50000
# put this in .bashrc or .zshrc
alias ladder="source /path/to/ladder.sh"
# set subscription url, run once
ladder -s https://example.com/subscription_url_of_your_vpn
# start service
ladder
# stop service manually
# (proceed automatically when session ended)
ladder -k-
ladder -hHelp. -
ladder -s <subscription_url>Set the subscription URL for Clash in the script. This only needs to be run once, unless you need to change the subscription URL. -
ladderStart the proxy and configure the system proxy environment variables in the background silently. -
ladder -kKill current ladder process and clean up proxy related environment variables. -
ladder -uUpdate subscription file right away (download from subscription url). -
ladder -p <PORT>Specifies proxy ports byHTTP_PROXY=:$PORT,HTTPS_PROXY=:$PORT,ALL_PROXY=:$((PORT+1)). -
ladder -vStart the background proxy and set environment variables and display verbose proxy-related output. It will display the information of nodes you connected to before each connection using the proxy is established. The output content will be appended to the current content (stdout) but will not affect shell operations. -
ladder -cClean up all proxy related environment variables (unsetHTTP_PROXY,HTTPS_PROXY,ALL_PROXY). -
ladder -dDisplay the current subscription URL.