ddns

package
v0.0.0-...-f116871 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PerformHttpRequest

func PerformHttpRequest(
	method string,
	url string,
	username string,
	password string,
	body io.Reader,
	headers map[string]string) (int, []byte, error)

PerformHttpRequest performs a HTTP request and returns the status code and the response

Types

type Client

type Client struct {
	ServiceConfig *config.ServiceConfiguration
}

func (Client) LogIPAddressUpdate

func (client Client) LogIPAddressUpdate(args ...string)

LogIPAddressUpdate logs the dynamic dns client IP address update

type CloudFlareClient

type CloudFlareClient Client

CloudFlareClient implements the cloudflare dynamic dns client

cloudflare docs:

https://api.cloudflare.com/#getting-started-resource-ids
https://api.cloudflare.com/#dns-records-for-a-zone-list-dns-records
https://api.cloudflare.com/#dns-records-for-a-zone-update-dns-record

func (CloudFlareClient) UpdateIPAddresses

func (client CloudFlareClient) UpdateIPAddresses(ipv4, ipv6 net.IP) error

UpdateIPAddresses performs the dynamic dns IP address update operation

type DnsRecord

type DnsRecord struct {
	ID       string `json:"id"`
	Type     string `json:"type"`
	Name     string `json:"name"`
	ZoneID   string `json:"zone_id"`
	ZoneName string `json:"zone_name"`
}

type DnsRecordUpdateResponse

type DnsRecordUpdateResponse struct {
	Success bool `json:"success"`
}

type DuckDNSClient

type DuckDNSClient Client

DuckDNSClient implements the duckdns dynamic dns client

duckdns docs: https://www.duckdns.org/spec.jsp

request url: https://www.duckdns.org/update?domains={YOURVALUE}&token={YOURVALUE}[&ip={YOURVALUE}][&ipv6={YOURVALUE}][&verbose=true][&clear=true]

sample response: OK

func (DuckDNSClient) UpdateIPAddresses

func (client DuckDNSClient) UpdateIPAddresses(ipv4, ipv6 net.IP) error

UpdateIPAddresses performs the dynamic dns IP address update operation

type GoDaddyClient

type GoDaddyClient Client

GoDaddyClient implements the godaddy dynamic dns client

godaddy docs: https://developer.godaddy.com/doc/endpoint/domains#/v1/recordReplaceTypeName

request urls:

https://api.ote-godaddy.com/v1/domains/example.com/records/A/recordName
https://api.godaddy.com/v1/domains/example.com/records/A/recordName

curl:

curl -X PUT "https://api.ote-godaddy.com/v1/domains/example.com/records/A/recordName" -H  "accept: application/json" -H  "Content-Type: application/json" -H  "Authorization: sso-key UzQxLikm_46KxDFnbjN7cQjmw6wocia:46L26ydpkwMaKZV6uVdDWe" -d "[  {    \"data\": \"127.0.0.1\",    \"port\": 53,    \"priority\": 0,    \"protocol\": \"string\",    \"service\": \"string\",    \"ttl\": 600,    \"weight\": 0  }]"

sample response:

{
  "code": "ACCESS_DENIED",
  "message": "Authenticated user is not allowed access"
}

func (GoDaddyClient) UpdateIPAddresses

func (client GoDaddyClient) UpdateIPAddresses(ipv4, ipv6 net.IP) error

UpdateIPAddresses performs the dynamic dns IP address update operation

type IDynamicDnsClient

type IDynamicDnsClient interface {
	// UpdateIPAddresses performs the dynamic dns IP address update operation
	UpdateIPAddresses(ipv4, ipv6 net.IP) error
}

IDynamicDnsClient describes the interface of a type that knows how to perform a dynamic dns IP address update

type ListDnsRecordsResponse

type ListDnsRecordsResponse struct {
	Success    bool        `json:"success"`
	DnsRecords []DnsRecord `json:"result"`
}

type NamecheapClient

type NamecheapClient Client

NamecheapClient implements the namecheap dynamic dns client

namecheap docs: https://www.namecheap.com/support/knowledgebase/article.aspx/29/11/how-do-i-use-a-browser-to-dynamically-update-the-hosts-ip/

request url: https://dynamicdns.park-your-domain.com/update?host=@&domain=example.com&password=PASSWORD&ip=255.255.255.255

sample response xml: <?xml version="1.0"?> <interface-response>

<Command>SETDNSHOST</Command>
<Language>eng</Language>
<ErrCount>1</ErrCount>
<errors>
    <Err1>Error message here</Err1>
</errors>
<ResponseCount>1</ResponseCount>
<responses>
    <response>
        <ResponseNumber>99999</ResponseNumber>
        <ResponseString>Error message here</ResponseString>
    </response>
</responses>
<Done>true</Done>
<debug><![CDATA[]]></debug>

</interface-response>

func (NamecheapClient) UpdateIPAddresses

func (client NamecheapClient) UpdateIPAddresses(ipv4, ipv6 net.IP) error

UpdateIPAddresses performs the dynamic dns IP address update operation

type NamecheapXmlResponse

type NamecheapXmlResponse struct {
	XMLName  xml.Name `xml:"interface-response"`
	Text     string   `xml:",chardata"`
	Command  string   `xml:"Command"`
	Language string   `xml:"Language"`
	ErrCount int      `xml:"ErrCount"`
	Errors   struct {
		Text string `xml:",chardata"`
		Err1 string `xml:"Err1"`
	} `xml:"errors"`
	ResponseCount string `xml:"ResponseCount"`
	Responses     struct {
		Text     string `xml:",chardata"`
		Response struct {
			Text           string `xml:",chardata"`
			ResponseNumber int    `xml:"ResponseNumber"`
			ResponseString string `xml:"ResponseString"`
		} `xml:"response"`
	} `xml:"responses"`
	Done  string `xml:"Done"`
	Debug string `xml:"debug"`
}

type NoIPClient

type NoIPClient Client

NoIPClient implements the noip dynamic dns client

noip docs: https://www.noip.com/integrate/request

request url: https://username:password@dynupdate.no-ip.com/nic/update?hostname=mytest.example.com&myip=192.0.2.25&myipv6=2a0f:21a1:2103:2001:f5e:1111:6fd:6bc7

sample response: nochg 192.0.2.25

func (NoIPClient) UpdateIPAddresses

func (client NoIPClient) UpdateIPAddresses(ipv4, ipv6 net.IP) error

UpdateIPAddresses performs the dynamic dns IP address update operation

type ZonesJsonResponse

type ZonesJsonResponse struct {
	Zones []struct {
		ID string `json:"id"`
	} `json:"result"`
	Success bool `json:"success"`
}

Jump to

Keyboard shortcuts

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