Skip to content

Commit

Permalink
Merge pull request #10 from zema1/feat/lb
Browse files Browse the repository at this point in the history
feat: support load balancing case
  • Loading branch information
zema1 authored Mar 5, 2023
2 parents 62ee004 + 9a3f293 commit 374ea29
Show file tree
Hide file tree
Showing 20 changed files with 1,434 additions and 174 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# 更新记录

## [0.4.0] - 2023-03-05

### 新增

- 支持在负载均衡场景使用,需要通过 `-r` 指定一个 url,流量将集中到这个 url
- 支持自定义 header,而不仅仅是自定义 User-Agent [#5](https://github.com/zema1/suo5/issues/6)
- 优化连接控制,本地连接关闭后能更快的释放底层连接

### 修复

- 修复命令行版设置认证信息不生效的问题 [#5](https://github.com/zema1/suo5/issues/8)

## [0.3.0] - 2023-02-24

### 新增
Expand Down
39 changes: 24 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,27 @@ USAGE:
suo5 [global options] command [command options] [arguments...]
VERSION:
v0.3.0
v0.4.0
COMMANDS:
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--target value, -t value set the remote server url, ex: http://localhost:8080/tomcat_debug_war_exploded/
--listen value, -l value set the listen address of socks5 server (default: "127.0.0.1:1111")
--method value, -m value http request method (default: "POST")
--no-auth disable socks5 authentication (default: true)
--auth value socks5 creds, username:password, leave empty to auto generate
--mode value connection mode, choices are auto, full, half (default: "auto")
--ua value the user-agent used to send request (default: "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.1.2.3")
--timeout value http request timeout in seconds (default: 10)
--buf-size value set the request max body size (default: 327680)
--proxy value use upstream socks5 proxy
--debug, -d debug the traffic, print more details (default: false)
--help, -h show help
--version, -v print the version
--target value, -t value set the remote server url, ex: http://localhost:8080/tomcat_debug_war_exploded/
--listen value, -l value set the listen address of socks5 server (default: "127.0.0.1:1111")
--method value, -m value http request method (default: "POST")
--redirect value, -r value redirect to the url if host not matched, used to bypass load balance
--no-auth disable socks5 authentication (default: true)
--auth value socks5 creds, username:password, leave empty to auto generate
--mode value connection mode, choices are auto, full, half (default: "auto")
--ua value the user-agent used to send request (default: "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.1.2.3")
--header value, -H value [ --header value, -H value ] use extra header, ex -H 'Cookie: abc'
--timeout value http request timeout in seconds (default: 10)
--buf-size value set the request max body size (default: 327680)
--proxy value use upstream socks5 proxy
--debug, -d debug the traffic, print more details (default: false)
--help, -h show help
--version, -v print the version
```

命令行版本与界面版配置完全一致,可以对照界面版功能来使用,最简单的只需指定连接目标
Expand All @@ -94,6 +96,13 @@ $ ./suo5 -m GET -t https://example.com/proxy.jsp
```bash
$ ./suo5 -t https://example.com/proxy.jsp -l 0.0.0.0:7788 --auth test:test123
```

负载均衡场景下将流量转发到某一个固定的 url 解决请求被分散的问题 (需要尽可能的在每一个后端服务中上传 suo5)

```bash
$ ./suo5 -t https://example.com/proxy.jsp -t http://172.0.3.2/code/proxy.jsp
```

### 特别提醒
`User-Agent` (`ua`) 的配置本地端与服务端是绑定的,如果修改了其中一个,另一个也必须对应修改才能连接上。

Expand All @@ -113,7 +122,7 @@ $ ./suo5 -t https://example.com/proxy.jsp -l 0.0.0.0:7788 --auth test:test123
## 接下来

- [x] 支持配置上游 socks 代理
- [ ] 支持负载均衡的场景
- [x] 支持负载均衡的场景
- [ ] 支持 .Net 的类型

## 参考
Expand Down
Loading

0 comments on commit 374ea29

Please sign in to comment.