Skip to content

FirmWisp/linksocks

 
 

Repository files navigation

GitHub Stars GitHub Actions Workflow Status Codecov Python Version PyPI - Version Go Version License

LinkSocks

LinkSocks is a SOCKS proxy implementation over WebSocket protocol.

中文文档 / Chinese README

Overview

LinkSocks is a secure SOCKS5 proxy over WebSocket. It allows you to traverse firewalls and complex network topologies by tunneling traffic through standard web connections.

Its architecture allows you to hide the proxy server behind a WAF or CDN (like Cloudflare). By disguising proxy traffic as normal HTTPS requests, it protects the server's real IP address and evades deep packet inspection.

Crucially, it supports Serverless Intranet Penetration (compatible with Cloudflare Workers). This allows you to bridge two private networks securely without a dedicated VPS. Since both the user and the internal resource actively connect to the serverless cloud relay, you can access your home or office network without a public IP or opening any risky inbound ports.

Main Diagram

📖 Documentation: https://linksocks.github.io

Features

  1. Forward, reverse and agent proxy modes.
  2. Round-robin load balancing for reverse proxy.
  3. SOCKS proxy authentication support.
  4. IPv6 & UDP over SOCKS5 support.
  5. Robust code driven by comprehensive tests.
  6. Command-line usage, API server, and library integration.
  7. Serverless relay server supported by Cloudflare Worker.

Potential Applications

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

As great examples, see these projects: LinkTerm and Cloudflyer.

Quick Start

Forward Proxy

# Server Side: Start server with WebSocket on port 8765
linksocks server -t example_token

# Client Side: Connect to server and provide SOCKS5 proxy on port 9870
linksocks client -t example_token -u ws://localhost:8765 -p 9870

# Test the proxy
curl --socks5 127.0.0.1:9870 http://httpbin.org/ip

Reverse Proxy

# Server Side: Start server with SOCKS5 proxy on port 9870
linksocks server -t example_token -r -p 9870

# Client Side: Connect as network provider
linksocks client -t example_token -u ws://localhost:8765 -r

# Test the proxy
curl --socks5 127.0.0.1:9870 http://httpbin.org/ip

Agent Proxy

# Server Side: Start server with both provider and connector tokens
linksocks server -t provider_token -c connector_token -p 9870 -r

# Provider Side: Connect as network provider
linksocks provider -t provider_token -u ws://localhost:8765

# Connector Side: Connect to use the proxy
linksocks connector -t connector_token -u ws://localhost:8765 -p 1180

# Test the proxy
curl --socks5 127.0.0.1:1180 http://httpbin.org/ip

Autonomy Mode

# Server Side: Start server in autonomy mode
linksocks server -t provider_token -r -a

# Provider Side: Provider sets its own connector token
linksocks provider -t provider_token -c my_connector_token -u ws://localhost:8765

# Connector Side: Use the specific connector token to access this provider
linksocks connector -t my_connector_token -u ws://localhost:8765 -p 1180

You can also use our public server (for autonomy mode proxy) at ws://l.zetx.tech:

# Provider Side: Provider sets its own connector token
linksocks provider -c my_connector_token -u l.zetx.tech

# Connector Side: Use the specific connector token to access this provider
linksocks connector -t my_connector_token -u l.zetx.tech -p 1180

If you are using the public server, please use a complex token, as anyone holding the token can connect to your service.

Use the following linux command to generate a complex token:

openssl rand -hex 16

Installation

Golang Version

go install github.com/linksocks/linksocks/cmd/linksocks@latest

Or download pre-built binaries from releases page.

Docker

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

Python Version

pip install linksocks

The python version is a wrapper of the Golang implementation. See: Python Bindings.

A pure python version with basic support is also available . See Pywssocks.

Cloudflare Worker

LinkSocks server (for autonomy mode proxy) can be hosted on Cloudflare Worker, see: linksocks/linksocks.js

Deploy to Cloudflare

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

API Server

LinkSocks server provides an HTTP API for dynamic token management:

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

For detailed API usage and examples, see: HTTP API

License

LinkSocks is open source under the MIT license.

About

A SOCKS proxy implementation over WebSocket protocol.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Go 57.2%
  • Python 42.1%
  • Other 0.7%