configurationtypes

package
v1.6.49 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 9 Imported by: 61

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	BasePath   string      `json:"basepath" yaml:"basepath"`
	Debug      APIEndpoint `json:"debug" yaml:"debug"`
	Prometheus APIEndpoint `json:"prometheus" yaml:"prometheus"`
	Souin      APIEndpoint `json:"souin" yaml:"souin"`
	Security   SecurityAPI `json:"security" yaml:"security"`
}

API structure contains all additional endpoints

type APIEndpoint

type APIEndpoint struct {
	BasePath string `json:"basepath" yaml:"basepath"`
	Enable   bool   `json:"enable" yaml:"enable"`
	Security bool   `json:"security" yaml:"security"`
}

APIEndpoint is the minimal structure to define an endpoint

type AbstractConfigurationInterface

type AbstractConfigurationInterface interface {
	GetUrls() map[string]URL
	GetPluginName() string
	GetDefaultCache() DefaultCacheInterface
	GetAPI() API
	GetLogLevel() string
	GetLogger() *zap.Logger
	SetLogger(*zap.Logger)
	GetYkeys() map[string]SurrogateKeys
	GetSurrogateKeys() map[string]SurrogateKeys
	GetCacheKeys() CacheKeys
}

AbstractConfigurationInterface interface

type CDN

type CDN struct {
	APIKey    string `json:"api_key,omitempty" yaml:"api_key,omitempty"`
	Dynamic   bool   `json:"dynamic,omitempty" yaml:"dynamic,omitempty"`
	Email     string `json:"email,omitempty" yaml:"email,omitempty"`
	Hostname  string `json:"hostname,omitempty" yaml:"hostname,omitempty"`
	Network   string `json:"network,omitempty" yaml:"network,omitempty"`
	Provider  string `json:"provider,omitempty" yaml:"provider,omitempty"`
	Strategy  string `json:"strategy,omitempty" yaml:"strategy,omitempty"`
	ServiceID string `json:"service_id,omitempty" yaml:"service_id,omitempty"`
	ZoneID    string `json:"zone_id,omitempty" yaml:"zone_id,omitempty"`
}

CDN config

type Cache

type Cache struct {
	Headers []string `json:"headers" yaml:"headers"`
	Port    Port     `json:"port" yaml:"port"`
}

Cache config

type CacheKey added in v1.6.36

type CacheKey map[RegValue]Key

type CacheKeys added in v1.6.36

type CacheKeys []CacheKey

func (*CacheKeys) MarshalJSON added in v1.6.36

func (c *CacheKeys) MarshalJSON() ([]byte, error)

func (*CacheKeys) UnmarshalJSON added in v1.6.36

func (c *CacheKeys) UnmarshalJSON(value []byte) error

func (*CacheKeys) UnmarshalYAML added in v1.6.36

func (c *CacheKeys) UnmarshalYAML(value *yaml.Node) error

type CacheProvider

type CacheProvider struct {
	// URL to connect to the storage system.
	URL string `json:"url" yaml:"url"`
	// Path to the configuration file.
	Path string `json:"path" yaml:"path"`
	// Declare the cache provider directly in the Souin configuration.
	Configuration interface{} `json:"configuration" yaml:"configuration"`
}

CacheProvider config

type DefaultCache

type DefaultCache struct {
	AllowedHTTPVerbs    []string      `json:"allowed_http_verbs" yaml:"allowed_http_verbs"`
	Badger              CacheProvider `json:"badger" yaml:"badger"`
	CDN                 CDN           `json:"cdn" yaml:"cdn"`
	CacheName           string        `json:"cache_name" yaml:"cache_name"`
	Distributed         bool          `json:"distributed" yaml:"distributed"`
	Headers             []string      `json:"headers" yaml:"headers"`
	Key                 Key           `json:"key" yaml:"key"`
	Etcd                CacheProvider `json:"etcd" yaml:"etcd"`
	Mode                string        `json:"mode" yaml:"mode"`
	Nuts                CacheProvider `json:"nuts" yaml:"nuts"`
	Olric               CacheProvider `json:"olric" yaml:"olric"`
	Otter               CacheProvider `json:"otter" yaml:"otter"`
	Redis               CacheProvider `json:"redis" yaml:"redis"`
	Port                Port          `json:"port" yaml:"port"`
	Regex               Regex         `json:"regex" yaml:"regex"`
	Stale               Duration      `json:"stale" yaml:"stale"`
	Storers             []string      `json:"storers" yaml:"storers"`
	Timeout             Timeout       `json:"timeout" yaml:"timeout"`
	TTL                 Duration      `json:"ttl" yaml:"ttl"`
	DefaultCacheControl string        `json:"default_cache_control" yaml:"default_cache_control"`
	MaxBodyBytes        uint64        `json:"max_cacheable_body_bytes" yaml:"max_cacheable_body_bytes"`
}

