Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrSameIP returns when the current ip is alread set on the local storage ErrSameIP = errors.New("current and old ip are the same, no need to update") )
Functions ¶
func GetInterfaceIPV4 ¶
GetInterfaceIPV4 returns the ipv4 for the given interface
func UpdateRecord ¶
UpdateRecord updates the DNS record
Types ¶
type Client ¶
type Client interface { GetDNSRecord(zone, dns string) (*Domain, error) UpdateDNSRecord(domain *Domain) error }
Client defines how to client will update records on DNS
type CloudflareClient ¶
type CloudflareClient struct {
API *cloudflare.API
}
CloudflareClient the Client that will handle the Cloudflare api
func NewCloudflareClient ¶
func NewCloudflareClient(cfKey, cfEmail string) (*CloudflareClient, error)
NewCloudflareClient creates a new client for the cloudflare api
func (*CloudflareClient) GetDNSRecord ¶
func (c *CloudflareClient) GetDNSRecord(zone, dns string) (*Domain, error)
GetDNSRecord gets the Cloudflare DNS record for the given value
zone is the cloudflare domain you are working on eg: domain.com
dns is the address you want get the DNSRecord eg: my.domain.com
The first matching DNSRecord will be returned
func (*CloudflareClient) UpdateDNSRecord ¶
func (c *CloudflareClient) UpdateDNSRecord(domain *Domain) error
UpdateDNSRecord updates the Cloudflare DNSRecord
type Domain ¶
type Domain struct { ZoneID string // the identifier of the zone on cloudflare RecordID string // the identifer of the record on cloudflare Type string // valid values: A, AAAA, CNAME, TXT, SRV, LOC, MX, NS, SPF Zone string // cloudflare zone DNS string // cloudflare dns (the domain that will be handled) IP string // the ip of the domain }
Domain a single domain on the dns
Click to show internal directories.
Click to hide internal directories.