refactor(netx): start moving tls-specific code inside the tlsx pkg (#363)

* refactor(netx): move cert pool code inside tlsx

* refactor(netx): move more tls code inside tlsx
This commit is contained in:
Simone Basso 2021-06-08 15:39:25 +02:00 committed by GitHub
commit c553afdbd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 120 additions and 119 deletions

View file

@ -1,13 +1,11 @@
// Code generated by go generate; DO NOT EDIT.
// 2021-06-08 13:03:08.852763 +0200 CEST m=+2.563240667
// 2021-06-08 14:36:18.474117 +0200 CEST m=+0.459588210
// https://curl.haxx.se/ca/cacert.pem
package tlsx
//go:generate go run generate.go "https://curl.haxx.se/ca/cacert.pem"
import "crypto/x509"
const pemcerts string = `
##
## Bundle of CA Root Certificates
@ -3149,12 +3147,3 @@ CAezNIm8BZ/3Hobui3A=
-----END CERTIFICATE-----
`
// CACerts builds an X.509 certificate pool containing the
// certificate bundle from https://curl.haxx.se/ca/cacert.pem fetch on 2021-06-08 13:03:08.852763 +0200 CEST m=+2.563240667.
// Returns nil on error along with an appropriate error code.
func CACerts() (*x509.CertPool, error) {
pool := x509.NewCertPool()
pool.AppendCertsFromPEM([]byte(pemcerts))
return pool, nil
}