Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复TCP缓冲区不足问题;重构 qsign 签名服务对接部分;支持配置多个签名服务器 #2389

Merged
merged 32 commits into from
Aug 27, 2023

Conversation

1umine
Copy link
Contributor

@1umine 1umine commented Aug 19, 2023

配置文件有破坏性更新,使用先前的配置需要重新生成,此外需要确保签名服务和gocq至少有一个开启了自动注册配置
否则 无法成功签名 ,配置默认自动注册为 false ,个人建议使用本地搭建的服务,并开启 qsign 自动注册。

更改

  • SendSsoPacket 出错或返回空值时直接跳过提交 callback
  • 开启自动注册时销毁实例若出错(真的丢失了一般必然是出错的)后不return,继续注册并重新签名。
  • sign-server-timeout 配置改到了 Account 下,和其他签名服务相关配置放在一起。
  • Authorization 不局限于使用 Bearer token。
  • 重构:把签名请求的部分包装了一下,减少一些重复逻辑(如设置签名服务器地址,http authorization信息,超时时间)
  • 删除了连接签名服务时的 tcp ping(没必要了),因新特性的实现在启动时会使用可用的签名服务器,没有则会提示相应错误。
  • 删除了启动时的注册实例,新特性获取到可用签名服务器后会根据自动注册配置注册实例,此项需要保证有一方开启了自动注册。

修复bug

fix #2368: 对于同一 timeout 的请求使用同一个 client,避免 WithTimeout 每次都创建新的 client 请求签名服务器并且没有控制每个client的空闲连接的个数,可能导致建立大量TCP连接导致TCP缓冲区空间不足或队列已满的问题。

新增功能

新增bug(可能)

此更新好像带来了个新的潜在bug,不过不影响签名结果()
向签名服务器发请求时可能出现请求前获取的签名服务信息和请求时使用的签名服务不一致的问题,不过触发条件感觉不太容易,需要高频发消息。

@ShiaBox
Copy link

ShiaBox commented Aug 22, 2023

谢谢佬,佬辛苦啦

Copy link
Collaborator

@fumiama fumiama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job.

cmd/gocq/qsign.go Outdated Show resolved Hide resolved
cmd/gocq/qsign.go Outdated Show resolved Hide resolved
cmd/gocq/qsign.go Outdated Show resolved Hide resolved
cmd/gocq/qsign.go Outdated Show resolved Hide resolved
cmd/gocq/qsign.go Outdated Show resolved Hide resolved
cmd/gocq/qsign.go Outdated Show resolved Hide resolved
internal/download/download.go Outdated Show resolved Hide resolved
@fumiama fumiama added the enhancement New feature or request label Aug 23, 2023
@fumiama
Copy link
Collaborator

fumiama commented Aug 25, 2023

别忘了解决一下冲突

@1umine
Copy link
Contributor Author

1umine commented Aug 27, 2023

应该可以了

@fumiama fumiama merged commit f8354ec into Mrs4s:dev Aug 27, 2023
11 checks passed
@Dreamail
Copy link

[2023-08-28 22:49:57] [INFO]: 当前版本:(devel)
[2023-08-28 22:49:57] [INFO]: 将使用 device.json 内的设备信息运行Bot.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x4dd2c0]

goroutine 1 [running]:
github.com/Mrs4s/go-cqhttp/cmd/gocq.getAvaliableSignServer()
/build/cmd/gocq/qsign.go:72 +0x140
github.com/Mrs4s/go-cqhttp/cmd/gocq.LoginInteract()
/build/cmd/gocq/main.go:166 +0x3f0
main.main()
/build/main.go:20 +0x28

拉取了最新dev分支之后删除原配置重新配置依旧出现上述报错

@1umine
Copy link
Contributor Author

1umine commented Aug 28, 2023

用上一个 commit 的

rhwong added a commit to rhwong/qsign-onekey that referenced this pull request Sep 11, 2023
support go-cqhttp multiple sign-server
Mrs4s/go-cqhttp#2389
rhwong added a commit to rhwong/qsign-onekey that referenced this pull request Sep 11, 2023
📅2023-09-11

- update go-cqhttp -> [f16d72f](https://github.com/Mrs4s/go-cqhttp/actions/runs/6036458147)

修复了对于最新版本go-cqhttp配置文件中关于签名服务器部分的破坏性更新的支持。

脚本只会替换当前配置文件中第一个签名服务器,若需要使用备用签名服务器请自行修改配置文件。

Mrs4s/go-cqhttp#2389
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants