internal

package
v4.17.2 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBaseURL = "https://api.namecheap.com/xml.response"
	SandboxBaseURL = "https://api.sandbox.namecheap.com/xml.response"
)

Default API endpoints.

Variables

This section is empty.

Functions

func GetClientIP

func GetClientIP(ctx context.Context, client *http.Client, debug bool) (addr string, err error)

GetClientIP returns the client's public IP address. It uses namecheap's IP discovery service to perform the lookup.

Types

type Client

type Client struct {
	BaseURL    string
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client the API client for Namecheap.

func NewClient

func NewClient(apiUser string, apiKey string, clientIP string) *Client

NewClient creates a new Client.

func (*Client) GetHosts

func (c *Client) GetHosts(ctx context.Context, sld, tld string) ([]Record, error)

GetHosts reads the full list of DNS host records. https://www.namecheap.com/support/api/methods/domains-dns/get-hosts.aspx

func (*Client) SetHosts

func (c *Client) SetHosts(ctx context.Context, sld, tld string, hosts []Record) error

SetHosts writes the full list of DNS host records . https://www.namecheap.com/support/api/methods/domains-dns/set-hosts.aspx

type Record

type Record struct {
	Type    string `xml:",attr"`
	Name    string `xml:",attr"`
	Address string `xml:",attr"`
	MXPref  string `xml:",attr"`
	TTL     string `xml:",attr"`
}

Record describes a DNS record returned by the Namecheap DNS gethosts API. Namecheap uses the term "host" to refer to all DNS records that include a host field (A, AAAA, CNAME, NS, TXT, URL).

Jump to

Keyboard shortcuts

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