Documentation
¶
Overview ¶
Package handler provides configuration management for the CoreDNS PocketBase integration. It defines the configuration structure and default values for the service.
Index ¶
- func DefaultConfigVal4DefaultTtl() int
- type Config
- func (c *Config) MixWithEnv() *Config
- func (c *Config) Validate() error
- func (c *Config) WithCacheCapacity(cacheCapacity int) *Config
- func (c *Config) WithDataDir(dataDir string) *Config
- func (c *Config) WithDefaultTtl(defaultTtl int) *Config
- func (c *Config) WithListen(listen string) *Config
- func (c *Config) WithSuEmail(suUserName string) *Config
- func (c *Config) WithSuPassword(suPassword string) *Config
- type ErrUnsupportedRecordType
- type PocketBaseHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigVal4DefaultTtl ¶
func DefaultConfigVal4DefaultTtl() int
Types ¶
type Config ¶
type Config struct {
// Listen is the address and port the service listens on
Listen string
// DataDir is the directory for PocketBase data storage
DataDir string
// SuEmail is the superuser email for PocketBase
SuEmail string
// SuPassword is the superuser password for PocketBase
SuPassword string
// CacheCapacity is the number of records to cache (0 means no caching)
CacheCapacity int
// DefaultTtl is the default TTL (Time To Live) in seconds for DNS records
DefaultTtl int
}
Config represents the configuration for the CoreDNS PocketBase integration. It contains settings for the service's network interface, data storage, authentication, and caching behavior.
func NewConfig ¶
func NewConfig() *Config
NewConfig creates a new Config instance with default values
func (*Config) MixWithEnv ¶
func (*Config) Validate ¶
Validate checks if the configuration is valid Returns an error if any required field is empty or if numeric values are negative
func (*Config) WithCacheCapacity ¶
WithCacheCapacity sets the cache capacity and returns the modified Config
func (*Config) WithDataDir ¶
WithDataDir sets the data directory and returns the modified Config
func (*Config) WithDefaultTtl ¶
WithDefaultTtl sets the default TTL and returns the modified Config
func (*Config) WithListen ¶
WithListen sets the listen address and returns the modified Config
func (*Config) WithSuEmail ¶
WithSuEmail sets the superuser email and returns the modified Config
func (*Config) WithSuPassword ¶
WithSuPassword sets the superuser password and returns the modified Config
type ErrUnsupportedRecordType ¶
type ErrUnsupportedRecordType struct {
RecordType string
}
func (*ErrUnsupportedRecordType) Error ¶
func (e *ErrUnsupportedRecordType) Error() string
type PocketBaseHandler ¶
func NewWithConfig ¶
func NewWithConfig(config *Config) (handler *PocketBaseHandler, err error)
func (*PocketBaseHandler) Name ¶
func (handler *PocketBaseHandler) Name() string
Name implements the Handler interface.
func (*PocketBaseHandler) ServeDNS ¶
func (handler *PocketBaseHandler) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)
ServeDNS implements the plugin.Handler interface. It processes DNS queries by: 1. Fetching available zones 2. Matching the query against available zones 3. Fetching and composing appropriate DNS records Returns DNS response code and any error encountered
func (*PocketBaseHandler) WarmUp ¶
func (handler *PocketBaseHandler) WarmUp()