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
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

main.go 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // mtg is just a command-line application that starts a proxy.
  2. //
  3. // Application logic is how to read a config and configure mtglib.Proxy.
  4. // So, probably you need to read the documentation for mtglib package
  5. // first.
  6. //
  7. // mtglib is a core of the application. The rest of the packages provide
  8. // some default implementations for the interfaces, defined in mtglib.
  9. package main
  10. import (
  11. "github.com/dolonet/mtg-multi/internal/cli"
  12. "github.com/alecthomas/kong"
  13. )
  14. func main() {
  15. // this runs profiling server. To enable it, build with prof tag
  16. // $ go build -tags prof
  17. //
  18. // Then you can pass a port using MTG_PROF_PORT environment variable.
  19. // Default is 6000
  20. // $ MTG_PROF_PORT=6000 mtg run config.toml
  21. //
  22. // It will run a webserver with profiling data on
  23. // localhost:${MTG_PROF_PORT:-6000}.
  24. //
  25. // To collect PGO do following:
  26. // $ curl -o default.pgo 'http://localhost:6000/debug/pprof/profile?seconds=300'
  27. //
  28. // See also https://pkg.go.dev/net/http/pprof
  29. // https://go.dev/blog/pprof
  30. runProfile()
  31. cli := &cli.CLI{}
  32. ctx := kong.Parse(cli, kong.Vars{
  33. "version": getVersion(),
  34. })
  35. ctx.FatalIfErrorf(ctx.Run(cli, version))
  36. }