ddns

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

README

ddns

import "github.com/SuperBuker/terraform-provider-dns-he-net/client/ddns"

*Notice:* This module is mostly oriented to validate the DDNS credentials. This is mostly a "hack" to validate the current DDNS status.

The functionalities related to update DDNS records are just for testing purposes. No support or enhancement will be provided for this module.

For more information about the API, please refer to: https://dns.he.net/docs.html

*About the API rate limit:* The API enfoces a rate limit based on the requested domain, thus it's only safe to fail one or two times the authentication against the same domain.

This forces us to randomise the domains used during testing.

Index

Constants

const (
    endpoint = "https://dyn.dns.he.net/nic/update"
)

func CheckAuth

func CheckAuth(ctx context.Context, hostname, password string) (bool, error)

func UpdateIP

func UpdateIP(ctx context.Context, hostname, password, myip string) (bool, error)

func UpdateTXT

func UpdateTXT(ctx context.Context, hostname, password, txt string) (bool, error)

func processResponse

func processResponse(msg string) (bool, error)

type Client

type Client struct {
    client *resty.Client
}
func New
func New(cli *resty.Client) Client
func (Client) CheckAuth
func (c Client) CheckAuth(ctx context.Context, hostname, password string) (bool, error)
func (Client) UpdateIP
func (c Client) UpdateIP(ctx context.Context, hostname, password, myip string) (bool, error)
func (Client) UpdateTXT
func (c Client) UpdateTXT(ctx context.Context, hostname, password, txt string) (bool, error)
func (Client) update
func (c Client) update(ctx context.Context, form map[string]string) (string, error)

type ErrAPI

ErrAPI is an error that is returned when the http client returns an error.

type ErrAPI struct {
    error error
}
func (*ErrAPI) Error
func (e *ErrAPI) Error() string
func (*ErrAPI) Unwrap
func (e *ErrAPI) Unwrap() []error

type ErrAbuse

ErrAbuse is an error that is returned when too many requests were performed.

type ErrAbuse struct {
}
func (*ErrAbuse) Error
func (e *ErrAbuse) Error() string
func (*ErrAbuse) Unwrap
func (e *ErrAbuse) Unwrap() []error

type ErrAuthFailed

ErrAuthFailed is an error that is returned when authentication fails.

type ErrAuthFailed struct{}
func (*ErrAuthFailed) Error
func (e *ErrAuthFailed) Error() string
func (*ErrAuthFailed) Unwrap
func (e *ErrAuthFailed) Unwrap() []error

type ErrDDNS

ErrDDNS error is returned when interation against the DDNS endpoint fails.

type ErrDDNS struct {
    error string
}
func (*ErrDDNS) Error
func (e *ErrDDNS) Error() string
func (*ErrDDNS) Unwrap
func (e *ErrDDNS) Unwrap() []error

type ErrField

ErrField an error that is returned when the request is malformed.

type ErrField struct {
    error string
}
func (*ErrField) Error
func (e *ErrField) Error() string
func (*ErrField) Unwrap
func (e *ErrField) Unwrap() []error
func (*ErrField) field
func (e *ErrField) field() (field string, ok bool)

type ErrUnknown

ErrUnknown is an error that is returned when the error cause is unknown.

type ErrUnknown struct {
    error string
}
func (*ErrUnknown) Error
func (e *ErrUnknown) Error() string
func (*ErrUnknown) Unwrap
func (e *ErrUnknown) Unwrap() []error

Generated by gomarkdoc

Documentation

Overview

*Notice:* This module is mostly oriented to validate the DDNS credentials. This is mostly a "hack" to validate the current DDNS status.

The functionalities related to update DDNS records are just for testing purposes. No support or enhancement will be provided for this module.

For more information about the API, please refer to: https://dns.he.net/docs.html

*About the API rate limit:* The API enfoces a rate limit based on the requested domain, thus it's only safe to fail one or two times the authentication against the same domain.

This forces us to randomise the domains used during testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAuth

func CheckAuth(ctx context.Context, hostname, password string) (bool, error)

func UpdateIP

func UpdateIP(ctx context.Context, hostname, password, myip string) (bool, error)

func UpdateTXT

func UpdateTXT(ctx context.Context, hostname, password, txt string) (bool, error)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(cli *resty.Client) Client

func (Client) CheckAuth

func (c Client) CheckAuth(ctx context.Context, hostname, password string) (bool, error)

func (Client) UpdateIP

func (c Client) UpdateIP(ctx context.Context, hostname, password, myip string) (bool, error)

func (Client) UpdateTXT

func (c Client) UpdateTXT(ctx context.Context, hostname, password, txt string) (bool, error)

type ErrAPI

type ErrAPI struct {
	// contains filtered or unexported fields
}

ErrAPI is an error that is returned when the http client returns an error.

func (*ErrAPI) Error

func (e *ErrAPI) Error() string

func (*ErrAPI) Unwrap

func (e *ErrAPI) Unwrap() []error

type ErrAbuse

type ErrAbuse struct {
}

ErrAbuse is an error that is returned when too many requests were performed.

func (*ErrAbuse) Error

func (e *ErrAbuse) Error() string

func (*ErrAbuse) Unwrap

func (e *ErrAbuse) Unwrap() []error

type ErrAuthFailed

type ErrAuthFailed struct{}

ErrAuthFailed is an error that is returned when authentication fails.

func (*ErrAuthFailed) Error

func (e *ErrAuthFailed) Error() string

func (*ErrAuthFailed) Unwrap

func (e *ErrAuthFailed) Unwrap() []error

type ErrDDNS

type ErrDDNS struct {
	// contains filtered or unexported fields
}

ErrDDNS error is returned when interation against the DDNS endpoint fails.

func (*ErrDDNS) Error

func (e *ErrDDNS) Error() string

func (*ErrDDNS) Unwrap

func (e *ErrDDNS) Unwrap() []error

type ErrField

type ErrField struct {
	// contains filtered or unexported fields
}

ErrField an error that is returned when the request is malformed.

func (*ErrField) Error

func (e *ErrField) Error() string

func (*ErrField) Unwrap

func (e *ErrField) Unwrap() []error

type ErrUnknown

type ErrUnknown struct {
	// contains filtered or unexported fields
}

ErrUnknown is an error that is returned when the error cause is unknown.

func (*ErrUnknown) Error

func (e *ErrUnknown) Error() string

func (*ErrUnknown) Unwrap

func (e *ErrUnknown) Unwrap() []error

Jump to

Keyboard shortcuts

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