handler

package
v0.0.0-...-868dd30 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// HEUrl the API address for he.net
	HEUrl = "https://dyn.dns.he.net/nic/update"
)

Functions

This section is empty.

Types

type CloudflareHandler

type CloudflareHandler struct {
	Configuration *godns.Settings
	API           string
}

CloudflareHandler struct definition

func (*CloudflareHandler) DomainLoop

func (handler *CloudflareHandler) DomainLoop(domain *godns.Domain, panicChan chan<- godns.Domain)

DomainLoop the main logic loop

func (*CloudflareHandler) SetConfiguration

func (handler *CloudflareHandler) SetConfiguration(conf *godns.Settings)

SetConfiguration pass dns settings and store it to handler instance

type DNSPodHandler

type DNSPodHandler struct {
	LastIP        string
	Configuration *godns.Settings
}

DNSPodHandler struct definition

func (*DNSPodHandler) DomainLoop

func (handler *DNSPodHandler) DomainLoop(domain *godns.Domain, panicChan chan<- godns.Domain)

DomainLoop the main logic loop

func (*DNSPodHandler) GenerateHeader

func (handler *DNSPodHandler) GenerateHeader(content url.Values) url.Values

GenerateHeader generates the request header for DNSPod API

func (*DNSPodHandler) GetDomain

func (handler *DNSPodHandler) GetDomain(name string) (int64, error)

GetDomain returns specific domain by name

func (*DNSPodHandler) GetSubDomain

func (handler *DNSPodHandler) GetSubDomain(domainID int64, name string) (string, string, error)

GetSubDomain returns subdomain by domain id

func (*DNSPodHandler) PostData

func (handler *DNSPodHandler) PostData(url string, content url.Values) (string, error)

PostData post data and invoke DNSPod API

func (*DNSPodHandler) Run

func (handler *DNSPodHandler) Run(domain *godns.Domain) error

Run the main logic

func (*DNSPodHandler) SetConfiguration

func (handler *DNSPodHandler) SetConfiguration(conf *godns.Settings)

SetConfiguration pass dns settings and store it to handler instance

func (*DNSPodHandler) UpdateIP

func (handler *DNSPodHandler) UpdateIP(domainID int64, subDomainID string, subDomainName string, ip string)

UpdateIP update subdomain with current IP

type DNSRecord

type DNSRecord struct {
	ID      string `json:"id"`
	IP      string `json:"content"`
	Name    string `json:"name"`
	Proxied bool   `json:"proxied"`
	Type    string `json:"type"`
	ZoneID  string `json:"zone_id"`
}

DNSRecord for Cloudflare API

func (*DNSRecord) SetIP

func (r *DNSRecord) SetIP(ip string)

SetIP updates DNSRecord.IP

type DNSRecordResponse

type DNSRecordResponse struct {
	Records []DNSRecord `json:"result"`
	Success bool        `json:"success"`
}

DNSRecordResponse struct

type DNSRecordUpdateResponse

type DNSRecordUpdateResponse struct {
	Record  DNSRecord `json:"result"`
	Success bool      `json:"success"`
}

DNSRecordUpdateResponse struct

type HEHandler

type HEHandler struct {
	Configuration *godns.Settings
}

HEHandler struct

func (*HEHandler) DomainLoop

func (handler *HEHandler) DomainLoop(domain *godns.Domain, panicChan chan<- godns.Domain)

DomainLoop the main logic loop

func (*HEHandler) SetConfiguration

func (handler *HEHandler) SetConfiguration(conf *godns.Settings)

SetConfiguration pass dns settings and store it to handler instance

func (*HEHandler) UpdateIP

func (handler *HEHandler) UpdateIP(domain, subDomain, currentIP string)

UpdateIP update subdomain with current IP

type IHandler

type IHandler interface {
	SetConfiguration(*godns.Settings)
	DomainLoop(domain *godns.Domain, panicChan chan<- godns.Domain)
}

IHandler is the interface for all DNS handlers

func CreateHandler

func CreateHandler(provider string) IHandler

CreateHandler creates DNS handler by different providers

type Zone

type Zone struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

Zone object with id and name

type ZoneResponse

type ZoneResponse struct {
	Zones   []Zone `json:"result"`
	Success bool   `json:"success"`
}

ZoneResponse is a wrapper for Zones

Jump to

Keyboard shortcuts

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