trust

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2021 License: MIT Imports: 3 Imported by: 7

README

Trust

GitHub Workflow Status (branch) Go Reportcard go.dev reference License Release

Trust is an in memory CA Pool for use in scratch containers.

Versioning

The project will be versioned in accordance with Semver 2.0.0. See the releases section for the latest version. Until version 1.0.0 the project is considered to be unstable.

It is always highly recommended to vendor the version you are using.

License

See LICENSE.md for more information.

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

Pool is a representation of a CA Cert Pool that can have multiple items appended into it

func New

func New() *Pool

New returns a newly initialized CA Pool that can then have additional actions performed on it

Example
package main

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

	"github.com/gomicro/trust"
)

var client *http.Client

func main() {
	pool := trust.New()

	certs, err := pool.CACerts()
	if err != nil {
		panic(err)
	}

	client = &http.Client{
		Transport: &http.Transport{
			TLSClientConfig: &tls.Config{RootCAs: certs},
		},
	}
}

func (*Pool) AddCAFile

func (p *Pool) AddCAFile(files ...string)

AddCAFile adds the specified files to the list of CA files which will be appended to the resulting pool

func (*Pool) CACerts

func (p *Pool) CACerts() (*x509.CertPool, error)

CACerts builds an X.509 certificate pool containing the Mozilla CA Certificate bundle. Returns nil on error along with an appropriate error code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL