Skip to content

Instantly share code, notes, and snippets.

@farhad-4
Created October 8, 2022 22:36
Show Gist options
  • Select an option

  • Save farhad-4/93ff479ddeeb4ece33fe215cc44fa67e to your computer and use it in GitHub Desktop.

Select an option

Save farhad-4/93ff479ddeeb4ece33fe215cc44fa67e to your computer and use it in GitHub Desktop.
wssocks installation

Prerequisites

  • Docker
  • Set an A DNS record which points to your server's IP address, we recomment using your country domain (e.g., ir): e.g., ws.mydomain.ir Please note that you should enable proxy feature on the dns record (e.g., the cloud icon on the DNS record in the cloudlfare dashboard)

wssocks Server Installation

  • Run wssocks (replace myRandSecureKey with a random value to use as authentication key on the client):
docker run -d --restart=always --name=wssocks-server -p 80:80 farhad4/wssocks:0.5.0 server --addr=:80 --auth --auth_key=myRandSecureKey

# or create and then start it:
docker container create --restart=always --name=wssocks-server -p 80:80 farhad4/wssocks:0.5.0 server --addr=:80 --auth --auth_key=myRandSecureKey
docker container start wssocks-server # to stop it, run: docker container stop wssocks-server

Using wssocks client on your device

  • run the wssocks client (replace myRandSecureKey and ws.mydomain.ir with proper values):
docker run -d --restart=always --name=wssocks -p 1090:1090 farhad4/wssocks:0.5.0 client --addr=:1090 --key=myRandSecureKey --remote=wss://ws.mydomain.ir:443


# Or create and then start/stop it:
docker container create --restart=always --name=wssocks -p 1090:1090 farhad4/wssocks:0.5.0 client --addr=:1090 --key=myRandSecureKey --remote=wss://ws.mydomain.ir:443
docker container start wssocks # to stop it, run: docker container stop wssocks
  • Now you can use 127.0.0.1:1090 as SOCKS proxy on your system (e.g., set it throgh proxy settings on your OS).

Notes:

  • If you wnated to pull docker images from a blocked region (e.g., Iran), use container registry mirrors. Tutorial.

  • You may want to mitigate port blocking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment