/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
go/updater/keybase/https.go
37 строк
874 B
zoom-ua
enable gosec (#28775)
08 янв 2026, 19:26
Не верифицирован
08 янв 2026, 19:26
5670f73
Код
Авторство
О чём код?
// Copyright 2015 Keybase, Inc. All rights reserved. Use of // this source code is governed by the included BSD license. package keybase import ( "crypto/tls" "crypto/x509" "fmt" "net/http" "time" "github.com/keybase/client/go/libkb" ) func httpClient(timeout time.Duration) (*http.Client, error) { return httpClientWithCert(libkb.APICA, timeout) } func httpClientWithCert(cert string, timeout time.Duration) (*http.Client, error) { certPool := x509.NewCertPool() if ok := certPool.AppendCertsFromPEM([]byte(cert)); !ok { return nil, fmt.Errorf("Unable to add cert") } if certPool == nil { return nil, fmt.Errorf("No cert pool") } tlsConfig := &tls.Config{ RootCAs: certPool, MinVersion: tls.VersionTLS12, } transport := &http.Transport{TLSClientConfig: tlsConfig} return &http.Client{ Transport: transport, Timeout: timeout, }, nil }