func (m CertParseFailMatcher) Matches(leaf *ct.LeafEntry) bool {
	_, err := ct.LogEntryFromLeaf(1, leaf)
	if err != nil {
		if x509.IsFatal(err) {
			return true
		}
		return m.MatchNonFatalErrs
	}
	return false
}
Matches returns true for parse errors.
package scanner
import (
	"context"
	"log"
	"math/big"
	"regexp"
	"time"
	ct "github.com/google/certificate-transparency-go"
	"github.com/google/certificate-transparency-go/asn1"
	"github.com/google/certificate-transparency-go/client"
	"github.com/google/certificate-transparency-go/x509"
)
type Matcher interface {
	CertificateMatches(*x509.Certificate) bool
	PrecertificateMatches(*ct.Precertificate) bool
}
type MatchAll struct{}
func (m MatchAll) CertificateMatches(_ *x509.Certificate) bool {
	return true
}
func (m MatchAll) PrecertificateMatches(_ *ct.Precertificate) bool {
	return true
}
type MatchNone struct{}
func (m MatchNone) CertificateMatches(_ *x509.Certificate) bool {
	return false
}
func (m MatchNone) PrecertificateMatches(_ *ct.Precertificate) bool {
	return false
}
type MatchSerialNumber struct {
	SerialNumber big.Int
}
func (m MatchSerialNumber) CertificateMatches(c *x509.Certificate) bool {
	return c.SerialNumber.String() == m.SerialNumber.String()
}
func (m MatchSerialNumber) PrecertificateMatches(p *ct.Precertificate) bool {
	return p.TBSCertificate.SerialNumber.String() == m.SerialNumber.String()
}
type MatchSubjectRegex struct {
	CertificateSubjectRegex    *regexp.Regexp
	PrecertificateSubjectRegex *regexp.Regexp
}
func (m MatchSubjectRegex) CertificateMatches(c *x509.Certificate) bool {
	if m.CertificateSubjectRegex.FindStringIndex(c.Subject.CommonName) != nil {
		return true
	}
	for _, alt := range c.DNSNames {
		if m.CertificateSubjectRegex.FindStringIndex(alt) != nil {
			return true
		}
	}
	return false
}
func (m MatchSubjectRegex) PrecertificateMatches(p *ct.Precertificate) bool {
	if m.PrecertificateSubjectRegex.FindStringIndex(p.TBSCertificate.Subject.CommonName) != nil {
		return true
	}
	for _, alt := range p.TBSCertificate.DNSNames {
		if m.PrecertificateSubjectRegex.FindStringIndex(alt) != nil {
			return true
		}
	}
	return false
}
type MatchIssuerRegex struct {
	CertificateIssuerRegex    *regexp.Regexp
	PrecertificateIssuerRegex *regexp.Regexp
}
func (m MatchIssuerRegex) CertificateMatches(c *x509.Certificate) bool {
	return m.CertificateIssuerRegex.FindStringIndex(c.Issuer.CommonName) != nil
}
func (m MatchIssuerRegex) PrecertificateMatches(p *ct.Precertificate) bool {
	return m.PrecertificateIssuerRegex.FindStringIndex(p.TBSCertificate.Issuer.CommonName) != nil
}
type MatchSCTTimestamp struct {
	Timestamp uint64
}
func (m MatchSCTTimestamp) Matches(leaf *ct.LeafEntry) bool {
	entry, _ := ct.LogEntryFromLeaf(1, leaf)
	if entry == nil {
		return false
	}
	return entry.Leaf.TimestampedEntry.Timestamp == m.Timestamp
}
type LeafMatcher interface {
	Matches(*ct.LeafEntry) bool
}
type CertParseFailMatcher struct {
	MatchNonFatalErrs bool
}