certinel

package
v0.0.0-...-d74d999 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoPeerCertificate = errors.New("peer did not present certificate for domain")
	ErrExpired           = errors.New("certificate expired")
	ErrNotYetValid       = errors.New("certificate not yet valid")
	ErrInvalidHostname   = errors.New("invalid hostname")
	ErrNoCertificate     = errors.New("certificate serial not found")
)
View Source
var (
	ErrInvalidArgument = errors.New("invalid argument")
	IndexHtml          string
)
View Source
var (
	ErrNoBucket      = errors.New("no bucket given")
	ErrInvalidBucket = errors.New("no bucket found with given name")
)

Functions

func AddMetricPoint

func AddMetricPoint(domain, port string, validity float64, e error)

func CheckDomain

func CheckDomain(domain, port string)

func ReverseHost

func ReverseHost(hostname string) (string, error)

reverse a hostname (example.com => com.example.). This will provide a better form for sorting (www.example.com and api.example.com will be close together when reversed)

func StartAPIServer

func StartAPIServer(port, indexHtml string)

func StartDomainChecker

func StartDomainChecker()

func StartMetricsServer

func StartMetricsServer(mtype, maddress string)

func StoreInit

func StoreInit(path string) error

create a new Store and initialize it

Types

type Certificate

type Certificate struct {
	NotBefore      time.Time         `json:"not_before"`
	NotAfter       time.Time         `json:"not_after"`
	Issuer         Subject           `json:"issuer"`
	Subject        Subject           `json:"subject"`
	SerialNumber   string            `json:"serial"`
	AlternateNames []string          `json:"alternate_names,omitempty"`
	Signature      Signature         `json:"signature"`
	Fingerprints   map[string]string `json:"fingerprints"`
}

type Domain

type Domain struct {
	Domain string `json:"domain"`
	Port   string `json:"port"`
	// contains filtered or unexported fields
}

func GetDomains

func GetDomains() []*Domain

func (*Domain) CertList

func (d *Domain) CertList() (*Certificate, []*Certificate, error)

func (*Domain) Check

func (d *Domain) Check() error

func (*Domain) Delete

func (d *Domain) Delete() error

func (*Domain) GetCertificate

func (d *Domain) GetCertificate() (*x509.Certificate, error)

func (*Domain) LoadCertificate

func (d *Domain) LoadCertificate(serial string) (*Certificate, error)

func (*Domain) Status

func (d *Domain) Status() (*Status, error)

func (*Domain) Store

func (d *Domain) Store(status *Status) error

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

KeyValue represents a key-value pair from the underlying key-value store

type MetricProvider

type MetricProvider interface {
	AddMetric(domain, port string, validity float64)
	AddMetricError(domain, port string, e error)
	GetRouter() *mux.Router
}

type Signature

type Signature struct {
	Algorithm int    `json:"algorithm"`
	Value     string `json:"value"`
}

type Status

type Status struct {
	Duration int64  `json:"check_duration"`
	Valid    bool   `json:"valid"`
	Err      string `json:"last_error"`
	Time     string `json:"last_check"`
	Validity int    `json:"valid_days"`
}

type Store

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

Store provides a structured way to load data from an underlying database (i.e. key-value store)

func GetStore

func GetStore() *Store

func (*Store) BucketExists

func (store *Store) BucketExists(bucket []string) bool

check if a bucket exists

func (*Store) Buckets

func (store *Store) Buckets(prefix string) (<-chan *KeyValue, error)

get a list of all buckets, starting with a given prefix

func (*Store) Close

func (store *Store) Close()

close all connections to the underlying database file to be used by another process

func (*Store) Create

func (store *Store) Create(bucket []string) (err error)

create a new bucket

func (*Store) Delete

func (store *Store) Delete(bucket []string, key string) error

delete a key from the specified bucket

func (*Store) Get

func (store *Store) Get(bucket []string, key string) (value string, err error)

get the content of a key from the specified bucket

func (*Store) Remove

func (store *Store) Remove(parent []string, bucket string) (err error)

delete a bucket

func (*Store) Scan

func (store *Store) Scan(bucket []string, prefix string, reverse bool, limit int) <-chan *KeyValue

get the content of a key that acts as a prefix from the specified bucket. this func will return immediately and return a channel from which you can get a KeyValue object. if the end is reached, the channel will return nil. Note that this method does not return an error it will just immediately put nil into the channel if something happened.

func (*Store) Set

func (store *Store) Set(bucket []string, key, value string) error

set a key to the specified value. you need also to specify the bucket you want to write this key-value pair into.

type Subject

type Subject struct {
	CommonName         string   `json:"cn"`
	Country            []string `json:"c,omitempty"`
	Organization       []string `json:"o,omitempty"`
	OrganizationalUnit []string `json:"ou,omitempty"`
}

Jump to

Keyboard shortcuts

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