client

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AllowedMimeTypesKey is the key to access the allowed mime types config
	AllowedMimeTypesKey = "allowed-mime-types"
	// ForbiddenHostnamesKey is the key to access the forbidden hostnames config
	ForbiddenHostnamesKey = "forbidden-hostnames"
	// RefreshDelayKey is the key to access the refresh delay config
	RefreshDelayKey = "refresh-delay"
	// BlackListConfigKey is the key to access the blacklist configuration
	BlackListConfigKey = "blacklist-config"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlackListConfig added in v0.11.0

type BlackListConfig struct {
	Threshold int64         `json:"threshold"`
	TTL       time.Duration `json:"ttl"`
}

BlackListConfig is the config used for hostname blacklisting

type Client

type Client interface {
	GetAllowedMimeTypes() ([]MimeType, error)
	GetForbiddenHostnames() ([]ForbiddenHostname, error)
	GetRefreshDelay() (RefreshDelay, error)
	GetBlackListConfig() (BlackListConfig, error)

	Set(key string, value interface{}) error
}

Client is a nice client interface for the ConfigAPI

func NewConfigClient

func NewConfigClient(configAPIURL string, subscriber event.Subscriber, keys []string) (Client, error)

NewConfigClient create a new client for the ConfigAPI.

type ForbiddenHostname

type ForbiddenHostname struct {
	Hostname string `json:"hostname"`
}

ForbiddenHostname is the hostnames who's crawling is forbidden

type MimeType

type MimeType struct {
	// The content-type
	ContentType string `json:"content-type"`
	// The list of associated extensions
	Extensions []string `json:"extensions"`
}

MimeType is the mime type as represented in the config

type RefreshDelay

type RefreshDelay struct {
	Delay time.Duration `json:"delay"`
}

RefreshDelay is the refresh delay for re-crawling

Jump to

Keyboard shortcuts

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