dyndns

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPublicIPv4

func GetPublicIPv4() (string, error)

Equal to getPublicIP("ipv4")

func GetPublicIPv6

func GetPublicIPv6() (string, error)

Equal to getPublicIP("ipv6")

func HasIPv6Support

func HasIPv6Support() bool

Check if host has an IPv6 interface

func Run

func Run(c Client, interval time.Duration)

Fetch the public IP(s) and run Update() periodically. Is executed as blocking and for forever. Will not continue run of the loop if an error occurs. Exits gracefully on SIGTERM

func ValidIPv4

func ValidIPv4(ip string) bool

Validate if a string is an IPv4

func ValidIPv6

func ValidIPv6(ip string) bool

Validate if a string is an IPv6

Types

type Client

type Client interface {
	Data() *ClientData
	Update() error
}

func NewTestClient

func NewTestClient(token string, proxy bool) (Client, error)

Create a new testClient, fails if the token is empty

type ClientData

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

ClientData is a struct that contains data needed for all Clients

func NewClientData

func NewClientData(proxy bool) *ClientData

func (*ClientData) AddDomain

func (d *ClientData) AddDomain(domain string)

Add a domain to the list of domains

func (*ClientData) CheckData

func (d *ClientData) CheckData() error

Checks if data contains at least one IP and one domain Returns error otherwise

func (*ClientData) Domains

func (d *ClientData) Domains() []string

func (*ClientData) IPv4

func (d *ClientData) IPv4() string

func (*ClientData) IPv6

func (d *ClientData) IPv6() string

func (*ClientData) Proxy

func (d *ClientData) Proxy() bool

func (*ClientData) SetDomains

func (d *ClientData) SetDomains(domains []string)

Set domains to update, overrides previous domains

func (*ClientData) SetIPv4

func (d *ClientData) SetIPv4(val string) error

Set IPv4 Address to use for creating entries Returns an error if string is neither empty nor a valid IP Address

func (*ClientData) SetIPv6

func (d *ClientData) SetIPv6(val string) error

Set IPv6 Address to use for creating entries Returns an error if string is neither empty nor a valid IP Address

func (*ClientData) SetProxy

func (d *ClientData) SetProxy(proxy bool)

Set proxy value

type ErrHttpRequestFailed

type ErrHttpRequestFailed struct {
	StatusCode int
	Body       string
}

Shows the actual status code, as well as the response body. Shows the error instead if it can't read the response body.

func NewErrHttpRequestFailed

func NewErrHttpRequestFailed(status int, resBody io.ReadCloser) *ErrHttpRequestFailed

func (*ErrHttpRequestFailed) Error

func (e *ErrHttpRequestFailed) Error() string

type ErrInvalidIP

type ErrInvalidIP struct {
	IP string
}

func (*ErrInvalidIP) Error

func (e *ErrInvalidIP) Error() string

type ErrMissingEndpoint

type ErrMissingEndpoint struct{}

func (ErrMissingEndpoint) Error

func (e ErrMissingEndpoint) Error() string

type ErrMissingToken

type ErrMissingToken struct{}

func (ErrMissingToken) Error

func (e ErrMissingToken) Error() string

type ErrNoDomain

type ErrNoDomain struct{}

func (ErrNoDomain) Error

func (e ErrNoDomain) Error() string

type ErrNoIP

type ErrNoIP struct{}

func (ErrNoIP) Error

func (e ErrNoIP) Error() string

type ErrOperationFailed

type ErrOperationFailed struct {
	Result string
}

Outputs the response received from cloudflare

func NewErrOperationFailed

func NewErrOperationFailed(res io.ReadCloser) *ErrOperationFailed

func (*ErrOperationFailed) Error

func (e *ErrOperationFailed) Error() string

Jump to

Keyboard shortcuts

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