DefaultCache configuration

func (*DefaultCache) GetAllowedHTTPVerbs

func (d *DefaultCache) GetAllowedHTTPVerbs() []string

GetAllowedHTTPVerbs returns the allowed verbs to cache

func (*DefaultCache) GetBadger

func (d *DefaultCache) GetBadger() CacheProvider

GetBadger returns the Badger configuration

func (*DefaultCache) GetCDN

func (d *DefaultCache) GetCDN() CDN

GetCDN returns the CDN configuration

func (*DefaultCache) GetCacheName added in v1.6.14

func (d *DefaultCache) GetCacheName() string

GetCacheName returns the cache name to use in the Cache-Status response header

func (*DefaultCache) GetDefaultCacheControl

func (d *DefaultCache) GetDefaultCacheControl() string

GetDefaultCacheControl returns the default Cache-Control response header value when empty

func (*DefaultCache) GetDistributed

func (d *DefaultCache) GetDistributed() bool

GetDistributed returns if it uses Olric or not as provider

func (*DefaultCache) GetEtcd added in v1.6.10

func (d *DefaultCache) GetEtcd() CacheProvider

GetEtcd returns etcd configuration

func (*DefaultCache) GetHeaders

func (d *DefaultCache) GetHeaders() []string

GetHeaders returns the default headers that should be cached

func (*DefaultCache) GetKey added in v1.6.9

func (d *DefaultCache) GetKey() Key

GetKey returns the default Key generation strategy

func (*DefaultCache) GetMaxBodyBytes added in v1.6.46

func (d *DefaultCache) GetMaxBodyBytes() uint64

GetMaxBodyBytes returns the default maximum body size (in bytes) for storing into cache

func (*DefaultCache) GetMode added in v1.6.39

func (d *DefaultCache) GetMode() string

GetMode returns mode configuration

func (*DefaultCache) GetNuts added in v1.6.9

func (d *DefaultCache) GetNuts() CacheProvider

GetNuts returns nuts configuration

func (*DefaultCache) GetOlric

func (d *DefaultCache) GetOlric() CacheProvider

GetOlric returns olric configuration

func (*DefaultCache) GetOtter added in v1.6.48

func (d *DefaultCache) GetOtter() CacheProvider

GetOtter returns otter configuration

func (*DefaultCache) GetRedis added in v1.6.19

func (d *DefaultCache) GetRedis() CacheProvider

GetRedis returns olric configuration

func (*DefaultCache) GetRegex

func (d *DefaultCache) GetRegex() Regex

GetRegex returns the regex that shouldn't be cached

func (*DefaultCache) GetStale

func (d *DefaultCache) GetStale() time.Duration

GetStale returns the stale duration

func (*DefaultCache) GetStorers added in v1.6.41

func (d *DefaultCache) GetStorers() []string

GetStale returns the stale duration

func (*DefaultCache) GetTTL

func (d *DefaultCache) GetTTL() time.Duration

GetTTL returns the default TTL

func (*DefaultCache) GetTimeout added in v1.6.18

func (d *DefaultCache) GetTimeout() Timeout

GetTimeout returns the backend and cache timeouts

type DefaultCacheInterface

