utils

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorJson

func ColorJson(jsonData []byte) ([]byte, error)

func FormatUnixTime

func FormatUnixTime(seconds interface{}) string

Format a unix time value returned by the API in a way that is human-readable.

func FormatUnixTimeF

func FormatUnixTimeF(seconds interface{}, fmt string) string

func MakeTemplateHelpers

func MakeTemplateHelpers(t *template.Template) template.FuncMap

Returns the template helper functions accessible to our templates.

func RoundTripJson

func RoundTripJson(obj interface{}) interface{}

Convert a JSON-serializable value to a model of interface{} maps and slices. Effectively serializing the object to maps/slices with the JSON model.

func SaveConfig

func SaveConfig(key string, value interface{})

Save a value to the configuration file.

Types

type DnsClass added in v1.6.0

type DnsClass uint16
const (
	DnsClassIN DnsClass = 1
	DnsClassCH DnsClass = 3
	DnsClassHS DnsClass = 4
)

func (DnsClass) String added in v1.6.0

func (t DnsClass) String() string

type RecordTtl added in v1.6.0

type RecordTtl uint32

func (RecordTtl) String added in v1.6.0

func (ttl RecordTtl) String() string

type RecordType added in v1.6.0

type RecordType uint16
const (
	RecordTypeA     RecordType = 1
	RecordTypeNS    RecordType = 2
	RecordTypeCNAME RecordType = 5
	// SOA is not supported by Level27 but it shows up a lot so we should be able to parse it.
	RecordTypeSOA  RecordType = 6
	RecordTypeMX   RecordType = 15
	RecordTypeTXT  RecordType = 16
	RecordTypeAAAA RecordType = 28
	RecordTypeSRV  RecordType = 33
	RecordTypeDS   RecordType = 43
	RecordTypeTLSA RecordType = 52
	RecordTypeCAA  RecordType = 257
)

func (RecordType) String added in v1.6.0

func (t RecordType) String() string

type ZoneEntry added in v1.6.0

type ZoneEntry interface {
	IsZoneEntry()
}

Base type for all entry types parseable in a zone file.

type ZoneEntryInclude added in v1.6.0

type ZoneEntryInclude struct {
	FileName   string
	DomainName string
}

$INCLUDE zone file entry.

func (ZoneEntryInclude) IsZoneEntry added in v1.6.0

func (ZoneEntryInclude) IsZoneEntry()

type ZoneEntryOrigin added in v1.6.0

type ZoneEntryOrigin struct {
	DomainName string
}

$ORIGIN zone file entry.

func (ZoneEntryOrigin) IsZoneEntry added in v1.6.0

func (ZoneEntryOrigin) IsZoneEntry()

func (ZoneEntryOrigin) String added in v1.6.0

func (e ZoneEntryOrigin) String() string

type ZoneEntryRr added in v1.6.0

type ZoneEntryRr struct {
	// Can be nil to indicate not given for record
	DomainName *string
	// Can be nil to indicate not given for record
	Class *DnsClass
	// Can be nil to indicate not given for record
	Ttl *RecordTtl
	// Type of the record.
	Type RecordType
	// Record data is given as an unstructed set of strings.
	Data []string
}

Resource Record zone file entry.

func (ZoneEntryRr) IsZoneEntry added in v1.6.0

func (ZoneEntryRr) IsZoneEntry()

func (ZoneEntryRr) String added in v1.6.0

func (e ZoneEntryRr) String() string

type ZoneEntryTtl added in v1.6.0

type ZoneEntryTtl struct {
	Ttl RecordTtl
}

$TTL zone file entry.

func (ZoneEntryTtl) IsZoneEntry added in v1.6.0

func (ZoneEntryTtl) IsZoneEntry()

func (ZoneEntryTtl) String added in v1.6.0

func (e ZoneEntryTtl) String() string

type ZoneParser added in v1.6.0

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

func NewZoneParser added in v1.6.0

func NewZoneParser(reader io.Reader) ZoneParser

func (*ZoneParser) NextEntry added in v1.6.0

func (z *ZoneParser) NextEntry() (ZoneEntry, error)

Parse an entry from the input. This moves the parser forward in the input.

Jump to

Keyboard shortcuts

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