Skip to content

HuaDeity/zsh-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zsh-proxy

A lightweight, cross-platform helper that automates and simplifies proxy configuration from your zsh session.

macOS • Linux • WSL • Any system with zsh & Git •

Features

  • Auto-detect system proxies on macOS (falls back gracefully on other OSes)
  • One zstyle per proxy kind — provide full URIs, no more server/port pairs
  • Mirrors lowercase ↔ uppercase env vars (http_proxyHTTP_PROXY, etc.)
  • Toggle setters — call set_http_proxy <uri> to set, call with no arg to unset
  • Git integration (http.proxy, https.proxy) follows the same precedence

Requirements

  • zsh 5.0 or later
  • git if you want Git proxy auto-config
  • On macOS: network proxies should be configured in System Settings → Network (the plugin reads them via native commands)

Note: No external dependencies or Python/Ruby helpers — pure zsh.


Installation

Manual

git clone https://github.com/huadeity/zsh-proxy.git ${ZDOTDIR}/plugins/zsh-proxy
echo 'source ${ZDOTDIR}/plugins/zsh-proxy/zsh-proxy.zsh'

antidote install huadeity/zsh-proxy

zmodule huadeity/zsh-proxy

zcomet load huadeity/zsh-proxy

zgenom load huadeity/zsh-proxy

# Inside custom plugins dir
git clone https://github.com/huadeity/zsh-proxy.git \
      ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-proxy

# ~/.zshrc
plugins=( ... zsh-proxy )

Quick start

proxy     # auto-configure from zstyle → OS
noproxy   # clear everything (env + Git)
proxys    # Show all proxy settings

Manual setters (toggle)

Function Action
set_proxy PLUGIN TYPE PROXY Set proxy for specifig app with specifig protocal type
unset_proxy PLUGIN TYPE Unset proxy for specifig app with specifig protocal type

Sample zstyle config

# ~/.zshrc or ~/.zshenv
zstyle ':plugin:proxy'        http    '192.168.1.2:7890'
zstyle ':plugin:proxy'        https   '192.168.1.2:7890'
zstyle ':plugin:proxy'        socks   '127.0.0.1:8888'
zstyle ':plugin:proxy'        mixed   '127.0.0.1:8888'
zstyle ':plugin:proxy'        no      'localhost,127.0.0.1,.internal'

zstyle ':plugin:proxy'        type    http https all no # default
zstyle ':plugin:proxy'        plugins shells            # default

# Run automatically on shell startup
zstyle ':plugin:proxy'        auto         yes          # default: no

Call proxy manually at any time to reload settings.


How it works

  1. zstyle lookup—User-defined URIs for each proxy kind have highest priority.
  2. macOS system proxy—When on macOS & helper functions available, the plugin queries the active network service for web, secureweb, and socksfirewall proxies.
  3. Fallback: If nothing is found, environment variables are unset.
  4. Git: git config --global http(s).proxy is kept in sync with the chosen URIs (or removed when proxies are unset).

Everything is handled in pure zsh — no forks unless Git commands are needed.


Recent Updates

  • Update to New Level (2025-05-03): Enhanced functionality and performance improvements as per the latest commit. Check the plugins directory for updated or new proxy management features.

Contributing

Pull requests are welcome! Feel free to improve Linux/WSL auto-detection, add tests for other shells, or polish the README.


License

MIT

About

A lightweight, cross‑platform helper that automates and simplifies proxy configuration from your zsh session.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages