L
L
LamerFromSpace2019-06-14 20:15:46
go
LamerFromSpace, 2019-06-14 20:15:46

How to get a certificate and send a Go GET request to the Telegram API?

I generated a certificate via openSSL, I'm trying like this:

CA_Pool := x509.NewCertPool()
  severCert, err := ioutil.ReadFile("./Jsr.pem")
  if err != nil {
    fmt.Println(err)
    return
  }

  CA_Pool.AppendCertsFromPEM(severCert)

  tlsConfig := &tls.Config{
    InsecureSkipVerify: true,
    RootCAs:            CA_Pool,
  }

  client = http.Client{
    Timeout: time.Second * 30,
    Transport: &http.Transport{
      TLSClientConfig: tlsConfig,
    },
  }

  resp, err := client.Get("https://api.telegram.org/botXXX/getMe")
  if err != nil {
    fmt.Println(err)
    return
  }

Each time in the response body nil

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Shitskov, 2019-06-14
@LamerFromSpace

how to bypass it?

Well, the first thing that suggests itself is to use a proxy.
HTTP or SOCKS .
Or choose a server outside the Russian Federation. Well, or wrap the traffic in a VPN on the server where the bot will be deployed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question