update: 整理项目结构 重写中间件 提高复用性

This commit is contained in:
2025-09-26 12:29:57 +08:00
parent 5daf6df318
commit d15352a18b
9 changed files with 430 additions and 324 deletions

View File

@@ -1,29 +1,35 @@
# AnyProxy 简介
AnyProxy 是一个简单的 HTTP/HTTPS 代理服务器。它可以帮助你转发和代理请求。
支持 GET / POST / PUT / DELETE / HEAD / OPTIONS 请求。
兼容 SSE 流式请求。
## 使用方法
1. **直接协议路径**
- 目标URL: `https://example.com/path`
代理URL: `http://AnyproxyIP/https/example.com/path`
- 目标URL: `http://example.com/path`
代理URL: `http://AnyproxyIP/http/example.com/path`
1. **直接协议路径**
2. **完整URL路径**
- 目标URL: `https://example.com`
代理URL: `http://AnyproxyIP/proxy/https://example.com`
- 目标 URL: `https://example.com/path`
代理 URL: `http://AnyproxyIP/https/example.com/path`
- 目标 URL: `http://example.com/path`
代理 URL: `http://AnyproxyIP/http/example.com/path`
> 目标URL 必须以 `https://` 或 `http://` 开头。
2. **完整 URL 路径**
- 目标 URL: `https://example.com`
代理 URL: `http://AnyproxyIP/proxy/https://example.com`
> 目标 URL 必须以 `https://` 或 `http://` 开头。
> 访问根路径可以查看使用方式
## 安装
1. 下载对应平台的二进制Relase文件
1. 下载对应平台的二进制 Relase 文件
2. 运行二进制文件
3. (可选) 配置为系统服务
系统服务参考(Systemd)
~~~ ini
### 系统服务参考(Systemd)
```ini
# /etc/systemd/system/anyproxy.service
[Unit]
Description=AnyProxy Service
@@ -37,4 +43,14 @@ User=root
[Install]
WantedBy=multi-user.target
~~~
```
## 可选参数
| 参数 | 是否可选 | 默认值 | 数据类型 | 解释 |
| -------- | -------: | :---------------: | -------- | --------------------------------- |
| -port | 是 | 8080 | int | 代理服务器监听端口 |
| -debug | 是 | false | bool | 调试模式debug 级别日志) |
| -log | 是 | (输出到 stderr | string | 日志文件路径(默认输出到 stderr |
| -grace | 是 | 10 | int | 优雅停机等待秒数 |
| -timeout | 是 | 0 | int | 单次上游请求超时秒0 = 不设置) |