type DefaultCacheInterface interface {
	GetAllowedHTTPVerbs() []string
	GetBadger() CacheProvider
	GetCacheName() string
	GetCDN() CDN
	GetDistributed() bool
	GetEtcd() CacheProvider
	GetMode() string
	GetOtter() CacheProvider
	GetNuts() CacheProvider
	GetOlric() CacheProvider
	GetRedis() CacheProvider
	GetHeaders() []string
	GetKey() Key
	GetRegex() Regex
	GetStale() time.Duration
	GetStorers() []string
	GetTimeout() Timeout
	GetTTL() time.Duration
	GetDefaultCacheControl() string
	GetMaxBodyBytes() uint64
}

DefaultCacheInterface interface

type Duration

type Duration struct {
	time.Duration
}

Duration is the super object to wrap the duration and be able to parse it from the configuration

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON transform the Duration into a time.duration object

func (*Duration) MarshalYAML

func (d *Duration) MarshalYAML() (interface{}, error)

MarshalYAML transform the Duration into a time.duration object

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

UnmarshalJSON parse the time.duration into a Duration object

func (*Duration) UnmarshalYAML

func (d *Duration) UnmarshalYAML(b *yaml.Node) (e error)

UnmarshalYAML parse the time.duration into a Duration object

type Key added in v1.6.9

type Key struct {
	DisableBody   bool     `json:"disable_body,omitempty" yaml:"disable_body,omitempty"`
	DisableHost   bool     `json:"disable_host,omitempty" yaml:"disable_host,omitempty"`
	DisableMethod bool     `json:"disable_method,omitempty" yaml:"disable_method,omitempty"`
	DisableQuery  bool     `json:"disable_query,omitempty" yaml:"disable_query,omitempty"`
	DisableScheme bool     `json:"disable_scheme,omitempty" yaml:"disable_scheme,omitempty"`
	Hash          bool     `json:"hash,omitempty" yaml:"hash,omitempty"`
	Hide          bool     `json:"hide,omitempty" yaml:"hide,omitempty"`
	Template      string   `json:"template,omitempty" yaml:"template,omitempty"`
	Headers       []string `json:"headers,omitempty" yaml:"headers,omitempty"`
}

type Port

type Port struct {
	Web string `json:"web" yaml:"web"`
	TLS string `json:"tls" yaml:"tls"`
}

Port config

type RegValue added in v1.6.9

type RegValue struct {
	*regexp.Regexp
}

RegValue represent a valid regexp as value

func (*RegValue) UnmarshalJSON added in v1.6.9

func (r *RegValue) UnmarshalJSON(b []byte) error

UnmarshalJSON parse the string configuration into a compiled regexp.

func (*RegValue) UnmarshalYAML added in v1.6.9

func (r *RegValue) UnmarshalYAML(b *yaml.Node) error

type Regex

type Regex struct {
	// Prevent the from being cached matching the regex
	Exclude string `json:"exclude" yaml:"exclude"`
}

Regex config

type SecurityAPI

type SecurityAPI struct {
	BasePath string `json:"basepath" yaml:"basepath"`
	Enable   bool   `json:"enable" yaml:"enable"`
	Secret   string `json:"secret" yaml:"secret"`
	Users    []User `json:"users" yaml:"users"`
}

SecurityAPI object contains informations related to the endpoints

type SurrogateConfiguration added in v1.6.46

type SurrogateConfiguration struct {
	Storer string `json:"storer" yaml:"storer"`
}

type SurrogateKeys

type SurrogateKeys struct {
	SurrogateConfiguration
	URL     string            `json:"url" yaml:"url"`
	Headers map[string]string `json:"headers" yaml:"headers"`
}

SurrogateKeys structure define the way surrogate keys are stored

type Timeout added in v1.6.18

type Timeout struct {
	Backend Duration `json:"backend" yaml:"backend"`
	Cache   Duration `json:"cache" yaml:"cache"`
}

Timeout configuration to handle the cache provider and the reverse-proxy timeout.

type URL

type URL struct {
	TTL                 Duration `json:"ttl" yaml:"ttl"`
	Headers             []string `json:"headers" yaml:"headers"`
	DefaultCacheControl string   `json:"default_cache_control" yaml:"default_cache_control"`
}

URL configuration

type User

type User struct {
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
}

User is the minimal structure to define a user

Jump to

Keyboard shortcuts

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