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
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

main.go 514B

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/network"
  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, _ := network.NewDefaultDialer(0, 0)
  16. d, _ := network.NewNetwork(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. }