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个字符

12345678910111213141516171819202122232425262728293031323334353637
  1. package files
  2. import (
  3. "context"
  4. "io"
  5. "net"
  6. "strings"
  7. )
  8. type memFile struct {
  9. data string
  10. }
  11. func (m memFile) Open(ctx context.Context) (io.ReadCloser, error) {
  12. return io.NopCloser(strings.NewReader(m.data)), nil
  13. }
  14. func (m memFile) String() string {
  15. return "mem"
  16. }
  17. func NewMem(networks []*net.IPNet) File {
  18. builder := strings.Builder{}
  19. if len(networks) > 0 {
  20. builder.WriteString(networks[0].String())
  21. }
  22. for i := 1; i < len(networks); i++ {
  23. builder.WriteString("\n")
  24. builder.WriteString(networks[i].String())
  25. }
  26. return memFile{
  27. data: builder.String(),
  28. }
  29. }