Documentation
¶
Index ¶
- type FileSource
- type FileSourceOpt
- type Keys
- func (k *Keys) APIKey() string
- func (k *Keys) HasSource() bool
- func (k *Keys) IsWatching() bool
- func (k *Keys) Load() error
- func (k *Keys) ProsopoIntegrityToken() string
- func (k *Keys) ProsopoSiteKey() string
- func (k *Keys) SetSource(source Source) error
- func (k *Keys) StartWatching() error
- func (k *Keys) StopWatching()
- func (k *Keys) Update(apiKey, userAgent, prosopoSiteKey, prosopoIntegrityToken *string)
- func (k *Keys) UpdateFromJSON(keysJson []byte) error
- func (k *Keys) UserAgent() string
- type Source
- type URLSource
- type URLSourceOpt
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 (*Keys) IsWatching ¶ added in v0.9.0
func (*Keys) ProsopoIntegrityToken ¶
func (*Keys) ProsopoSiteKey ¶
func (*Keys) SetSource ¶ added in v0.9.0
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 (*Keys) StopWatching ¶
func (k *Keys) StopWatching()
func (*Keys) UpdateFromJSON ¶
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 (*URLSource) Load ¶ added in v0.9.0
Load loads the current keys from the URL and updates the keys.
func (*URLSource) StartWatching ¶ added in v0.9.0
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
Click to show internal directories.
Click to hide internal directories.