{"id":19284236,"url":"https://github.com/shadowsocksr-live/overtls","last_synced_at":"2026-05-28T07:03:22.052Z","repository":{"id":63047539,"uuid":"561386635","full_name":"ShadowsocksR-Live/overtls","owner":"ShadowsocksR-Live","description":"A simple proxy tunnel, minimalist tool for bypassing the GFW.","archived":false,"fork":false,"pushed_at":"2024-04-06T05:07:38.000Z","size":291,"stargazers_count":191,"open_issues_count":3,"forks_count":33,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-06T18:46:57.890Z","etag":null,"topics":["bypass","gfw","monitoring","networking","proxy","rust","rust-lang","security","ssl","tls","tunnel","websocket"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/ShadowsocksR-Live.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}},"created_at":"2022-11-03T15:23:00.000Z","updated_at":"2024-08-02T02:20:10.783Z","dependencies_parsed_at":"2023-02-12T11:15:15.398Z","dependency_job_id":"ff5ffed3-0b49-47bf-a1de-c1a088c3bbdf","html_url":"https://github.com/ShadowsocksR-Live/overtls","commit_stats":null,"previous_names":["ssrlive/overtls"],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShadowsocksR-Live%2Fovertls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShadowsocksR-Live%2Fovertls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShadowsocksR-Live%2Fovertls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShadowsocksR-Live%2Fovertls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShadowsocksR-Live","download_url":"https://codeload.github.com/ShadowsocksR-Live/overtls/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247271514,"owners_count":20911587,"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","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":["bypass","gfw","monitoring","networking","proxy","rust","rust-lang","security","ssl","tls","tunnel","websocket"],"created_at":"2024-11-09T21:37:27.049Z","updated_at":"2026-05-28T07:03:22.041Z","avatar_url":"https://github.com/ShadowsocksR-Live.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# overtls\n\novertls 是 [SOCKS5](https://en.wikipedia.org/wiki/SOCKS#SOCKS5) 型代理軟件，\n在軟件內部通過 TLS 實現數據傳輸，同時支持 TCP 和 UDP 流量轉發。\n\n功能齊備且代碼精簡，核心功能總共也就大概 1200 行代碼。\n\n\u003e `OverTLS` 相當於 [SSRoT](https://github.com/ShadowsocksR-Live/shadowsocksr-native) 去掉 `SSR` 和 `SS`,\n\u003e 唯獨保留 `oT` 的 Rust 實現，快如閃電，穩如老狗。\n\u003e ```kotlin\n\u003e     fun isOverTLS() : Boolean =\n\u003e         over_tls_enable \u0026\u0026 method == \"none\" \u0026\u0026 obfs == \"plain\" \u0026\u0026 protocol == \"origin\"\n\u003e ```\n\u003e 這段代碼翻譯成 人話 就是：如果 `oT` 啟用了，而且 `加密方式`爲 `none`、`混淆`爲 `plain`、`協議`爲 `origin`，那麼就是 `OverTLS` 啦。\n\n## 原理\n\n爲了能有效騙過 [GFW](https://en.wikipedia.org/wiki/Great_Firewall)，直接使用 [TLS](https://en.wikipedia.org/wiki/Transport_Layer_Security) 作爲代理協議是最簡單的方法。\nTLS 協議是互聯網的數據傳輸事实上的標準，所以 GFW 不能封鎖 TLS 協議，而且 TLS 協議是一種加密協議，\n所以 GFW 不知道通過 TLS 協議傳輸的數據的內容。\n\n我們可以利用這個特性，將客戶端和服務端的加密解密過程封裝成一個代理服務，這樣就可以在 GFW 的監視下，進行加密的 TCP 和 UDP 代理。\n\novertls 客戶端首先與 overtls 服務端建立 TLS 連接，然後 overtls 客戶端和 overtls 服務端之間的數據交換都是加密的。\n\n我們只要約定 overtls 客戶端訪問某一特定資源 uri，就認爲是要進行代理，服務端會將含有這個 uri 的數據包轉發到指定的目標地址。\n\n我們的代理目的就這樣達成了。\n\n因此，overtls 服務端和 overtls 客戶端之間的數據交換是加密的，而 overtls 服務端和目標服務器之間的數據交換是\"明文\"的。\n\n綜上所述，我們需要準備的東西有：\n- 一個帶公網 IP 的 VPS 主機，必須自行購買，\n- 一個域名，可以購買或申請免費的，並將該域名解析到 VPS 主機的 IP 上，\n- 一對 https 證書/私鑰，證書可以自行購買，也可以在 [Let's Encrypt](https://letsencrypt.org/) 申請免費的，\n- 一個 http 服務端軟件（如 [nginx](https://www.nginx.com/) ），並提供用於僞裝用途的站點資源或者充當前置的 `反向代理`，\n\n## 安裝\n\n### 從 crates.io 安裝\n\n如果你已經安裝了 [Rust](https://rustup.rs/)，你可以直接安裝 overtls。\n\n```bash\ncargo install overtls --root /usr/local/\n```\n\n### 預編譯二進制文件\n\n可直接從源代碼編譯，也可以從 [發布頁面](https://github.com/shadowsocksr-live/overtls/releases) 下載預編譯的二進制文件。\n\n### 從源碼編譯\n\n從源碼編譯，需要先安裝 [Rust](https://www.rust-lang.org/) 編程語言環境，然後執行以下命令編譯軟件。\n\n```bash\ngit clone https://github.com/shadowsocksr-live/overtls.git\ncd overtls\ncargo build --release\nsudo cp target/release/overtls-bin /usr/local/bin/\n```\n\n### 服務端一鍵安裝腳本\n\n安裝前請準備好帶公網 `IP` 的 `VPS` 主機和 `域名`，並將該域名解析到此 `主機` IP 上，然後執行以下命令，\n按提示操作，如果一切順利，結果就將 overtls 服務端 和 `nginx` 前置代理安裝到你的主機上，並申請好了證書。\n\n目前只支持 3 種 `CPU` 架構的 `Linux` 機器： `x86_64`、`armv7` 和 `arm64`。\n```bash\nsudo apt install -y wget # Debian/Ubuntu\nsudo yum install -y wget # CentOS\nwget https://raw.githubusercontent.com/shadowsocksr-live/overtls/master/install/overtls-install-musl.sh\nchmod +x overtls-install-musl.sh\n./overtls-install-musl.sh\nsudo systemctl start overtls\n```\n\n### 使用 Caddy 的安裝腳本\n\u003cdetails\u003e\n\u003csummary\u003e使用 Caddy 的腳本的安裝步驟\u003c/summary\u003e\n\n```bash\nsudo apt install -y wget # Debian/Ubuntu\nwget https://raw.githubusercontent.com/shadowsocksr-live/overtls/master/install/overtls-install-caddy.sh\nbash ./overtls-install-caddy.sh\nsudo systemctl start overtls\n```\n\n\u003c/details\u003e\n\n## 用法\n\n### 服務端\n\n```bash\novertls-bin -r server -c config.json\n```\n\n### 客戶端\n\n```bash\novertls-bin -r client -c config.json\n```\n\n如果想查看日志信息，你可以在你当前的工作目录 (`pwd`) 里创建文件 `.env` 写入这些内容 `RUST_LOG=overtls=trace` 即可.\n\n### 配置文件\n\n```json\n{\n    \"tunnel_path\": \"/secret-tunnel-path/\",\n\n    \"server_settings\": {\n        \"certfile\": \"/etc/mysite_cert/fullchain.pem\",\n        \"keyfile\": \"/etc/mysite_cert/privkey.pem\",\n        \"forward_addr\": \"http://127.0.0.1:80\",\n        \"listen_host\": \"0.0.0.0\",\n        \"listen_port\": 443\n    },\n\n    \"client_settings\": {\n        \"server_host\": \"123.45.67.89\",\n        \"server_port\": 443,\n        \"server_domain\": \"example.com\",\n        \"listen_host\": \"127.0.0.1\",\n        \"listen_port\": 1080\n    }\n}\n```\n配置文件非常簡單。是 `服務端` 和 `客戶端` 通用的， \n- 當程序以 `服務端` 身份運行時，`server_settings` 部分是有效的，而 `client_settings` 部分是被忽略的；\n- 當程序以 `客戶端` 身份運行時，`client_settings` 部分是有效的，而 `server_settings` 部分是被忽略的。\n\n`certfile` 和 `keyfile` 爲可選項，配正確後 軟件就變身 https 協議服務端，非翻牆流量直接轉發到 `forward_addr` 指向的目標。\n若 `certfile` 和 `keyfile` 兩項配錯或乾脆不存在，則需要前置的 `反向代理` 如 `nginx` 協助方可工作。\n\n\u003e 如果 `forward_addr` 選項不存在，則默認值爲 `http://127.0.0.1:80`，即本機 `nginx` 監聽 `http` 的 `80` 端口。\n\n注意 `tunnel_path` 配置項，請務必改成你自己獨有的複雜字符串，否則 `GFW` 立馬拿你祭旗。\n\n\u003e `tuunel_path` 選項現在可以是字符串或字符串數組，如 `[\"/secret-tunnel-path/\", \"/another-secret-tunnel-path/\"]`。\n\u003e Overtls 客戶端將選擇第一個使用。在服務端，它將用整個字符串數組来检查傳入請求.\n\n\u003e 爲方便測試，提供了 `disable_tls` 選項以具備停用 `TLS` 的能力；就是說，若該項存在且爲 `true` 時，本軟件將 `明文(plain text)` 傳輸流量；出於安全考慮，正式場合請勿使用。\n\n本示例展示的是最少條目的配置文件，完整的配置文件可以參考 [config.json](config.json)。\n\n### 自簽證書使用\n\n如果你確實沒有 `域名`， 可以使用 `openssl` 生成自簽證書 來臨時連接服務端，以便你能處理你的緊急事務。\n\n```bash\nsudo apt install -y wget # Debian/Ubuntu\nsudo yum install -y wget # CentOS\nwget https://raw.githubusercontent.com/shadowsocksr-live/overtls/master/install/overtls-install-selfsign.sh\nbash ./overtls-install-selfsign.sh\n```\n\u003e - 注意：`GFW` 可能會因爲你使用了自簽證書而封鎖你的服務器。所以請不要長期用於正式場合。\n\u003e - 注意：這時候你最好將 根證書文件 `root.crt` 複製粘貼到本地，在配置文件中將 `cafile` 設置爲該根證書文件的路徑。 \n\u003e - 注意：如果你使用了自簽證書，又嫌在客戶端使用根證書文件太麻煩，可以在配置文件中將 `dangerous_mode` 設置爲 `true`，\n\u003e   這樣就可以跳過證書驗證了。但這樣做非常危險，容易遭到\n\u003e   [中間人攻擊](https://zh.wikipedia.org/wiki/%E4%B8%AD%E9%97%B4%E4%BA%BA%E6%94%BB%E5%87%BB) ，\n\u003e   可能會在你使用網絡帳號時被盜取密碼等敏感信息。請謹慎使用。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowsocksr-live%2Fovertls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshadowsocksr-live%2Fovertls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowsocksr-live%2Fovertls/lists"}