domain

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package domain parses DNS domain names.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortDomains

func SortDomains(s []Domain)

SortDomains sorts a list of domains according to their ASCII representations.

func StringToASCII added in v1.7.2

func StringToASCII(domain string) string

StringToASCII normalizes a domain with best efforts, ignoring errors.

Types

type Domain

type Domain interface {
	// DNSNameASCII gives a name suitable for accessing the Cloudflare API
	DNSNameASCII() string

	// Describe gives the most human-readable domain name that is still unambiguous
	Describe() string

	// Zones iterates from the smallest possible zone to largest ones (the root).
	Zones(yield func(ZoneNameASCII string) bool)
}

A Domain represents a domain name to update.

func New

func New(domain string) (Domain, error)

New normalizes a domain to its ASCII form and then stores the normalized domain in its Unicode form when the round trip gives back the same ASCII form without errors. Otherwise, the ASCII form (possibly using Punycode) is stored to avoid ambiguity.

type FQDN

type FQDN string

FQDN is a fully qualified domain in its ASCII form.

func (FQDN) DNSNameASCII

func (f FQDN) DNSNameASCII() string

DNSNameASCII retruns the ASCII form of the FQDN.

func (FQDN) Describe

func (f FQDN) Describe() string

Describe gives a human-readible representation of the FQDN.

func (FQDN) Zones added in v1.14.1

func (f FQDN) Zones(yield func(ZoneNameASCII string) bool)

Zones starts from a.b.c for the domain a.b.c.

type Wildcard

type Wildcard string

Wildcard is a fully qualified zone name in its ASCII form, represnting the wildcard domain name under the zone. For example, Wildcard("example.org") represents *.example.org.

func (Wildcard) DNSNameASCII

func (w Wildcard) DNSNameASCII() string

DNSNameASCII retruns the ASCII form of the wildcard domain.

func (Wildcard) Describe

func (w Wildcard) Describe() string

Describe gives a human-readible representation of the wildcard domain.

func (Wildcard) Zones added in v1.14.1

func (w Wildcard) Zones(yield func(ZoneNameASCII string) bool)

Zones starts from a.b.c for the wildcard domain *.a.b.c.

Jump to

Keyboard shortcuts

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