Hunter0x7c7
2022-08-11 a82f9cb69f63aaeba40c024960deda7d75b9fece
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
package wechat
 
import (
    "context"
    "encoding/binary"
 
    "github.com/v2fly/v2ray-core/v5/common"
    "github.com/v2fly/v2ray-core/v5/common/dice"
)
 
type VideoChat struct {
    sn uint32
}
 
func (vc *VideoChat) Size() int32 {
    return 13
}
 
// Serialize implements PacketHeader.
func (vc *VideoChat) Serialize(b []byte) {
    vc.sn++
    b[0] = 0xa1
    b[1] = 0x08
    binary.BigEndian.PutUint32(b[2:], vc.sn) // b[2:6]
    b[6] = 0x00
    b[7] = 0x10
    b[8] = 0x11
    b[9] = 0x18
    b[10] = 0x30
    b[11] = 0x22
    b[12] = 0x30
}
 
// NewVideoChat returns a new VideoChat instance based on given config.
func NewVideoChat(ctx context.Context, config interface{}) (interface{}, error) {
    return &VideoChat{
        sn: uint32(dice.RollUint16()),
    }, nil
}
 
func init() {
    common.Must(common.RegisterConfig((*VideoConfig)(nil), NewVideoChat))
}