-
Notifications
You must be signed in to change notification settings - Fork 5
/
Fun0058_Heartbeat.go
46 lines (42 loc) · 1.29 KB
/
Fun0058_Heartbeat.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
@Author: Trial(Trialpro@gmail.com)
@Creat: 2022/1/1 15:15
@Notice: 心跳包
*/
package Tangent_PC
import (
"github.com/shenpan233/Tangent-PC/model"
util "github.com/shenpan233/Tangent-PC/utils"
"github.com/shenpan233/Tangent-PC/utils/GuBuffer"
"github.com/shenpan233/Tangent-PC/utils/GuLog"
)
func (this *TangentPC) pack0058HeatBoat() (SsoSeq uint16, buffer []byte) {
return this.packetCommonEnc(0x00_58, GuBuffer.NewGuPacketFun(func(pack *GuBuffer.GuPacket) {
pack.SetBytes([]byte{0x0, 0x1, 0x0, 0x1})
}))
}
func (this *TangentPC) unpack0058(bin []byte) (heartBoatSe uint8) {
GuBuffer.NewGuUnPacketFun(util.Decrypt(this.teaKey.SessionKey, bin), func(pack *GuBuffer.GuUnPacket) {
heartBoatSe = pack.GetUint8()
switch heartBoatSe {
case LoginSuc:
return
case 0x11: //掉线
tgtInfo := model.TgtInfo{
BufTgTgTKey: this.sig.BufTgTGTKey,
BufTgt: this.sig.BufTgt,
BufGTKeyST: this.sig.BufTgTGTKey,
BufSessionKey: this.teaKey.SessionKey,
BufSession: this.sig.BufSession,
Buf0102: this.sig.Buf0102,
Buf0202: this.sig.Buf0202,
}
this.udper.Break()
this.PingServer()
this.LoginByToken(&tgtInfo)
this.ChangeOnlineStatus(Online)
}
GuLog.Info("heartBoat heartBoat:", heartBoatSe, "\n", pack.GetAllHex())
})
return
}