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 символов.

123456789101112131415161718192021222324252627282930313233
  1. package obfuscated2
  2. import (
  3. "crypto/cipher"
  4. "net"
  5. )
  6. type Conn struct {
  7. net.Conn
  8. Encryptor cipher.Stream
  9. Decryptor cipher.Stream
  10. writeBuf []byte
  11. }
  12. func (c Conn) Read(p []byte) (int, error) {
  13. n, err := c.Conn.Read(p)
  14. if err != nil {
  15. return n, err // nolint: wrapcheck
  16. }
  17. c.Decryptor.XORKeyStream(p, p[:n])
  18. return n, nil
  19. }
  20. func (c Conn) Write(p []byte) (int, error) {
  21. c.writeBuf = append(c.writeBuf[:0], p...)
  22. c.Encryptor.XORKeyStream(c.writeBuf, c.writeBuf)
  23. return c.Conn.Write(c.writeBuf)
  24. }