From f2af2d327fbd74914cf862c9ad053db8fff3dbd6 Mon Sep 17 00:00:00 2001 From: TheK4n Date: Mon, 6 Jun 2022 17:28:00 +0300 Subject: [PATCH] add func toggle-proxy --- sub/bash/functions | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sub/bash/functions b/sub/bash/functions index 1a52f9b..1881d92 100644 --- a/sub/bash/functions +++ b/sub/bash/functions @@ -175,6 +175,17 @@ vpn() { ) } +# setup ssh tunnel to $1 as proxy +toggle-proxy() { + if [ -z "$http_proxy" ]; then + export {http,https,ftp,rsync}_proxy="socks5://127.0.0.1:8888" + export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com" + ssh -vCTN -D 0.0.0.0:8888 "$1" 1>/dev/null 2>&1 & + else + unset {http,https,ftp,rsync,no} + fi +} + open() { test -e $1 || return 1 nohup xdg-open $1 1>/dev/null 2>&1 &