v2ray-core/transport/internet/headers/wechat/wechat.go

36 lines
637 B
Go
Raw Normal View History

2017-01-03 21:46:22 +00:00
package wechat
import (
2017-01-12 21:47:10 +00:00
"context"
2017-01-03 21:46:22 +00:00
"v2ray.com/core/common"
"v2ray.com/core/common/dice"
"v2ray.com/core/common/serial"
)
type VideoChat struct {
sn int
}
func (vc *VideoChat) Size() int {
return 13
}
func (vc *VideoChat) Write(b []byte) (int, error) {
vc.sn++
b = append(b[:0], 0xa1, 0x08)
b = serial.IntToBytes(vc.sn, b)
b = append(b, 0x10, 0x11, 0x18, 0x30, 0x22, 0x30)
return 13, nil
}
2017-01-12 21:47:10 +00:00
func NewVideoChat(ctx context.Context, config interface{}) (interface{}, error) {
2017-01-03 21:46:22 +00:00
return &VideoChat{
2017-02-14 21:29:44 +00:00
sn: int(dice.RandomUint16()),
2017-01-12 21:47:10 +00:00
}, nil
2017-01-03 21:46:22 +00:00
}
func init() {
2017-01-12 21:47:10 +00:00
common.Must(common.RegisterConfig((*VideoConfig)(nil), NewVideoChat))
2017-01-03 21:46:22 +00:00
}