Skip to content

Instantly share code, notes, and snippets.

@scalaview
Last active July 8, 2021 12:41
Show Gist options
  • Save scalaview/4417d7be2d248078522b21ff6f6890d2 to your computer and use it in GitHub Desktop.
Save scalaview/4417d7be2d248078522b21ff6f6890d2 to your computer and use it in GitHub Desktop.
Convert Shadowsocks into an HTTP proxy
First run polipo with parent proxy set to Shadowsocks:
apt-get install polipo
service polipo stop
polipo socksParentProxy=localhost:1080
Then you can play with the HTTP proxy:
http_proxy=http://localhost:8123 apt-get update
http_proxy=http://localhost:8123 curl www.google.com
http_proxy=http://localhost:8123 wget www.google.com
git config --global http.proxy 127.0.0.1:8123
git clone https://github.com/xxx/xxx.git
git xxx
git xxx
git config --global --unset-all http.proxy
```python
import socks
import socket
socks.set_default_proxy(socks.SOCKS5, "localhost", 1086)
socket.socket = socks.socksocket
```
Write proxy settings
$ npm config set proxy http://localhost:3128
$ npm config set https-proxy http://localhost:3128
This config is great for SquidMan app.
Delete proxy settings
$ npm config delete http-proxy
$ npm config delete https-proxy
alias lpiv="ssh -i $HOME/.ssh/developer.pem ubuntu@xx.xx.xx.xx -o 'ProxyCommand=nc -X connect -x 127.0.0.1:8123 %h %p' -t 'cd /var/www/livingsmartapi/current; bash -l'"
[Unit]
Description=Shadowsocks iClient
After=network.target
[Service]
ExecStart=/usr/bin/ss-local -c /etc/shadowsocks-libev/config.json
ExecStartPost=/usr/bin/polipo socksParentProxy=localhost:1081
Restart=on-abort
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment