mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-19 20:29:45 +01:00
fix(shell-proxy): make ssh-proxy compatible with macOS (#10640)
This commit is contained in:
parent
846f417eb8
commit
9fa3f46122
2 changed files with 16 additions and 10 deletions
3
plugins/shell-proxy/.editorconfig
Normal file
3
plugins/shell-proxy/.editorconfig
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[*.py]
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
|
@ -20,14 +20,17 @@ proxy_protocols = {
|
||||||
if parsed.scheme not in proxy_protocols:
|
if parsed.scheme not in proxy_protocols:
|
||||||
raise TypeError('unsupported proxy protocol: "{}"'.format(parsed.scheme))
|
raise TypeError('unsupported proxy protocol: "{}"'.format(parsed.scheme))
|
||||||
|
|
||||||
argv = [
|
def make_argv():
|
||||||
"nc",
|
yield "nc"
|
||||||
"-X",
|
if sys.platform == 'linux':
|
||||||
proxy_protocols[parsed.scheme], # Supported protocols are 4 (SOCKS v4), 5 (SOCKS v5) and connect (HTTP proxy). Default SOCKS v5 is used.
|
# caveats: macOS built-in netcat command not supported proxy-type
|
||||||
"-x",
|
yield "-X" # --proxy-type
|
||||||
parsed.netloc, # proxy-host:proxy-port
|
# Supported protocols are 4 (SOCKS v4), 5 (SOCKS v5) and connect (HTTP proxy).
|
||||||
sys.argv[1], # host
|
# Default SOCKS v5 is used.
|
||||||
sys.argv[2], # port
|
yield proxy_protocols[parsed.scheme]
|
||||||
]
|
yield "-x" # --proxy
|
||||||
|
yield parsed.netloc # proxy-host:proxy-port
|
||||||
|
yield sys.argv[1] # host
|
||||||
|
yield sys.argv[2] # port
|
||||||
|
|
||||||
subprocess.call(argv)
|
subprocess.call(make_argv())
|
||||||
|
|
Loading…
Reference in a new issue