{"id":30345698,"url":"https://github.com/zetxtech/linksocks","last_synced_at":"2025-08-18T14:09:30.085Z","repository":{"id":276770342,"uuid":"930216414","full_name":"zetxtech/linksocks","owner":"zetxtech","description":"A SOCKS proxy implementation over WebSocket protocol.","archived":false,"fork":false,"pushed_at":"2025-08-11T19:23:07.000Z","size":305,"stargazers_count":76,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-11T21:16:27.817Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zetxtech.png","metadata":{"files":{"readme":"README.cn.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-10T09:17:37.000Z","updated_at":"2025-08-11T19:23:10.000Z","dependencies_parsed_at":"2025-02-10T11:22:11.613Z","dependency_job_id":"b7afaaba-9121-4c42-9877-99879373d835","html_url":"https://github.com/zetxtech/linksocks","commit_stats":null,"previous_names":["zetxtech/wssocks","zetxtech/linksocks"],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/zetxtech/linksocks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zetxtech%2Flinksocks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zetxtech%2Flinksocks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zetxtech%2Flinksocks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zetxtech%2Flinksocks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zetxtech","download_url":"https://codeload.github.com/zetxtech/linksocks/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zetxtech%2Flinksocks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271005119,"owners_count":24683262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-18T14:09:29.482Z","updated_at":"2025-08-18T14:09:30.074Z","avatar_url":"https://github.com/zetxtech.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/zetxtech/linksocks/ci.yml?logo=github\u0026label=Tests)](https://github.com/zetxtech/linksocks/actions) [![Codecov](https://img.shields.io/codecov/c/github/zetxtech/linksocks?logo=codecov\u0026logoColor=white)](https://app.codecov.io/gh/zetxtech/linksocks/tree/main) [![Docker Pulls](https://img.shields.io/docker/pulls/jackzzs/linksocks?logo=docker\u0026logoColor=white)](https://hub.docker.com/r/jackzzs/linksocks)\n\n# LinkSocks\n\nLinkSocks 是一个基于 WebSocket 协议的跨网络跨机器 SOCKS 代理实现。\n\n[English README](README.md)\n\n## 概述\n\nLinkSocks 允许您在 Web 应用防火墙（WAF）保护下安全地提供 SOCKS 代理服务（正向代理模式），或使没有公网 IP 的客户端连接并作为 SOCKS 代理服务器（反向代理模式）。\n\n![架构图](https://github.com/zetxtech/linksocks/raw/main/images/abstract.svg)\n\n如需 Python 版本，请查看 [zetxtech/pylinksocks](https://github.com/zetxtech/pylinksocks)。但请注意，Python 版本的性能通常低于 Go 语言实现版本。\n\n## 特性\n\n1. 支持命令行使用、API 服务器和库集成\n2. 支持正向、反向和代理模式\n3. 反向代理支持轮询负载均衡\n4. 支持 SOCKS 代理身份验证\n5. 支持 SOCKS5 上的 IPv6\n6. 支持 SOCKS5 上的 UDP\n\n## 潜在应用场景\n\n1. 分布式 HTTP 后端\n2. 使用客户端代理绕过验证码\n3. 通过 CDN 网络实现安全的内网穿透\n\n## 使用方法\n\n### 命令行工具\n\n正向代理模式：\n\n```bash\n# 服务端（WebSockets 监听 8765 端口，作为网络提供方）\nlinksocks server -t example_token\n\n# 客户端（SOCKS5 监听 9870 端口）\nlinksocks client -t example_token -u http://localhost:8765 -p 9870\n```\n\n反向代理模式（使用 `-r` 参数）：\n\n```bash\n# 服务端（WebSockets 监听 8765 端口，SOCKS 监听 9870 端口）\nlinksocks server -t example_token -p 9870 -r\n\n# 客户端（作为网络提供方）\nlinksocks client -t example_token -u http://localhost:8765 -r\n```\n\n代理模式（使用 `-c` 参数指定连接器令牌）：\n\n```bash\n# 服务端（WebSockets 监听 8765 端口，SOCKS 监听 9870 端口）\nlinksocks server -t example_token -c example_connector_token -p 9870 -r\n\n# 客户端（作为网络提供方）\nlinksocks provider -t example_token -u http://localhost:8765\n\n# 连接器（SOCKS5 监听 1180 端口）\nlinksocks connector -t example_connector_token -u http://localhost:8765 -p 1180\n```\n\n您也可以使用我们的公共演示服务器：\n\n```bash\n# 客户端（作为网络提供方）\nlinksocks provider -t any_token -u https://linksocks.zetx.tech -c any_connector_token\n\n# 连接器（SOCKS5 监听 1180 端口）\nlinksocks connector -t any_connector_token -u https://linksocks.zetx.tech -p 1180\n```\n\n自主代理模式（使用 `-a` 参数）：\n\n```bash\n# 服务端（WebSocket 监听 8765 端口，自主模式）\nlinksocks server -r -t example_token -a\n\n# 客户端（作为网络提供方，启动时设置连接器令牌）\nlinksocks provider -t example_token -c example_connector_token\n```\n\n在自主模式下：\n1. 服务端的 SOCKS 代理不会启动监听\n2. 反向客户端可以指定自己的连接器令牌\n3. 负载均衡被禁用 - 每个连接器的请求只会路由到其对应的反向客户端\n\n## 安装\n\n安装 LinkSocks：\n\n```bash\ngo install github.com/zetxtech/linksocks/cmd/linksocks@latest\n```\n\n您也可以从[发布页面](https://github.com/zetxtech/linksocks/releases)下载适合您系统架构的预编译二进制文件。\n\nLinkSocks 也提供 Docker 镜像：\n\n```bash\ndocker run --rm -it jackzzs/linksocks --help\n```\n\n## Cloudflare Worker\n\nLinkSocks 服务端可以部署在 Cloudflare Worker 上，详见：[zetxtech/linksocks.js](https://github.com/zetxtech/linksocks.js)\n\n[![部署到 Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/zetxtech/linksocks.js)\n\nlinksocks.js 版本是一个轻量级版本，不包含 API 功能。\n\n## API 服务\n\n使用 `--api-key` 参数启用时，LinkSocks 服务端提供 HTTP API：\n\n```bash\n# 启用 API 功能启动服务端\nlinksocks server --api-key your_api_key\n```\n\n### API 接口\n\n所有 API 请求需要在请求头中包含 `X-API-Key` 字段及您配置的 API 密钥。\n\n#### 获取服务器状态\n\n```\nGET /api/status\n```\n\n返回服务器版本以及所有令牌的类型和活跃客户端数量列表。\n\n#### 添加正向令牌\n\n```\nPOST /api/token\nContent-Type: application/json\n\n{\n    \"type\": \"forward\",\n    \"token\": \"new_token\"  // 可选：若不提供则自动生成\n}\n```\n\n添加新的正向代理令牌。\n\n#### 添加反向令牌\n\n```\nPOST /api/token\nContent-Type: application/json\n\n{\n    \"type\": \"reverse\",\n    \"token\": \"new_token\",  // 可选：若不提供则自动生成\n    \"port\": 9870,          // 可选：若不提供则自动分配\n    \"username\": \"user\",    // 可选：SOCKS 身份验证\n    \"password\": \"pass\"     // 可选：SOCKS 身份验证\n}\n```\n\n添加带有指定 SOCKS 设置的新反向代理令牌。\n\n#### 删除令牌\n\n```\nDELETE /api/token/{token}\n```\n\n或\n\n```\nDELETE /api/token\n\nContent-Type: application/json\n\n{\n    \"token\": \"token_to_delete\"\n}\n```\n\n删除指定的令牌。\n\n## 许可证\n\nLinkSocks 在 MIT 许可证下开源。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzetxtech%2Flinksocks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzetxtech%2Flinksocks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzetxtech%2Flinksocks/lists"}