keys

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileWatcher

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

FileWatcher watches a file for key updates.

func NewFileWatcher

func NewFileWatcher(path string, opts ...FileWatcherOpt) *FileWatcher

func (*FileWatcher) StartWatching

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

func (*FileWatcher) StopWatching

func (w *FileWatcher) StopWatching()

type FileWatcherOpt

type FileWatcherOpt func(*FileWatcher)

func WithFileWatcherCtx

func WithFileWatcherCtx(ctx context.Context) FileWatcherOpt

type Keys

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

func LoadKeysFromFile

func LoadKeysFromFile(path string, watcherOpts ...FileWatcherOpt) (*Keys, error)

func LoadKeysFromURL

func LoadKeysFromURL(url string, watcherOpts ...URLWatcherOpt) (*Keys, error)

func (*Keys) APIKey

func (k *Keys) APIKey() string

func (*Keys) HasWatcher

func (k *Keys) HasWatcher() bool

func (*Keys) ProsopoIntegrityToken

func (k *Keys) ProsopoIntegrityToken() string

func (*Keys) ProsopoSiteKey

func (k *Keys) ProsopoSiteKey() string

func (*Keys) SetWatcher

func (k *Keys) SetWatcher(watcher Watcher)

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 URLWatcher

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

URLWatcher watches a URL for key updates by polling at a regular interval.

func NewURLWatcher

func NewURLWatcher(url string, opts ...URLWatcherOpt) *URLWatcher

func (*URLWatcher) StartWatching

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

func (*URLWatcher) StopWatching

func (w *URLWatcher) StopWatching()

type URLWatcherOpt

type URLWatcherOpt func(*URLWatcher)

func WithURLWatcherCtx

func WithURLWatcherCtx(ctx context.Context) URLWatcherOpt

func WithURLWatcherHTTPClient

func WithURLWatcherHTTPClient(client *http.Client) URLWatcherOpt

func WithURLWatcherPollInterval

func WithURLWatcherPollInterval(d time.Duration) URLWatcherOpt

type Watcher

type Watcher interface {
	StartWatching(k *Keys) error
	StopWatching()
}

Watcher watches a keys source for updates.

Jump to

Keyboard shortcuts

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