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文字以内のものにしてください。

init.go 869B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package faketls
  2. import (
  3. "bytes"
  4. "errors"
  5. )
  6. const (
  7. RandomLen = 32
  8. ClientHelloRandomOffset = 6
  9. ClientHelloSessionIDOffset = ClientHelloRandomOffset + RandomLen
  10. ClientHelloMinLen = 4
  11. WelcomePacketRandomOffset = 11
  12. HandshakeTypeClient = 0x01
  13. HandshakeTypeServer = 0x02
  14. ChangeCipherValue = 0x01
  15. ExtensionSNI = 0x00
  16. )
  17. var (
  18. ErrBadDigest = errors.New("bad digest")
  19. ErrAntiReplayAttack = errors.New("antireplay attack was detected")
  20. serverHelloSuffix = []byte{
  21. 0x00, // no compression
  22. 0x00, 0x2e, // 46 bytes of data
  23. 0x00, 0x2b, // Extension - Supported Versions
  24. 0x00, 0x02, // 2 bytes are following
  25. 0x03, 0x04, // TLS 1.3
  26. 0x00, 0x33, // Extension - Key Share
  27. 0x00, 0x24, // 36 bytes
  28. 0x00, 0x1d, // x25519 curve
  29. 0x00, 0x20, // 32 bytes of key
  30. }
  31. clientHelloEmptyRandom = bytes.Repeat([]byte{0}, RandomLen)
  32. )