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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. [tools]
  2. go = "latest"
  3. "go:golang.org/x/tools/gopls" = "latest"
  4. "go:mvdan.cc/gofumpt" = "latest"
  5. [vars]
  6. fuzzflags = "-fuzztime=120s"
  7. [tasks.build]
  8. description = "Build binary"
  9. sources = ["**/*.go", "go.mod", "go.sum"]
  10. outputs = ["mtg"]
  11. run = "go build"
  12. [tasks.update]
  13. description = "Update dependencies"
  14. run = [
  15. "go get -u",
  16. "go mod tidy -go=1.25"
  17. ]
  18. [tasks.lint]
  19. description = "Run linter"
  20. tools.golangci-lint = "latest"
  21. run = "golangci-lint run"
  22. [tasks.test]
  23. description = "Run tests"
  24. run = "go test -v ./..."
  25. [tasks.covtest]
  26. description = "Run tests with code coverage"
  27. run = "go test -coverprofile=coverage.txt -covermode=atomic -parallel 2 -race -v ./..."
  28. [tasks.test-all]
  29. description = "Run all tests"
  30. depends = [
  31. "test",
  32. "test:fuzz:*"
  33. ]
  34. [tasks."test:fuzz:client-hello"]
  35. description = "Run fuzzy test for ClientHello"
  36. run = "go test -v {{ vars.fuzzflags }} -fuzz=FuzzClientHello ./mtglib/internal/faketls"
  37. [tasks."test:fuzz:client-handshake"]
  38. description = "Run fuzzy test for ClientHandshake"
  39. run = "go test -v {{ vars.fuzzflags }} -fuzz=FuzzClientHandshake ./mtglib/internal/obfuscated2"
  40. [tasks."test:fuzz:server-generate-handshake-frame"]
  41. description = "Run fuzzy test for ServerGenerateHandshakeFrame"
  42. run = "go test -v {{ vars.fuzzflags }} -fuzz=FuzzServerGenerateHandshakeFrame ./mtglib/internal/obfuscated2"
  43. [tasks."test:fuzz:server-receive"]
  44. description = "Run fuzzy test for ServerReceive"
  45. run = "go test -v {{ vars.fuzzflags }} -fuzz=FuzzServerReceive ./mtglib/internal/obfuscated2"
  46. [tasks."test:fuzz:server-send"]
  47. description = "Run fuzzy test for ServerSend"
  48. run = "go test -v {{ vars.fuzzflags }} -fuzz=FuzzServerSend ./mtglib/internal/obfuscated2"
  49. [tasks.static]
  50. description = "Build static binary"
  51. sources = ["**/*.go", "go.mod", "go.sum"]
  52. outputs = ["mtg"]
  53. run = """
  54. #!/bin/bash
  55. version="$(git describe --exact-match HEAD 2>/dev/null || git describe --tags --always)"
  56. go build \
  57. -trimpath \
  58. -mod=readonly \
  59. -ldflags="-extldflags '-static' -s -w -X 'main.version=$version'" \
  60. -a \
  61. -tags netgo
  62. """
  63. [tasks.release]
  64. description = "Create release tarballs"
  65. tools.goreleaser = "latest"
  66. sources = ["**/*.go", "go.mod", "go.sum", ".goreleaser.yml"]
  67. run = [
  68. "goreleaser --snapshot --clean",
  69. "find dist -depth 1 -type d | xargs -r rm -r",
  70. "rm ./dist/config.yaml"
  71. ]
  72. [tasks.image]
  73. description = "Build docker image"
  74. sources = ["**/*.go", "go.mod", "go.sum", "Dockerfile"]
  75. run = "docker buildx build --pull -t mtg ."
  76. [tasks.docs]
  77. description = "Run doc server"
  78. tools."go:golang.org/x/pkgsite/cmd/pkgsite" = "latest"
  79. run = "pkgsite -http 0.0.0.0:10000"
  80. [tasks.fmt]
  81. description = "Reformat source code"
  82. sources = ["**/*.go"]
  83. run = "gofumpt -w --extra ."