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 801B

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