gdDDNSClient

package module
v0.0.0-...-b827dc5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

README

gd-ddns-client

Build Status Coverage Status GoDoc Reference

This is a work in progress of a simple Go client for Google Domains. It uses the Google Domains DDNS HTTP API and the ipify API to update dynamic DNS names in Google Domains

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	// GetAllDomains returns a list of domains stored in the configuration struct
	GetAllDomains() []string
	// GetCredentialsByDomain returns an individual Credential for the specified domains
	GetCredentialsByHostname(hostname string) (Credential, error)
	// GetDomainsURL should return the URL for Google Domains' api
	GetDomainsURL() string
	// GetIPIfyURL returns the IPify URL to use in the client
	GetIPIfyURL() string
	// GetUpdateInterval returns the interval for the client to update Google Domains
	GetUpdateInterval() time.Duration
}

Config is an interface that all config types must implement

func NewConfigFromFile

func NewConfigFromFile(filename string) (Config, error)

NewConfigFromFile creates a new Config from filename or returns any errors during file reads or YAML parsing

type Credential

type Credential struct {
	User, Password string
}

Credential is a simple struct to handle username/password combos

type DomainsAPI

type DomainsAPI interface {
	// Update conforms to the HTTP API for updating a DDNS name on Google Domains
	Update(credential Credential, hostname string, ip net.IP, offline bool) error
}

DomainsAPI is an interface that Domains API implementations must implement

func NewDomainsAPI

func NewDomainsAPI(baseURL string) DomainsAPI

NewDomainsAPI returns a new instance of a DaomainsAPI

type IPIfyAPI

type IPIfyAPI interface {
	// GetIPAddress returns a net.IP or error based on a response from ipify.org's API
	GetIPAddress() (net.IP, error)
}

IPIfyAPI is a simple implementation of the ipify.org API

func NewIPIfyAPI

func NewIPIfyAPI(baseURL string) IPIfyAPI

NewIPIfyAPI returns an instance of an IPIfyAPI

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL