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.

main.go 518B

12345678910111213141516171819202122232425262728293031
  1. package main
  2. import (
  3. "fmt"
  4. "io/ioutil"
  5. "math/rand"
  6. "os"
  7. "time"
  8. "github.com/9seconds/mtg/v2/mtglib/dialers"
  9. )
  10. var version = "dev" // has to be set by ldflags
  11. func main() {
  12. rand.Seed(time.Now().UTC().UnixNano())
  13. f, _ := os.Open("example.config.toml")
  14. fmt.Println(parseRawConfig(f))
  15. bd, _ := dialers.NewDefaultBaseDialer(0, 0)
  16. d, _ := dialers.MakeDialer(bd, "9.9.9.9", 0)
  17. r, err := d.HTTP.Get("https://ifconfig.co")
  18. fmt.Println(err)
  19. body, _ := ioutil.ReadAll(r.Body)
  20. fmt.Println(string(body))
  21. }