Skip to content

Command line tool for using clash service without sudo effortlessly.

License

Notifications You must be signed in to change notification settings

ddddavid-he/ladder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

ladder

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_EXEC where clash locates, by default clash

  • CLASH_UPDATE_AFTER_SEC interval time (measured in second) to update the subscription file, by default 1 day

  • CLASH_MIN_PORT and CLASH_MAX_PORT minimum and maximum ports available to clash, by default 30000 and 50000

Basic usage:

# 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

Parameters

  • ladder -h Help.

  • 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.

  • ladder Start the proxy and configure the system proxy environment variables in the background silently.

  • ladder -k Kill current ladder process and clean up proxy related environment variables.

  • ladder -u Update subscription file right away (download from subscription url).

  • ladder -p <PORT> Specifies proxy ports by HTTP_PROXY=:$PORT, HTTPS_PROXY=:$PORT, ALL_PROXY=:$((PORT+1)).

  • ladder -v Start 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 -c Clean up all proxy related environment variables (unset HTTP_PROXY, HTTPS_PROXY, ALL_PROXY).

  • ladder -d Display the current subscription URL.

About

Command line tool for using clash service without sudo effortlessly.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages