Documentation
¶
Index ¶
- Constants
- func GetAllSupportSourceFunc() []string
- func NewLogger() *logrus.Logger
- func ParseDomain(domain string) (*tld.URL, error)
- func ProxyHttpClient(addr string) (*http.Client, error)
- func RegisterSourceFunc(name string, fn SourceFunc) error
- func RegisterTargetFunc(name string, fn TargetFunc) error
- func ValidateConfig(config *JobConfig) error
- func ValidateRecord(domain string, addr *net.IP) error
- func ValidateRecords(domains []string, addr *net.IP) error
- type Auth
- type Config
- type Dispatch
- type Job
- type JobConfig
- type SourceConfig
- type SourceFunc
- type TargetConfig
- type TargetFunc
- type WebHook
Constants ¶
const ( // DefaultInterval is the default check interval in seconds DefaultInterval = 60 // MinInterval is the minimum allowed check interval in seconds MinInterval = 30 // MaxRetries is the maximum number of retries for failed requests MaxRetries = 3 // DefaultTimeout is the default timeout for HTTP requests DefaultTimeout = 30 * time.Second // DefaultUserAgent is the default user agent for HTTP requests DefaultUserAgent = "SimpleDDNS/1.0" )
Variables ¶
This section is empty.
Functions ¶
func GetAllSupportSourceFunc ¶
func GetAllSupportSourceFunc() []string
GetAllSupportSourceFunc returns the names of every registered source function.
func ParseDomain ¶
ParseDomain parses a bare domain name into its components using go-tld. See https://github.com/jpillora/go-tld for details.
func ProxyHttpClient ¶
ProxyHttpClient creates an http.Client backed by a SOCKS5 proxy at addr.
func RegisterSourceFunc ¶
func RegisterSourceFunc(name string, fn SourceFunc) error
RegisterSourceFunc registers a new source function under the given name. It returns an error if a function with the same name is already registered.
func RegisterTargetFunc ¶
func RegisterTargetFunc(name string, fn TargetFunc) error
RegisterTargetFunc registers a new target function under the given name. It returns an error if a function with the same name is already registered.
func ValidateConfig ¶
ValidateConfig performs basic sanity checks on a JobConfig.
func ValidateRecord ¶
ValidateRecord checks whether the given domain currently resolves to addr.
Types ¶
type Config ¶
type Config struct {
LogFile string `yaml:"logfile" mapstructure:"logfile"`
Debug bool `yaml:"debug" mapstructure:"debug"`
LoadUI bool `yaml:"ui" mapstructure:"ui"`
BindAddr string `yaml:"addr" mapstructure:"addr"`
Auth Auth `yaml:"auth" mapstructure:"auth"`
Jobs []JobConfig `yaml:"ddns" mapstructure:"ddns"`
}
type Dispatch ¶
type Dispatch struct {
Timeout time.Duration
Configs []JobConfig
// contains filtered or unexported fields
}
Dispatch coordinates a set of DDNS jobs that run concurrently.
func NewDispatch ¶
NewDispatch creates a new Dispatch from the given job configurations.
type Job ¶
type Job struct {
Config *JobConfig
SourceFunc []SourceFunc
TargetFunc TargetFunc
// contains filtered or unexported fields
}
Job represents a running DDNS job created from a JobConfig.
func (*Job) RunWebhook ¶
RunWebhook triggers the configured webhook after a successful address update.
func (*Job) Source ¶
Source executes every registered source function for this job and returns the resolved address. When multiple source functions are configured, they must all agree on the same address; otherwise an error is returned.
type JobConfig ¶
type JobConfig struct {
WebHook WebHook `yaml:"webhook" mapstructure:"webhook"`
Source SourceConfig `yaml:"source,omitempty" mapstructure:"source"`
Target TargetConfig `yaml:"target,omitempty" mapstructure:"target"`
}
JobConfig describes a single DDNS job, composed of a source, a target and an optional webhook.
type SourceConfig ¶
type SourceConfig struct {
Interval uint `yaml:"interval,omitempty"`
Type string `yaml:"type,omitempty"`
Path string `yaml:"path"`
Content string `yaml:"content"`
}
SourceConfig describes how a source function obtains the public IP address.
type SourceFunc ¶
SourceFunc resolves the current IP address from a configured source.
func SourceFuncByName ¶
func SourceFuncByName(name string) (SourceFunc, error)
SourceFuncByName looks up a registered source function by name.
type TargetConfig ¶
type TargetConfig struct {
Type string `yaml:"type,omitempty"`
Key string `yaml:"key,omitempty"`
Token string `yaml:"token"`
Proxy string `yaml:"proxy"`
Domains []string `yaml:"domains,omitempty"`
}
TargetConfig describes how a target function updates DNS records.
type TargetFunc ¶
TargetFunc applies the given IP address to a configured target.
func TargetFuncByName ¶
func TargetFuncByName(name string) (TargetFunc, error)
TargetFuncByName looks up a registered target function by name.
type WebHook ¶
type WebHook struct {
Url string `yaml:"url" mapstructure:"url"`
Token string `yaml:"token" mapstructure:"token"`
UserName string `yaml:"username" mapstructure:"username"`
Password string `yaml:"password" mapstructure:"password"`
}
WebHook describes the webhook triggered when the address changes.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
simplyddns
command
simplyddns is a simple dynamic DNS client
|
simplyddns is a simple dynamic DNS client |