utils

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IssuerTypeACME is the issuer type ACME
	IssuerTypeACME = "acme"
	// IssuerTypeCA is the issuer type CA
	IssuerTypeCA = "ca"
)

Variables

This section is empty.

Functions

func AssureStringArray

func AssureStringArray(mod *abstract.ModificationState, dst *[]string, value []string)

AssureStringArray handles modification of a string array.

func BestDomainRange added in v0.12.0

func BestDomainRange(domain string, domainRanges []string) string

BestDomainRange returns best fitting domain range value or "".

func CheckDNSPropagation added in v0.2.14

func CheckDNSPropagation(nameservers []string, fqdn string, values ...string) (bool, error)

CheckDNSPropagation checks if the expected TXT record has been propagated to all authoritative nameservers.

func CreateWrapPreCheckOption added in v0.2.14

func CreateWrapPreCheckOption(nameservers []string) dns01.ChallengeOption

CreateWrapPreCheckOption creates lego DNS ChallengeOption for custom Precheck function, checking the DNS propagation of the DNS challenge TXT record.

func EqualStringArray

func EqualStringArray(a, b []string) bool

EqualStringArray compares string arrays.

func ExtractCommonNameAnDNSNames added in v0.12.0

func ExtractCommonNameAnDNSNames(csr []byte) (cn *string, san []string, err error)

ExtractCommonNameAnDNSNames extracts values from a CSR (Certificate Signing Request).

func ExtractDomains added in v0.12.0

func ExtractDomains(spec *api.CertificateSpec) ([]string, error)

ExtractDomains collects CommonName and DNSNames directly from spec or from CSR. The first item is the common name if provided.

func FollowCNAMEs added in v0.12.0

func FollowCNAMEs(fqdn string, nameservers []string, fqdnChain ...string) (string, error)

FollowCNAMEs follows the CNAME records and returns the last non-CNAME fully qualified domain name that it finds. Returns an error when a loop is found in the CNAME chain. The argument fqdnChain is used by the function itself to keep track of which fqdns it already encountered and detect loops. Method copied from https://github.com/cert-manager/cert-manager/pkg/issuer/acme/dns/util/wait.go

func IsInDomainRange

func IsInDomainRange(domain, domainRange string) bool

IsInDomainRange returns true if domain is in domain range.

func IsInDomainRanges

func IsInDomainRanges(domain string, domainRanges []string) bool

IsInDomainRanges returns true if domain is in domain ranges.

func NoPropagationCheckOption added in v0.12.0

func NoPropagationCheckOption() dns01.ChallengeOption

NoPropagationCheckOption creates lego DNS ChallengeOption for custom Precheck function, performing no DNS propagation check of the DNS challenge TXT record at all.

func NormalizeDomainRange

func NormalizeDomainRange(domainRange string) string

NormalizeDomainRange normalizes domain to lower case, drops wildcard and suffix dot.

func PreparePrecheckNameservers added in v0.2.14

func PreparePrecheckNameservers(nameservers []string) []string

PreparePrecheckNameservers collects the nameservers for checking DNS propagation. If no nameservers are provided, it tries to read them from `/etc/resolv.conf`, and last resort is to use Google public DNS servers (8.8.8.8 and 8.8.4.4)

Types

type CertificateObject

type CertificateObject struct {
	resources.Object
}

CertificateObject encapsulates the certificate resource object.

func Certificate

func Certificate(o resources.Object) *CertificateObject

Certificate returns the certificate object

func (*CertificateObject) Certificate

func (o *CertificateObject) Certificate() *api.Certificate

Certificate casts the object to certificate.

func (*CertificateObject) SafeFirstDNSName added in v0.12.0

func (o *CertificateObject) SafeFirstDNSName() string

SafeFirstDNSName returns the first DNS name (common name if set) or "".

func (*CertificateObject) Spec

Spec returns the certificate spec

func (*CertificateObject) Status

Status returns the certificate status

type Cluster added in v0.12.0

type Cluster int

Cluster is an enum for default and target cluster

const (
	// ClusterDefault is the default cluster
	ClusterDefault Cluster = iota
	// ClusterTarget is the target cluster
	ClusterTarget
)

type IssuerInfo added in v0.12.0

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

IssuerInfo provides name and type of an issuer

