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.

generate_secret.go 570B

1234567891011121314151617181920212223242526
  1. package cli
  2. import (
  3. "fmt"
  4. "github.com/9seconds/mtg/v2/mtglib"
  5. )
  6. type GenerateSecret struct {
  7. base `kong:"-"`
  8. HostName string `kong:"arg,required,help='Hostname to use for domain fronting.',name='hostname'"`
  9. Hex bool `kong:"help='Print secret in hex encoding.',short='x'"`
  10. }
  11. func (c *GenerateSecret) Run(cli *CLI, _ string) error {
  12. secret := mtglib.GenerateSecret(cli.GenerateSecret.HostName)
  13. if cli.GenerateSecret.Hex {
  14. fmt.Println(secret.Hex()) // nolint: forbidigo
  15. } else {
  16. fmt.Println(secret.Base64()) // nolint: forbidigo
  17. }
  18. return nil
  19. }