client

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 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"
	// BlackListThresholdKey is the key to access the blacklist threshold config
	BlackListThresholdKey = "blacklist-threshold"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlackListThreshold added in v0.10.0

type BlackListThreshold struct {
	Threshold int64 `json:"threshold"`
}

BlackListThreshold is the threshold to reach before blacklisting domain

type Client

type Client interface {
	GetAllowedMimeTypes() ([]MimeType, error)
	GetForbiddenHostnames() ([]ForbiddenHostname, error)
	GetRefreshDelay() (RefreshDelay, error)
	GetBlackListThreshold() (BlackListThreshold, 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