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.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package main
  2. import (
  3. "math/rand"
  4. "time"
  5. "github.com/alecthomas/kong"
  6. )
  7. var version = "dev" // has to be set by ldflags
  8. type CLI struct {
  9. GenerateSecret struct {
  10. HostName string `arg optional help:"Hostname to use for domain fronting. Default is '${domain_front}'." name:"hostname" default:"${domain_front}"`
  11. Hex bool `help:"Print secret in hex encoding."`
  12. } `cmd help:"Generate new proxy secret."`
  13. Access struct {
  14. ConfigPath string `arg required type:"existingfile" help:"Path to the configuration file." name:"config-path"`
  15. } `cmd help:"Print access information."`
  16. Run struct {
  17. ConfigPath string `arg required type:"existingfile" help:"Path to the configuration file." name:"config-path"`
  18. } `cmd help:"Run proxy."`
  19. }
  20. func main() {
  21. rand.Seed(time.Now().UTC().UnixNano())
  22. cli := &CLI{}
  23. ctx := kong.Parse(cli, kong.Vars{
  24. "domain_front": "amazonaws.com",
  25. "config_path": "/etc/mtg.toml",
  26. })
  27. switch ctx.Command() {
  28. case "generate-secret":
  29. runGenerateSecret(cli)
  30. case "access":
  31. case "run":
  32. panic("not implemented yet")
  33. }
  34. }