Highly-opinionated (ex-bullshit-free) MTPROTO proxy for Telegram. If you use v1.0 or upgrade broke you proxy, please read the chapter Version 2
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

client_handshake_fuzz_internal_test.go 703B

1234567891011121314151617181920212223242526272829303132
  1. package obfuscated2
  2. import (
  3. "bytes"
  4. "testing"
  5. "github.com/stretchr/testify/require"
  6. )
  7. var FuzzClientHandshakeSecret = []byte{1, 2, 3}
  8. func FuzzClientHandshake(f *testing.F) {
  9. f.Add([]byte{1, 2, 3})
  10. f.Fuzz(func(t *testing.T, frame []byte) {
  11. data := bytes.NewReader(frame)
  12. if _, _, _, err := ClientHandshake(FuzzClientHandshakeSecret, data); err != nil {
  13. return
  14. }
  15. handshake := clientHandhakeFrame{}
  16. require.Len(t, frame, handshakeFrameLen)
  17. copy(handshake.data[:], frame)
  18. decryptor := handshake.decryptor(FuzzClientHandshakeSecret)
  19. decryptor.XORKeyStream(handshake.data[:], handshake.data[:])
  20. require.Equal(t, handshakeConnectionType, handshake.connectionType())
  21. })
  22. }