fetch

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: Apache-2.0, BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCertificate

func GetCertificate(spec string, cfg *tls.Config) (*x509.Certificate, error)

GetCertificate fetches the first certificate from a certificate chain.

func GetCertificateChain

func GetCertificateChain(spec string, cfg *tls.Config) ([]*x509.Certificate, error)

GetCertificateChain fetches a certificate chain from a remote source. If cfg is non-nil and spec refers to a TLS server, the provided TLS configuration will be used to control verification behavior (e.g., InsecureSkipVerify, RootCAs).

Types

type Fetcher

type Fetcher interface {
	// Get retrieves the leaf certificate from the source.
	Get() (*x509.Certificate, error)

	// GetChain retrieves the entire chain from the Fetcher.
	GetChain() ([]*x509.Certificate, error)

	// String returns a string representation of the Fetcher.
	String() string
}

Fetcher is an interface for fetching certificates from a remote source. It currently supports fetching from a server or a file.

func NewFetcher added in v1.16.0

func NewFetcher(spec string, tcfg *tls.Config) (Fetcher, error)

type FileFetcher

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

FileFetcher retrieves certificates from files on disk.

func NewFileFetcher

func NewFileFetcher(path string) *FileFetcher

func (*FileFetcher) Get

func (ff *FileFetcher) Get() (*x509.Certificate, error)

func (*FileFetcher) GetChain

func (ff *FileFetcher) GetChain() ([]*x509.Certificate, error)

func (*FileFetcher) String

func (ff *FileFetcher) String() string

type ServerFetcher

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

ServerFetcher retrieves certificates from a TLS connection.

func ParseServer

func ParseServer(host string, cfg *tls.Config) (*ServerFetcher, error)

ParseServer parses a server string into a ServerFetcher. It can be a URL or a a host:port pair.

func (*ServerFetcher) Get

func (sf *ServerFetcher) Get() (*x509.Certificate, error)

func (*ServerFetcher) GetChain

func (sf *ServerFetcher) GetChain() ([]*x509.Certificate, error)

func (*ServerFetcher) String

func (sf *ServerFetcher) String() string

Jump to

Keyboard shortcuts

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