Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { // The sources from which to get the server's public IP address. // Multiple sources can be specified for redundancy. // Default: simple_http IPSourcesRaw []json.RawMessage `json:"ip_sources,omitempty" caddy:"namespace=dynamic_dns.ip_sources inline_key=source"` // The configuration for the DNS provider with which the DNS // records will be updated. DNSProviderRaw json.RawMessage `json:"dns_provider,omitempty" caddy:"namespace=dns.providers inline_key=name"` // The record names, keyed by DNS zone, for which to update the A/AAAA records. // Record names are relative to the zone. The zone is usually your registered // domain name. To refer to the zone itself, use the record name of "@". // // For example, assuming your zone is example.com, and you want to update A/AAAA // records for "example.com" and "www.example.com" so that they resolve to this // Caddy instance, configure like so: `"example.com": ["@", "www"]` Domains map[string][]string `json:"domains,omitempty"` // If enabled, no new DNS records will be created. Only existing records will be updated. // This means that the A or AAAA records need to be created manually ahead of time. UpdateOnly bool `json:"update_only,omitempty"` // If enabled, the "http" app's config will be scanned to assemble the list // of domains for which to enable dynamic DNS updates. DynamicDomains bool `json:"dynamic_domains,omitempty"` // The IP versions to enable. By default, both "ipv4" and "ipv6" will be enabled. // To disable IPv6, specify {"ipv6": false}. Versions IPVersions `json:"versions,omitempty"` // How frequently to check the public IP address. Default: 30m CheckInterval caddy.Duration `json:"check_interval,omitempty"` // The TTL to set on DNS records. TTL caddy.Duration `json:"ttl,omitempty"` // contains filtered or unexported fields }
App is a Caddy app that keeps your DNS records updated with the public IP address of your instance. It updates A and AAAA records.
func (App) CaddyModule ¶
func (App) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
type IPVersions ¶
IPVersions is the IP versions to enable for dynamic DNS. Versions are enabled if true or nil, set to false to disable.
func (IPVersions) V4Enabled ¶
func (ip IPVersions) V4Enabled() bool
V4Enabled returns true if IPv4 is enabled.
func (IPVersions) V6Enabled ¶
func (ip IPVersions) V6Enabled() bool
V6Enabled returns true if IPv6 is enabled.
type NetInterface ¶
type NetInterface struct { // The name of the network interface. Name string `json:"name,omitempty"` // contains filtered or unexported fields }
NetInterface gets the public IP address(es) (at most 1 IPv4 and 1 IPv6) from a network interface by name.
func (NetInterface) CaddyModule ¶
func (NetInterface) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (NetInterface) GetIPs ¶
func (u NetInterface) GetIPs(ctx context.Context, versions IPVersions) ([]net.IP, error)
GetIPs gets the public address of from the network interface.
func (*NetInterface) Provision ¶
func (u *NetInterface) Provision(ctx caddy.Context) error
Provision sets up the module.
func (*NetInterface) UnmarshalCaddyfile ¶
func (u *NetInterface) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
type SimpleHTTP ¶
type SimpleHTTP struct { // The list of endpoints to query. If empty, a default list will // be used: // // - https://icanhazip.com // - https://ifconfig.me // - https://ident.me // - https://ipecho.net/plain Endpoints []string `json:"endpoints,omitempty"` // contains filtered or unexported fields }
SimpleHTTP is an IP source that looks up the public IP addresses by making HTTP(S) requests to the specified endpoints; it will try each endpoint with IPv4 and IPv6 until at least one returns a valid value. It is OK if an endpoint doesn't support both IP versions; returning a single valid IP address is sufficient.
The endpoints must return HTTP status 200 and the response body must contain only the IP address in plain text.
func (SimpleHTTP) CaddyModule ¶
func (SimpleHTTP) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (SimpleHTTP) GetIPs ¶
func (sh SimpleHTTP) GetIPs(ctx context.Context, versions IPVersions) ([]net.IP, error)
GetIPs gets the public addresses of this machine.
func (*SimpleHTTP) Provision ¶
func (sh *SimpleHTTP) Provision(ctx caddy.Context) error
Provision sets up the module.
func (*SimpleHTTP) UnmarshalCaddyfile ¶
func (sh *SimpleHTTP) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
type Static ¶
type Static struct { IPs []net.IP `json:"ips,omitempty"` // contains filtered or unexported fields }
func (Static) CaddyModule ¶
func (Static) CaddyModule() caddy.ModuleInfo
type UPnP ¶
type UPnP struct { // The UPnP endpoint to query. If empty, the default UPnP // discovery will be used. Endpoint string `json:"endpoint,omitempty"` // contains filtered or unexported fields }
UPnP gets the IP address from UPnP device.
func (UPnP) CaddyModule ¶
func (UPnP) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (UPnP) GetIPs ¶
GetIPs gets the public address(es) of this machine. This implementation ignores the configured IP versions, since we can't really choose whether we're looking for IPv4 or IPv6 with UPnP, we just get what we get.