shadowsocks / shadowsocks/shadowsocks-org

HttpProxy proposal

Open
#24 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
1k
Forks
694
PR merge metrics
No merged PRs in 30d

Description

I propose deploy and run HttpProxy (for example privoxy) at server side (at same host ss-server is running). This allows centralized ad-blocking and routing rules (for example redirect *.i2p to i2p-router and *.onion to tor).
In this deployment scenario shadowsocks can be used as socks4/5 server itself and as encrypted tunnel to http-proxy.

Every time shadowsocks-client (ss-local) accept connection from proxy-client (browser) it can distinguish protocol based on first byte.
If byte==5 serve as socks5. if byte==4 serve as socks4, otherwise tunnel data (just using it's own socks capabilities) to server-side 127.0.0.1:8118 (can be taken from configuration)

This proposal require such CLIENT software changes: to add additional logic when handling BROWSER-to-SHADOWSOCKSCLIENT iteraction:

  • add optional client configuration parameter: remoteHttpProxyPort
  • analyze first bytes from browser-to-ssclient handshake
  • if first byte==5 proceed as Socks5 server (as is) (SS-CLIENT acts as Socks5 server for browser) [browser]<--socks5-protocol-->[ss-local]<--ss-protocol-->[ss-server]<--tcp-->[remote-host]
  • (optional for old browsers) if first byte==4 proceed as Socks4a server (SS-CLIENT acts as Socks4a server for browser) [browser]<--socks4a-protocol-->[ss-local]<--ss-protocol-->[ss-server]<--tcp-->[remote-host]
  • otherwise establish tunnel [browser]<-->[ssclient]<-->[ssserver]<-->[127.0.0.1:remoteHttpProxyPort] (SS-CLIENT acts as ssh -L so browser interacts with HTTP proxy via encrypted SS tunnel) so full chain is [browser]<--http-proxy-protocol-->[ss-local]<--ss-protocol-->[ss-server]<--http-proxy-protocol-tunneled-from-browser-->[127.0.0.1:remoteHttpProxyPort]<--http-protocol-->[remote-host]

Yet again - those 3 modes can be autoselected by SS-CLIENT based onto first n bytes from browser. This (automatic protocol negotiation) require changes in SS-CLIENT

This proposal doesn't require SERVER software changes, just install any preferred HTTP proxy onto same host and make it listen onto 127.0.0.1:remoteHttpProxyPort address

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the ss-local connection-handling entry point and its client configuration, since the proposal names remoteHttpProxyPort and first-byte protocol detection. Trace how SOCKS4, SOCKS5, and tunneled HTTP-proxy connections are currently handled. Done means the three modes can be selected as described without server-side software changes.

Written by the indexing model from the issue text.

Assessment

Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.