Documentation ¶
Index ¶
- type API
- type APIEndpoint
- type AbstractConfigurationInterface
- type CDN
- type Cache
- type CacheProvider
- type DefaultCache
- func (d *DefaultCache) GetAllowedHTTPVerbs() []string
- func (d *DefaultCache) GetBadger() CacheProvider
- func (d *DefaultCache) GetCDN() CDN
- func (d *DefaultCache) GetCacheName() string
- func (d *DefaultCache) GetDefaultCacheControl() string
- func (d *DefaultCache) GetDistributed() bool
- func (d *DefaultCache) GetEtcd() CacheProvider
- func (d *DefaultCache) GetHeaders() []string
- func (d *DefaultCache) GetKey() Key
- func (d *DefaultCache) GetNuts() CacheProvider
- func (d *DefaultCache) GetOlric() CacheProvider
- func (d *DefaultCache) GetRedis() CacheProvider
- func (d *DefaultCache) GetRegex() Regex
- func (d *DefaultCache) GetStale() time.Duration
- func (d *DefaultCache) GetTTL() time.Duration
- func (d *DefaultCache) GetTimeout() Timeout
- type DefaultCacheInterface
- type Duration
- type Key
- type Port
- type RegValue
- type Regex
- type SecurityAPI
- type SurrogateKeys
- type Timeout
- type URL
- type User
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 GetDefaultCache() DefaultCacheInterface GetAPI() API GetLogLevel() string GetLogger() *zap.Logger SetLogger(*zap.Logger) GetYkeys() map[string]SurrogateKeys GetSurrogateKeys() map[string]SurrogateKeys GetCacheKeys() map[RegValue]Key }
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 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"` Nuts CacheProvider `json:"nuts" yaml:"nuts"` Olric CacheProvider `json:"olric" yaml:"olric"` Redis CacheProvider `json:"redis" yaml:"redis"` Port Port `json:"port" yaml:"port"` Regex Regex `json:"regex" yaml:"regex"` Stale Duration `json:"stale" yaml:"stale"` Timeout Timeout `json:"timeout" yaml:"timeout"` TTL Duration `json:"ttl" yaml:"ttl"` DefaultCacheControl string `json:"default_cache_control" yaml:"default_cache_control"` }
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 ¶
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 ¶
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 ¶
func (d *DefaultCache) GetKey() Key
GetKey returns the default Key generation strategy
func (*DefaultCache) GetNuts ¶
func (d *DefaultCache) GetNuts() CacheProvider
GetNuts returns nuts configuration
func (*DefaultCache) GetOlric ¶
func (d *DefaultCache) GetOlric() CacheProvider
GetOlric returns olric configuration
func (*DefaultCache) GetRedis ¶
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) GetTTL ¶
func (d *DefaultCache) GetTTL() time.Duration
GetTTL returns the default TTL
func (*DefaultCache) GetTimeout ¶
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 GetNuts() CacheProvider GetOlric() CacheProvider GetRedis() CacheProvider GetHeaders() []string GetKey() Key GetRegex() Regex GetStale() time.Duration GetTimeout() Timeout GetTTL() time.Duration GetDefaultCacheControl() string }
DefaultCacheInterface interface
type Duration ¶
Duration is the super object to wrap the duration and be able to parse it from the configuration
func (Duration) MarshalJSON ¶
MarshalJSON transform the Duration into a time.duration object
func (*Duration) MarshalYAML ¶
MarshalYAML transform the Duration into a time.duration object
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON parse the time.duration into a Duration object
type RegValue ¶
RegValue represent a valid regexp as value
func (*RegValue) UnmarshalJSON ¶
UnmarshalJSON parse the string configuration into a compiled regexp.
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 SurrogateKeys ¶
type SurrogateKeys struct { 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 ¶
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.