{"id":13775636,"url":"https://github.com/arloor/httpproxy","last_synced_at":"2025-04-05T12:07:19.034Z","repository":{"id":42446572,"uuid":"157892826","full_name":"arloor/HttpProxy","owner":"arloor","description":"http代理，支持CONNECT和普通GET/POST，支持http2；可防止主动嗅探；可作为小火箭、圈、surge等软件和SwitchyOmega(chrome插件)所说的https代理","archived":false,"fork":false,"pushed_at":"2024-09-06T15:12:35.000Z","size":2437,"stargazers_count":278,"open_issues_count":0,"forks_count":102,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-05T12:07:15.168Z","etag":null,"topics":["gfw","http-proxy","httpproxy","netty","nio"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arloor.png","metadata":{"files":{"readme":"README.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}},"created_at":"2018-11-16T16:22:43.000Z","updated_at":"2025-03-15T10:57:29.000Z","dependencies_parsed_at":"2024-08-03T17:10:45.357Z","dependency_job_id":"9c051fbe-8460-4917-b21c-418377f2bc0e","html_url":"https://github.com/arloor/HttpProxy","commit_stats":{"total_commits":298,"total_committers":6,"mean_commits":"49.666666666666664","dds":0.3087248322147651,"last_synced_commit":"44b171bc591d562266cd47e145197d38d57a2e8b"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arloor%2FHttpProxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arloor%2FHttpProxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arloor%2FHttpProxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arloor%2FHttpProxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arloor","download_url":"https://codeload.github.com/arloor/HttpProxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332609,"owners_count":20921853,"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":["gfw","http-proxy","httpproxy","netty","nio"],"created_at":"2024-08-03T17:01:43.602Z","updated_at":"2025-04-05T12:07:19.015Z","avatar_url":"https://github.com/arloor.png","language":"Java","readme":"**声明：本项目仅以学习为目的，请在当地法律允许的范围内使用本程序。任何因错误用途导致的法律责任，与本项目无关！**\n\n## 基于netty的http代理\n\n- 支持普通GET/POST和CONNECT隧道代理\n- 代理支持over TLS(也就是surge、小火箭等软件说的https proxy)\n- 防止主动嗅探是否为http代理\n- 使用openssl、epoll等技术，支持TLS v1.3。\n\n## 支持的客户端\n\n| 平台            | 支持的客户端                                                                                                                                                            |\n|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Linux、Windows | [clash_for_windows](https://github.com/Fndroid/clash_for_windows_pkg)、[go语言客户端](https://github.com/arloor/forward)、[Java语言客户端](https://github.com/arloor/connect) |\n| MacOS         | ClashX、ClashX Pro|                                                                                                                                                 |                                                                                                                                                           |                                                                                                                                                           |\n| IOS           | [Surge](https://apps.apple.com/us/app/surge-4/id1442620678)、[shawdowrocket](https://apps.apple.com/us/app/shadowrocket/id932747118)                               |\n| Android       | [ClashForAndroid](https://github.com/Kr328/ClashForAndroid)                                                                                                       |\n| chrome        | [SwitchyOmega](https://chrome.google.com/webstore/detail/proxy-switchyomega/padekgcemlokbadohgkifijomclgjgif)插件（不推荐，会存在被嗅探的风险）                                    |\n\n## 网速监控\n\n1. `http(s)://host:port/net`提供了基于echarts.js的网速监控，展示最近500秒的网速，如下图所示\n ![](/实时网速.png)\n2 `http(s)://host:port/metrics`提供了prometheus的exporter，可以方便地接入prometheus监控，提供网速、内存等监控指标，如下所示\n\n```shell\n# HELP proxy_out 上行流量\n# TYPE proxy_out counter\nproxy_out{host=\"localhost\",} 65205\n# HELP proxy_in 下行流量\n# TYPE proxy_in counter\nproxy_in{host=\"localhost\",} 21205\n# HELP proxy_out_rate 上行网速\n# TYPE proxy_out_rate gauge\nproxy_out_rate{host=\"localhost\",} 23967\n# HELP proxy_in_rate 下行网速\n# TYPE proxy_in_rate gauge\nproxy_in_rate{host=\"localhost\",} 5758\n# HELP direct_memory_total netty直接内存 对于jdk9+，请增加-Dio.netty.tryReflectionSetAccessible=true，对于jdk16+，请增加--add-opens java.base/java.nio=ALL-UNNAMED\n# TYPE direct_memory_total gauge\ndirect_memory_total{host=\"localhost\",} 33554439\n```\n\n[jdk9以上设置netty直接内存监控的说明](/jdk9以上设置netty直接内存监控的说明.md)\n\n## 运行指南\n\n```shell\n# 需要使用jdk17\nmaven clean package\njava -jar target/httpproxy-1.0-SNAPSHOT-all.jar -c proxy.properties\n```\n\n### 配置文件说明\n\n`proxy.properties`内容如下\n\n```shell script\n# true：主动索要Proxy-Authorization，可能会被探测到是代理服务器。除非通过Chrom插件SwitchyOmega使用该代理，否则不建议设置为true\n# false: 不索要Proxy-Authorization\nask4Authcate=false\n\n# http代理部分设置\n# true:开启，false:不开启\nhttp.enable=false                 \n# http代理的端口\nhttp.port=6789\n# http代理的用户名和密码，逗号分割多个用户。不设置则不启用鉴权\n#http.auth=user1:passwd,user2:passwd\n\n# https代理部分设置\n# true:开启，false:不开启\nhttps.enable=true\n# https代理的端口\nhttps.port=443\n# http代理的用户名和密码，逗号分割多个用户。不设置则不启用鉴权\n#https.auth=user1:passwd,user2:passwd\n# TLS证书的fullchain（从CA证书到域名证书）\nhttps.fullchain.pem=/path/to/fullchain.cer\n# TLS证书的私钥\nhttps.privkey.pem=/path/to/private.key\n```\n\n### TLS证书的更多说明\n\n以腾讯云的免费ssl证书为例，nginx文件夹中的`1_xxx.com_bundle.crt`是fullchain，`2_xxx.com.key`是private.key。相信代码从业者能够从这里举一反三，从而知道从其他途径签发的证书应该如何配置。\n\n测试时，可以使用项目内的`cert.pem`和`privkey.pem`（他们由openssl生成），同时需要设置设置chrome不验证localhost的证书\n\n```shell\n## 证书生成脚本\nopenssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout privkey.pem -out cert.pem -days 3650\n\n## chrome不验证本地证书\n打开 chrome://flags/#allow-insecure-localhost\n```\n\n## 性能测试\n\n[性能测试](性能测试.md)\n\n## 推荐查看Rust语言版本\n\n[rust_http_proxy](https://github.com/arloor/rust_http_proxy)\n\n轻量、高性能、内存占用低\n","funding_links":[],"categories":["\u003ca id=\"af9d2b4988d35a2a634c042a1c66bb8c\"\u003e\u003c/a\u003e工具"],"sub_categories":["\u003ca id=\"e9cc4e00d5851a7430a9b28d74f297db\"\u003e\u003c/a\u003eGFW"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farloor%2Fhttpproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farloor%2Fhttpproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farloor%2Fhttpproxy/lists"}