mirror of
https://github.com/snail007/goproxy.git
synced 2026-04-27 00:15:51 +03:00
[GH-ISSUE #450] 商业版goproxy使用--auth-file出现异常问题 #356
Labels
No labels
TODO
bug
duplicate
enhancement
good first issue
help wanted
helpful
invalid
need-confirm
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/goproxy#356
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nginxzzz on GitHub (Aug 25, 2021).
Original GitHub issue: https://github.com/snail007/goproxy/issues/450
商业版goproxy sps模式使用--auth-file认证, 接口根据文档返回upstream字段,日志提示functions.go:178: bind crashed runtime error: invalid memory address or nil pointer dereference,无法正常工作。 接口不中不返回upstream则可正常使用,不会报错
Expected Behavior
二级代理模式,goproxy部署为一级代理(sps模式,上级为其他http代理), 接受客户端(proxifier)连接
Current Behavior
1,使用curl -x hello:test@192.168.2.1:10000 时, goproxy日志中提示" functions.go:178: bind crashed runtime error: invalid memory address or nil pointer dereference"
2, 使用proxifier工具也同样有此提示(附上proxifier日志), 并且提示错误
3, 客户端连gorpoxy的上级可以正常工作,说明goproxy上级配置没有问题
4, 测试了baidu等网址,同样错误
// 这是proxifier日志
[41:21] 测试已开始。
代理服务器
地址: 192.168.2.1:10000
协议: HTTPS
验证: 基础
用户名: hello
[41:21] 正在开始: 测试 1: 连接到代理服务器
[41:21] IP 地址: 192.168.2.1
[41:21] 已建立连接
[41:21] 测试已通过。
[41:21] 正在开始: 测试 2: 通过代理服务器连接
[41:21] 已通过代理服务器与 www.google.com:80 建立了连接。
[41:22] 错误: 代理服务器的连接被意外关闭。
请确保目标主机是 Web 服务器。
此错误也可能表示代理服务器不能正常运行。
[41:22] 测试已失败。
[41:22] 测试已完成。
// 这是goproxy 日志
2021/08/25 03:41:21.797050 sps.go:1091: user hello rate, current: 1/s, max: 20/s, ip:192.168.2.1
2021/08/25 03:41:22.847175 sps.go:1325: rate limit 3000 bytes/s ,192.168.2.1 , www.google.com:80
2021/08/25 03:41:22.847175 sps.go:1394: conn 192.168.2.1:53720 - 192.168.3.1:1234 connected [www.google.com:80]
2021/08/25 03:41:22.861951 sps.go:1355: conn 192.168.2.1:53720 - 192.168.3.1:1234 released [www.google.com:80]
2021/08/25 03:41:22.861951 functions.go:178: bind crashed runtime error: invalid memory address or nil pointer dereference
Possible Solution
可能是--auth-file校验有问题, 单独测试了命令行使用-T -P连接上级代理时可以正常工作
Steps to Reproduce
Context (Environment)
2021/08/25 03:41:21.797050 sps.go:1091: user hello rate, current: 1/s, max: 20/s, ip:192.168.2.1
2021/08/25 03:41:22.847175 sps.go:1325: rate limit 3000 bytes/s ,192.168.2.1 , www.google.com:80
2021/08/25 03:41:22.847175 sps.go:1394: conn 192.168.2.1:53720 - 192.168.3.1:1234 connected [www.google.com:80]
2021/08/25 03:41:22.861951 sps.go:1355: conn 192.168.2.1:53720 - 192.168.3.1:1234 released [www.google.com:80]
2021/08/25 03:41:22.861951 functions.go:178: bind crashed runtime error: invalid memory address or nil pointer dereference
Detailed Description
// goproxy配置
sps
-p :10000
--forever
--log proxy.log
--auth-url http://192.168.1.10/auth.php
// auth.php
$alluser=[
"hello"=>"test",
"user2"=>"pass2",
"user3"=>"pass3",
"user4"=>"pass4",
];
$proxy_ip=$_GET['local_addr'];
$user_ip=$_GET['client_addr'];
$service=$_GET['service'];
$is_sps=$_GET['sps']=='1';
$user=$_GET['user'];
$pass=$_GET['pass'];
$target=$_GET['target'];
//业务逻辑判断
//....
$ok=true;
//设置认证结果
if($ok){
header("userconns:1000");
header("ipconns:2000");
header("userrate:3000");
header("iprate:8000");
header("UPSTREAM:http://admin:test@192.168.3.1:1234?parent-type=tcp");
header("HTTP/1.1 204 No Content");
}
Possible Implementation
@snail007 commented on GitHub (Aug 25, 2021):
你这是api认证,并不是--auth-file认证。
@snail007 commented on GitHub (Aug 25, 2021):
问题已经复现和定位,下个版本会修复。
@nginxzzz commented on GitHub (Aug 25, 2021):
感谢处理, 是auth-url, 是我写错了
@aa1008611 commented on GitHub (Apr 9, 2022):
老板 api可以付费对接你的吗
@snail007 commented on GitHub (Apr 10, 2022):
商业版可以对接你自己写的API。