Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache represents a cache for storing CacheEntries.
func NewCache ¶
NewCache returns a new cache struct with a specified location and timeout. When the location is an empty string it will set the cache location to the user cache dir.
func (*Cache) GetIPv4 ¶
GetIPv4 returns the ipv4 address of a specified domain and host. If this ipv4 address is not present in the cache it will return an empty string.
func (*Cache) GetIPv6 ¶
GetIPv6 returns the ipv6 address of a specified domain and host. If this ipv6 address is not present in the cache it will return an empty string.
func (*Cache) Load ¶
Load loads the cache from its location. When there is no file at the cache location it will do nothing. If the last modification to the file was made before the cache timeout it will ignore the file content.
func (*Cache) SetIPv4 ¶
SetIPv4 sets the ipv4 address for a specified domain and host to a specified ipv4 address.
type CacheEntry ¶
type CacheEntry struct {
// contains filtered or unexported fields
}
CacheEntry represents a cache entry.
type Config ¶
type Config struct { CustomerNumber int `yaml:"CUSTOMERNR"` APIKey string `yaml:"APIKEY"` APIPassword string `yaml:"APIPASSWORD"` IPCache string `yaml:"IP-CACHE"` IPCacheTimeout int `yaml:"IP-CACHE-TIMEOUT"` Domains []Domain `yaml:"DOMAINS"` }
Config represents a config.
func LoadConfig ¶
LoadConfig returns a config loaded from a specified location. It will return an error if there is no file in the specified location or it is unable to read it.
func (*Config) CacheEnabled ¶
CacheEnabled returns whether the cache is enabled in the configuration.
func (*Config) IPv4Enabled ¶
IPv4Enabled returns true if at least one domain needs the A record configured.
func (*Config) IPv6Enabled ¶
IPv6Enabled returns true if at least one domain needs the AAAA record configured.
type DNSConfiguratorService ¶
type DNSConfiguratorService struct {
// contains filtered or unexported fields
}
DNSConfiguratorService represents a service that will update the DNS records for a given netcup account
func NewDNSConfigurator ¶
func NewDNSConfigurator(config *Config, cache *Cache, logger *Logger) *DNSConfiguratorService
NewDNSConfigurator returns a DNSConfiguratorService by given config, cache and logger
func (*DNSConfiguratorService) Configure ¶
func (dnsc *DNSConfiguratorService) Configure()
Configure will configure the DNS Zones and Records in a netcup account as specified by the config
type Domain ¶
type Domain struct { Name string `yaml:"NAME"` IPv6 bool `yaml:"IPV6"` IPv4 bool `yaml:"IPV4"` TTL int `yaml:"TTL"` Hosts []string `yaml:"HOSTS"` }
Domain represents a domain.
func (*Domain) UnmarshalYAML ¶
UnmarshalYAML is implemented to override the default value of the IPv4 field of a Domain with true.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger represents an logger instance
func (*Logger) Error ¶
func (l *Logger) Error(v ...interface{})
Error will log an error message and exit