model

package
v0.0.0-...-abea403 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2014 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindLine

func FindLine(text []byte, offset int64) (line int64, char int64)

func GetJSONFromFile

func GetJSONFromFile(filename string) (interface{}, error)

Types

type Branch

type Branch struct {
	Selector string
	Targets  []string
	Records  []Record
}

func (*Branch) Matches

func (sb *Branch) Matches(query string) (bool, error)

Test whether a branch matches a query.

The branch's Selector property is used as a regex - if the query string passes that regex, the branch matches.

func (*Branch) Normalize

func (sb *Branch) Normalize()

Fill in data that was left implied via defaults

type Page

type Page struct {
	Meta     PageMeta
	Branches []Branch
}

func (*Page) GetBranchForQuery

func (sp *Page) GetBranchForQuery(query string) *Branch

Does not forward errors from Branch.Matches (which would error on bad regexes, for example).

Result will either be a valid Branch pointer or nil, depending on whether a matching branch exists. If there are multiple branches that could have matched, you will always get the first one in the array. This is by design, and why branch order matters.

func (*Page) LoadFrom

func (sp *Page) LoadFrom(data interface{}) error

func (*Page) Normalize

func (sp *Page) Normalize()

Fill in data that was left implied via defaults

type PageMeta

type PageMeta struct {
	Authority string
	Contact   string
	About     string
	Policy    string
}

type Record

type Record struct {
	DomainName string      `json:"domain_name"`
	Rttl       int         `json:"rttl"`
	Rclass     string      `json:"rclass"`
	Rtype      string      `json:"rtype"`
	Rdata      interface{} `json:"rdata"`
}

func (*Record) Normalize

func (r *Record) Normalize()

Fill in data that was left implied via defaults

func (*Record) RdataString

func (r *Record) RdataString() (string, error)

func (*Record) ToDns

func (r *Record) ToDns() (dns.RR, error)

Export the data as dns.RR

Jump to

Keyboard shortcuts

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