set

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2020 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EntryType

type EntryType string

type IssuerSerial

type IssuerSerial EntryType

IssuerSerial is an alias for a string that is formatted as "<IssuerName>,<B64 Serial>"

func NewIssuerSerial

func NewIssuerSerial(issuer *pkix.RDNSequence, serial []byte) IssuerSerial

type Record

type Record interface {
	IssuerSerial() *IssuerSerial
	SubjectKeyHash() *SubjectKeyHash
	Type() Type
}

type Set

type Set interface {
	Add(record Record)
	Contains(record Record) bool
	Iter() <-chan Record
	Union(other Set) Set
	Difference(other Set) Set
	Intersection(other Set) Set
}

type SetImpl

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

SetImpl holds a mapping of IssuerSerial -> Record and a mapping SubjectKeyHash -> Record and provides a logical, singular, view into both datasets.

For example, if you wish to find if a Record is within a SetImpl then the provided record will be asked for its type. If it is an IssuerSerialType then the issuerSerial map will be checked. If it is a SubjectKeyHashType, then the subjectKeyHash map will be checked. If it is Either then both will be checked.

Consumers of this struct SHOULD embed a *SetImpl and override the Add method if they wish to make the underlying Records homogenous.

SetImpl has a dependency injection requirement on a factory function for a specific type of Set. This is required as the set operations (Union, Difference, and Intersection) need to return a new Set

func NewDynamicSetImpl

func NewDynamicSetImpl() *SetImpl

func NewSetImpl

func NewSetImpl(setFactory func() Set) *SetImpl

func (*SetImpl) Add

func (s *SetImpl) Add(record Record)

Add will ATTEMPT to add the provided to record to the set. If the record cannot serialize itself into the appropriate type (IsserSerial:SubjectKeyHash) then it will be silent ignored. Implementors of Record SHOULD log errors this case as implementors are much closer to the data and can provide more meaningful messages than can be accomplished in this stack frame.

The reason why this is an attemp is because there are entries within staging that are junk data that result in a B64 or ASN1 decoding error. We would HOPE that "real" entries aren't going to suffer from this, however we have not way to tell which entries are test data and which are destined for production. I suppose if an entry doesn't show up on Bugzilla, but you see it logged, then we know why.

func (*SetImpl) Contains

func (s *SetImpl) Contains(record Record) bool

func (*SetImpl) Difference

func (s *SetImpl) Difference(other Set) Set

Difference returns a Set of all Records that are in self but are NOT in other. If self is homogenous then the returned Set will be homogenous and off the same type as self.

func (*SetImpl) Get

func (s *SetImpl) Get(record Record) Record

func (*SetImpl) Intersection

func (s *SetImpl) Intersection(other Set) Set

Intersection returns a Set of all Records that are both in self AND in other. If self is homogenous then the returned // Set will be homogenous and off the same type as self.

func (*SetImpl) Iter

func (s *SetImpl) Iter() <-chan Record

func (*SetImpl) Union

func (s *SetImpl) Union(other Set) Set

Union returns the unino of self and other. If self and other are homogenous and of same type, then the returned Set will also be homogenous of the same type. Otherwise the returned set will be heterogeneous.

If the Set returned by the set factory injected into this struct enforces type checking then this method will likely panic in the heterogeneous case.

type SubjectKeyHash

type SubjectKeyHash EntryType

IssuerSerial is an alias for a string that is formatted as "<SubjectName>,<B64 Key Hash>"

func NewSubjectKeyHash

func NewSubjectKeyHash(subject *pkix.RDNSequence, hash []byte) SubjectKeyHash

type Type

type Type int
const (
	IssuerSerialType Type = iota
	SubjectKeyHashType
	Either
)

func (*Type) String

func (t *Type) String() string

Jump to

Keyboard shortcuts

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