-
Notifications
You must be signed in to change notification settings - Fork 37
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
[提问] sig.bin
数据的获取方法是什么?
#53
Comments
我使用如下代码尝试进行初次登录: func main() {
appInfo := auth.AppList["linux"]
deviceInfo := auth.NewDeviceInfo(rand.Int())
qqclient := client.NewClient(
uint32(qqId),
signAddress,
appInfo,
)
qqclient.UseDevice(deviceInfo)
qqclient.GroupMessageEvent.Subscribe(func(client *client.QQClient, event *message.GroupMessage) {
if event.ToString() == "lgrping" {
_, err := client.SendGroupMessage(event.GroupCode, []message.IMessageElement{&message.TextElement{Content: "pong"}})
if err != nil {
fmt.Printf("SendGroupMessage failed: %v\n", err)
return
}
}
})
qrcode, url, err := qqclient.FetchQRCodeDefault()
if err != nil {
fmt.Printf("FetchQRCodeDefault failed: %v\n", err)
panic(err)
}
reader := bytes.NewReader(qrcode)
image, format, err := image.Decode(reader)
if err != nil {
fmt.Printf("Decode QRCode failed: %v\n", err)
panic(err)
}
fmt.Println("QRCode format:", format)
fmt.Println("QRCode url:", url)
file, err := os.Create("qrcode.png")
if err != nil {
fmt.Printf("Create QRCode file failed: %v\n", err)
panic(err)
}
defer file.Close()
err = png.Encode(file, image)
if err != nil {
fmt.Printf("Encode QRCode file failed: %v\n", err)
panic(err)
}
err = qqclient.Login(password, "qrcode.png")
if err != nil {
fmt.Printf("Login failed: %v\n", err)
panic(err)
}
defer qqclient.Release()
sigInfo := qqclient.Sig()
data, err := sigInfo.Marshal()
if err != nil {
fmt.Printf("Marshal SigInfo failed: %v\n", err)
panic(err)
}
err = os.WriteFile("sig.bin", data, 0644)
if err != nil {
fmt.Printf("Write SigInfo file failed: %v\n", err)
panic(err)
}
// setup the main stop channel
mc := make(chan os.Signal, 2)
signal.Notify(mc, os.Interrupt, syscall.SIGTERM)
for {
switch <-mc {
case os.Interrupt, syscall.SIGTERM:
return
}
}
} 在扫码登录后,一段时间无响应输出后出现如下错误:
这是什么情况? |
将
尝试改用文档中镜像地址也没用 |
你是不是用的昨天的提交,那个版本太新和sign对不上,你再pull一下代码,把 |
不好意思,AppList这应该是3.1.2-13107不是3.2.10-25765 |
添加后确实能够成功登录了,但是在生成 sig.bin 文件后,尝试读取该文件并通过
是我的什么步骤进行错了吗? |
你这个登录流程不对,fetchqrcode和login不可以一起用,login方法里面自带了二维码登录,把fetchqrcode删掉试试 |
在main.go也有登录示例,可以参考一下 |
二维码生成是在哪一步进行的? |
我在文档的 main.go 里只看到了使用 |
login里面会自动生成二维码,扫完码之后就不用保留二维码了,在siginfo有效的情况下会自动使用快速登录,无需扫码 |
可以参看Go-Lagrange-Client |
|
在文档中只看到了如何将
sig.bin
和SigInfo
进行互相转换,但是没有看到从哪里获取这个数据。The text was updated successfully, but these errors were encountered: