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
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

init.go 794B

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