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

@ -30,20 +30,9 @@ package tlsx
//go:generate go run generate.go "{{ .URL }}"
import "crypto/x509"
const pemcerts string = ` + "`" + `
{{ .Bundle }}
` + "`" + `
// CACerts builds an X.509 certificate pool containing the
// certificate bundle from {{ .URL }} fetch on {{ .Timestamp }}.
// 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
}
`))
func main() {