Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = Config{ Server: ServerConfig{ HTTP: HTTPConfig{ Address: ":8080", }, HTTPS: HTTPSConfig{ Enabled: true, CAKeyFile: "", CACertFile: "", Transparent: TransparentConfig{ Address: ":8443", }, }, }, Cache: CacheConfig{ TTL: "", Folder: "./cache", }, Rules: RulesConfig{ Mode: RulesModeBlacklist, Rules: []CacheRule{}, }, Log: LogConfig{ Level: "info", ThirdParty: false, }, }
DefaultConfig holds the default configuration values
Functions ¶
func MatchesStatusCode ¶
MatchesStatusCode checks if a status code matches a pattern
Types ¶
type CacheConfig ¶
CacheConfig contains cache-related configuration
type CacheRule ¶
type CacheRule struct { BaseURI string `koanf:"base_uri"` Methods []string `koanf:"methods"` StatusCodes []string `koanf:"status_codes,omitempty"` // e.g., ["200", "404", "4xx", "5xx"] }
CacheRule defines a caching rule
func NewCacheRule ¶
type Config ¶
type Config struct { Server ServerConfig `koanf:"server"` Cache CacheConfig `koanf:"cache"` Rules RulesConfig `koanf:"rules"` Log LogConfig `koanf:"log"` }
Config represents the application configuration
func (*Config) GetCacheTTL ¶
GetCacheTTL parses and returns the cache TTL duration
type HTTPConfig ¶
type HTTPConfig struct {
Address string `koanf:"address"`
}
type HTTPSConfig ¶
type HTTPSConfig struct { Enabled bool `koanf:"enabled"` CAKeyFile string `koanf:"ca_key_file"` CACertFile string `koanf:"ca_cert_file"` Transparent TransparentConfig `koanf:"transparent"` }
type RulesConfig ¶
type RulesConfig struct { Mode RulesMode `koanf:"mode"` // "whitelist" or "blacklist" Rules []CacheRule `koanf:"rules"` }
func NewRulesConfig ¶
func NewRulesConfig(mode RulesMode, rules ...CacheRule) *RulesConfig
type RulesMode ¶
type RulesMode string
RulesMode represents the mode of rule evaluation (whitelist or blacklist)
type ServerConfig ¶
type ServerConfig struct { HTTP HTTPConfig `koanf:"http"` HTTPS HTTPSConfig `koanf:"https"` }
ServerConfig contains server-related configuration Updated for nested http/https config
type TransparentConfig ¶
type TransparentConfig struct {
Address string `koanf:"address"`
}
Click to show internal directories.
Click to hide internal directories.