func NewACMEIssuerInfo added in v0.12.0

func NewACMEIssuerInfo(key IssuerKey) IssuerInfo

NewACMEIssuerInfo creates info for an ACME issuer

func NewCAIssuerInfo added in v0.12.0

func NewCAIssuerInfo(key IssuerKey) IssuerInfo

NewCAIssuerInfo creates info for an CA issuer

func (*IssuerInfo) IssuerType added in v0.12.0

func (i *IssuerInfo) IssuerType() string

IssuerType returns the issuer type

func (*IssuerInfo) Key added in v0.12.0

func (i *IssuerInfo) Key() IssuerKey

Key returns the issuer key

type IssuerKey added in v0.12.0

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

IssuerKey provides cluster, name and namespace of an issuer

func NewDefaultClusterIssuerKey added in v0.12.0

func NewDefaultClusterIssuerKey(name string) IssuerKey

NewDefaultClusterIssuerKey creates key for an issuer on the default cluster

func NewIssuerKey added in v0.12.0

func NewIssuerKey(cluster Cluster, namespace, name string) IssuerKey

NewIssuerKey creates key for an issuer. namespace is ignored for default cluster

func (IssuerKey) Cluster added in v0.12.0

func (k IssuerKey) Cluster() Cluster

Cluster returns the issuer cluster

func (IssuerKey) ClusterName added in v0.12.0

func (k IssuerKey) ClusterName() string

ClusterName returns the cluster name

func (IssuerKey) Name added in v0.12.0

func (k IssuerKey) Name() string

Name returns the issuer name

func (IssuerKey) Namespace added in v0.12.0

func (k IssuerKey) Namespace() string

Namespace returns the issuer namespace (namespace is empty if it is on default cluster)

func (IssuerKey) NamespaceOrDefault added in v0.12.0

func (k IssuerKey) NamespaceOrDefault(def string) string

NamespaceOrDefault returns the issuer namespace or the given default if it is on default cluster

func (IssuerKey) ObjectName added in v0.12.0

func (k IssuerKey) ObjectName(def string) resources.ObjectName

ObjectName returns the object name for the issuer key. If it is on the default cluster, the given namespace is used.

func (IssuerKey) String added in v0.12.0

func (k IssuerKey) String() string

String returns the string representation

type IssuerKeySet added in v0.12.0

type IssuerKeySet map[IssuerKey]struct{}

IssuerKeySet is a set of IssuerKeys

func NewIssuerKeySet added in v0.12.0

func NewIssuerKeySet(keys ...IssuerKey) IssuerKeySet

NewIssuerKeySet creates a new set

func (IssuerKeySet) Add added in v0.12.0

func (s IssuerKeySet) Add(keys ...IssuerKey)

Add adds keys to the set

func (IssuerKeySet) Contains added in v0.12.0

func (s IssuerKeySet) Contains(key IssuerKey) bool

Contains checks if set contains the key

func (IssuerKeySet) Copy added in v0.12.0

func (s IssuerKeySet) Copy() IssuerKeySet

Copy creates a copy of the set

func (IssuerKeySet) Remove added in v0.12.0

func (s IssuerKeySet) Remove(key IssuerKey)

Remove removes a key from the set

type IssuerObject

type IssuerObject struct {
	resources.Object
}

IssuerObject encapsulates the issuer resource object.

func Issuer

func Issuer(o resources.Object) *IssuerObject

Issuer returns the issuer object.

func (*IssuerObject) Issuer

func (o *IssuerObject) Issuer() *api.Issuer

Issuer returns the issuer.

func (*IssuerObject) Spec

func (o *IssuerObject) Spec() *api.IssuerSpec

Spec returns the issuer resource object spec.

func (*IssuerObject) Status

func (o *IssuerObject) Status() *api.IssuerStatus

Status returns the issuer resource object status.

type IssuerSecretKey added in v0.12.0

type IssuerSecretKey struct {
	IssuerKey
}

IssuerSecretKey is the key for an issuer secret

func NewIssuerSecretKey added in v0.12.0

func NewIssuerSecretKey(cluster Cluster, namespace, name string) IssuerSecretKey

NewIssuerSecretKey creates key for an issuer secret. namespace is ignored for default cluster

Jump to

Keyboard shortcuts

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