github.com/Uhtred009/v2ray-core-1@v4.31.2+incompatible/transport/internet/headers/wechat/wechat.go (about) 1 package wechat 2 3 import ( 4 "context" 5 "encoding/binary" 6 7 "v2ray.com/core/common" 8 "v2ray.com/core/common/dice" 9 ) 10 11 type VideoChat struct { 12 sn uint32 13 } 14 15 func (vc *VideoChat) Size() int32 { 16 return 13 17 } 18 19 // Serialize implements PacketHeader. 20 func (vc *VideoChat) Serialize(b []byte) { 21 vc.sn++ 22 b[0] = 0xa1 23 b[1] = 0x08 24 binary.BigEndian.PutUint32(b[2:], vc.sn) // b[2:6] 25 b[6] = 0x00 26 b[7] = 0x10 27 b[8] = 0x11 28 b[9] = 0x18 29 b[10] = 0x30 30 b[11] = 0x22 31 b[12] = 0x30 32 } 33 34 // NewVideoChat returns a new VideoChat instance based on given config. 35 func NewVideoChat(ctx context.Context, config interface{}) (interface{}, error) { 36 return &VideoChat{ 37 sn: uint32(dice.RollUint16()), 38 }, nil 39 } 40 41 func init() { 42 common.Must(common.RegisterConfig((*VideoConfig)(nil), NewVideoChat)) 43 }