📜  golang https 停止 ssl 验证 - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:52.789000             🧑  作者: Mango

代码示例1
package main

import (
    "fmt"
    "net/http"
    "crypto/tls"
)

func main() {
    tr := &http.Transport{
        TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
    }
    client := &http.Client{Transport: tr}
    _, err := client.Get("https://golang.org/")
    if err != nil {
        fmt.Println(err)
    }
}