8000 GitHub - zetxtech/wssocks: A SOCKS proxy implementation over WebSocket protocol.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A SOCKS proxy implementation over WebSocket protocol.

License

Notifications You must be signed in to change notification settings

zetxtech/wssocks

Repository files navigation

GitHub Actions Workflow Status Codecov Docker Pulls

WSSocks

WSSocks is a SOCKS proxy implementation over WebSocket protocol.

中文文档 / Chinese README

Overview

This tool allows you 8000 to securely expose SOCKS proxy services under Web Application Firewall (WAF) protection (forward socks), or enable clients to connect and serve as SOCKS proxy servers when they don't have public network access (reverse socks).

Main Diagram

For python version, please check zetxtech/pywssocks. But note that the Python version typically has lower performance compared to this implementation.

Features

  1. Supporting command-line usage, API server, and library integration.
  2. Forward, reverse and agent proxy modes.
  3. Round-robin load balancing for reverse proxy.
  4. SOCKS proxy authentication support.
  5. IPv6 over SOCKS5 support.
  6. UDP over SOCKS5 support.

Potential Applications

  1. Distributed HTTP backend.
  2. Bypassing CAPTCHA using client-side proxies.
  3. Secure intranet penetration, using CDN network.

Usage

As a tool

Forward Proxy:

# Server (WebSockets at port 8765, as network provider)
wssocks server -t example_token

# Client (SOCKS5 at port 1080)
wssocks client -t example_token -u http://localhost:8765 -p 1080

Reverse Proxy (with -r flag):

# Server (WebSockets at port 8765, SOCKS at port 1080)
wssocks server -t example_token -p 1080 -r

# Client (as network provider)
wssocks client -t example_token -u http://localhost:8765 -r

Agent Proxy (with -c flag for connectors' token):

# Server (WebSockets at port 8765, SOCKS at port 1080)
wssocks server -t example_token -c example_connector_token -p 1080 -r

# Client (as network provider)
wssocks provider -t example_token -u http://localhost:8765

# Connector (SOCKS5 at port 1180)
wssocks connector -t example_connector_token -u http://localhost:8765 -p 1180

You can also use our public demo server:

# Client (as network provider)
wssocks provider -t any_token -u https://wssocks.zetx.tech -c any_connector_token

# Connector (SOCKS5 at port 1180)
wssocks connector -t any_connector_token -u https://wssocks.zetx.tech -p 1180

Autonomy Agent Proxy (with -a flag):

# Server (WebSocket at port 8765, autonomy mode)
wssocks server -r -t example_token -a

# Client (as network provider, set connector token when start)
wssocks provider -t example_token -c example_connector_token

In autonomy mode:

  1. The server's SOCKS proxy will not start listening.
  2. Reverse clients can specify their own connector tokens.
  3. Load balancing is disabled - each connector's requests will only be routed to its corresponding reverse client.

Installation

WSSocks can be installed by:

go install github.com/zetxtech/wssocks/cmd/wssocks@latest

You can also download pre-built binaries for your architecture from the releases page.

WSSocks is also available via Docker:

docker run --rm -it jackzzs/wssocks --help

Cloudflare Worker

WSSocks server can be hosted on Cloudflare Worker, see: zetxtech/wssocks.js

Deploy to Cloudflare

The wssocks.js version is a lite version and does not contain API functionality.

API Server

WSSocks server provides an HTTP API when enabled with the --api-key flag:

# Start server with API enabled
wssocks server --api-key your_api_key

API Endpoints

All API requests require the X-API-Key header with your configured API key.

Get Server Status

GET /api/status

Returns server version and a list of all tokens with their types and active client counts.

Add Forward Token

POST /api/token
Content-Type: application/json

{
    "type": "forward",
    "token": "new_token"  // Optional: auto-generated if not provided
}

Adds a new forward proxy token.

Add Reverse Token

POST /api/token
Content-Type: application/json

{
    "type": "reverse",
    "token": "new_token",  // Optional: auto-generated if not provided
    "port": 1080,          // Optional: auto-allocated if not provided
    "username": "user",    // Optional: SOCKS authentication
    "password": "pass"     // Optional: SOCKS authentication
}

Adds a new reverse proxy token with specified SOCKS settings.

Remove Token

DELETE /api/token/{token}

Or

DELETE /api/token

Content-Type: application/json

{
    "token": "token_to_delete"
}

Removes the specified token.

License

WSSocks is open source under the MIT license.

About

A SOCKS proxy implementation over WebSocket protocol.

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0