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:
parent
0317420398
commit
c553afdbd5
6 changed files with 120 additions and 119 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue