keys

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileSource added in v0.9.0

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

FileSource uses a file as a key source. Watching the source will watch the file for updates.

func NewFileSource added in v0.9.0

func NewFileSource(path string, opts ...FileSourceOpt) *FileSource

func (*FileSource) IsWatching added in v0.9.0

func (w *FileSource) IsWatching() bool

func (*FileSource) Load added in v0.9.0

func (w *FileSource) Load(keys *Keys) error

func (*FileSource) StartWatching added in v0.9.0

func (w *FileSource) StartWatching(keys *Keys) error

func (*FileSource) StopWatching added in v0.9.0

func (w *FileSource) StopWatching()

type FileSourceOpt added in v0.9.0

type FileSourceOpt func(*FileSource)

func WithFileSourceCtx added in v0.9.0

func WithFileSourceCtx(ctx context.Context) FileSourceOpt

type Keys

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

func FromFile added in v0.9.0

func FromFile(path string, sourceOpts ...FileSourceOpt) (*Keys, error)

func FromURL added in v0.9.0

func FromURL(url string, sourceOpts ...URLSourceOpt) (*Keys, error)

func (*Keys) APIKey

func (k *Keys) APIKey() string

func (*Keys) HasSource added in v0.9.0

func (k *Keys) HasSource() bool

func (*Keys) IsWatching added in v0.9.0

func (k *Keys) IsWatching() bool

func (*Keys) Load added in v0.9.0

func (k *Keys) Load() error

Load reloads the keys from the current source.

func (*Keys) ProsopoIntegrityToken

func (k *Keys) ProsopoIntegrityToken() string

func (*Keys) ProsopoSiteKey

func (k *Keys) ProsopoSiteKey() string

func (*Keys) SetSource added in v0.9.0

func (k *Keys) SetSource(source Source) error

SetSource replaces the keys source. Keys are loaded from the new source immediately, and if watch is currently running, the new source will start being watched. If load fails, no changes to keys are made.

func (*Keys) StartWatching

func (k *Keys) StartWatching() error

func (*Keys) StopWatching

func (k *Keys) StopWatching()

func (*Keys) Update

func (k *Keys) Update(apiKey, userAgent, prosopoSiteKey, prosopoIntegrityToken *string)

func (*Keys) UpdateFromJSON

func (k *Keys) UpdateFromJSON(keysJson []byte) error

func (*Keys) UserAgent

func (k *Keys) UserAgent() string

type Source added in v0.9.0

type Source interface {
	Load(k *Keys) error
	StartWatching(k *Keys) error
	StopWatching()
	IsWatching() bool
}

Source is a keys source. Must be able to watch source for updates

type URLSource added in v0.9.0

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

URLSource uses a URL as a key source. Watching the source will poll the at a regular interval.

func NewURLSource added in v0.9.0

func NewURLSource(url string, opts ...URLSourceOpt) *URLSource

func (*URLSource) IsWatching added in v0.9.0

func (w *URLSource) IsWatching() bool

func (*URLSource) Load added in v0.9.0

func (w *URLSource) Load(keys *Keys) error

Load loads the current keys from the URL and updates the keys.

func (*URLSource) StartWatching added in v0.9.0

func (w *URLSource) StartWatching(keys *Keys) error

func (*URLSource) StopWatching added in v0.9.0

func (w *URLSource) StopWatching()

type URLSourceOpt added in v0.9.0

type URLSourceOpt func(*URLSource)

func WithURLSourceCtx added in v0.9.0

func WithURLSourceCtx(ctx context.Context) URLSourceOpt

func WithURLSourceHTTPClient added in v0.9.0

func WithURLSourceHTTPClient(client *http.Client) URLSourceOpt

func WithURLSourcePollInterval added in v0.9.0

func WithURLSourcePollInterval(d time.Duration) URLSourceOpt

Jump to

Keyboard shortcuts

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