server

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: Unlicense Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinAuthInterval      = 5 * time.Second
	ExpiredRetryInterval = 5 * time.Minute
)
View Source
const (
	//WorkerStateIdle means the worker is currently waiting for a task
	WorkerStateIdle = iota
	//WorkerStateRunning means the worker is currently running a task
	WorkerStateRunning
	//WorkerStateScheduling means the worker is currently scheduling a future task
	WorkerStateScheduling
)

Variables

This section is empty.

Functions

func NotifyFrom

func NotifyFrom(conf notify.Config, m *SourceManager, l *logger.Logger) error

func Start

func Start(conf Config) error

Types

type APIConfig

type APIConfig struct {
	Port    uint16 `yaml:"port"`
	LogFile string `yaml:"logfile"`
	TLS     struct {
		Cert string `yaml:"cert"`
		Key  string `yaml:"key"`
	} `yaml:"tls"`
	Auth auth.Config `yaml:"auth"`
	Dev  struct {
		Mappings map[string]string `yaml:"mappings"`
	} `yaml:"dev"`
}

type BackendConfig

type BackendConfig struct {
	Type string `yaml:"type"`
	Name string `yaml:"name"`
	//in minutes
	RefreshInterval int                    `yaml:"refresh_interval"`
	Properties      map[string]interface{} `yaml:"properties"`
}

type Cache

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

Cache stores all the certificate data.

func NewCache

func NewCache() *Cache

func (*Cache) ApplyDiff

func (c *Cache) ApplyDiff(o, n *Cache)

ApplyDiff calculates a diff between o and n, and then atomically inserts things new to "n" and deletes things from "o" that are no longer in "n".

func (*Cache) Keys

func (c *Cache) Keys() []string

Keys returns a list of all of the keys in the cache

func (*Cache) Map

func (c *Cache) Map() map[string]CacheObject

func (*Cache) Merge

func (c *Cache) Merge(key string, obj CacheObject)

func (*Cache) Read

func (c *Cache) Read(key string) (CacheObject, bool)

func (*Cache) Store

func (c *Cache) Store(key string, value CacheObject)

type CacheObject

type CacheObject struct {
	Subject  pkix.Name
	NotAfter time.Time
	Paths    []PathObject
}

type Config

type Config struct {
	Backends      []BackendConfig `yaml:"backends"`
	Server        APIConfig       `yaml:"server"`
	Notifications notify.Config   `yaml:"notifications"`
}

func ParseConfig

func ParseConfig(path string) (*Config, error)

type Core

type Core struct {
	Backend storage.Accessor
	Name    string
	// contains filtered or unexported fields
}

func (*Core) Cache

func (b *Core) Cache() *Cache

func (*Core) Populate

func (b *Core) Populate() (*PopulateStats, error)

func (*Core) SetCache

func (b *Core) SetCache(c *Cache)

type PathObject

type PathObject struct {
	Location string
	Source   string
}

func (PathObject) LessThan

func (lhs PathObject) LessThan(rhs PathObject) bool

type PopulateStats

type PopulateStats struct {
	NumPaths   int
	NumSuccess int
	NumCerts   int
}

type RunInfo

type RunInfo struct {
	LastRun     RunTiming
	LastSuccess RunTiming
	LastErr     error
}

type RunTiming

type RunTiming struct {
	StartedAt  time.Time
	FinishedAt time.Time
}

type SchedulerState

type SchedulerState struct {
	Running []SchedulerTask `json:"running"`
	Pending []SchedulerTask `json:"pending"`
	Workers []WorkerDump    `json:"workers"`
}

func (SchedulerState) String

func (s SchedulerState) String() string

type SchedulerTask

type SchedulerTask struct {
	ID       uint      `json:"id"`
	At       time.Time `json:"at"`
	Backend  string    `json:"backend"`
	Reason   string    `json:"reason"`
	Kind     string    `json:"kind"`
	State    string    `json:"state"`
	WorkerID int       `json:"worker"`
}

type Source

type Source struct {
	Core     *Core
	Interval time.Duration
	// contains filtered or unexported fields
}

func (*Source) Auth

func (s *Source) Auth(log *logger.Logger)

func (*Source) CalcNextAuth

func (s *Source) CalcNextAuth() (time.Time, bool)

CalcNextAuth returns the time of the next authentication to attempt. The second return value is true if this should never be scheduled again

func (*Source) CalcNextRefresh

func (s *Source) CalcNextRefresh() time.Time

func (*Source) Refresh

func (s *Source) Refresh(global *Cache, log *logger.Logger)

type SourceManager

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

func NewSourceManager

func NewSourceManager(sources []Source, log *logger.Logger) *SourceManager

func (*SourceManager) BackgroundScheduler

func (s *SourceManager) BackgroundScheduler() error

func (*SourceManager) Data

func (s *SourceManager) Data() doomsday.CacheItems

func (*SourceManager) RefreshAll

func (s *SourceManager) RefreshAll()

func (*SourceManager) SchedulerState

func (s *SourceManager) SchedulerState() SchedulerState

type WorkerDump

type WorkerDump struct {
	ID      uint      `json:"id"`
	State   string    `json:"state"`
	StateAt time.Time `json:"state_at"`
}

type WorkerState

type WorkerState uint

WorkerState is the current thing the worker is doing. i.e. idle vs running

func (WorkerState) String

func (w WorkerState) String() string

type YAMLKey

type YAMLKey struct {
	Path  string
	Value string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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