zonecut

package
v0.0.0-...-3d855e8 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2018 License: BSD-2-Clause Imports: 11 Imported by: 3

Documentation

Index

Constants

View Source
const CACHE_DIRNAME = "zonecut"

CACHE_DIRNAME is the name of the directory under the cache root directory for storage of zone cut cache files

Variables

This section is empty.

Functions

func CreateCacheDir

func CreateCacheDir(cacheRootDir string) error

CreateCacheDir creates the cache dir for storage of zone cut cache files. It may return an error if the directory cannot be created. If the directory already exists, this function does nothing.

Types

type CacheFile

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

CacheFile represents just that.

func NewCacheFile

func NewCacheFile(cacheRootDir string, topic RequestTopic) *CacheFile

NewCacheFile initializes a new CacheFile struct, based on the cache root dir, and the name of the domain that is the subject of this cache file.

func NewExistingCacheFile

func NewExistingCacheFile(cacheRootDir string, topic RequestTopic) (*CacheFile, error)

NewCacheFile initializes a new CacheFile struct and ensures that this file exists or else returns an error.

func (*CacheFile) Result

func (cf *CacheFile) Result() (entry *Entry, resultError *errors.ErrorStack, err error)
Result returns the entry or the error that were stored in the cache file. An error may also be returned, if an

incident happens during retrieval/interpretation of the cache file.

entry is the entry that was stored in the cache file.

resultError is the resolution error that was stored in the cache file.

err is the error that may happen during retrieval of the value in the cache file.

func (*CacheFile) SetResult

func (cf *CacheFile) SetResult(entry *Entry, resultErr *errors.ErrorStack) error

SetResult writes in the cache file the provided entry or error. An error is returned if an incident happens or else nil is returned.

type Entry

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

Entry contains the response to a zonecut request when no error occurred. It contains information about the delegation of a zone,

func NewEntry

func NewEntry(domain string, DNSSECEnabled bool, nameServers []*NameSrvInfo) *Entry

NewEntry builds a new entry, and performs some normalization on the input values.

func (*Entry) DNSSEC

func (e *Entry) DNSSEC() bool

func (*Entry) Domain

func (e *Entry) Domain() string

func (*Entry) MarshalJSON

func (e *Entry) MarshalJSON() ([]byte, error)

func (*Entry) NameServers

func (e *Entry) NameServers() []*NameSrvInfo

func (*Entry) SetDNSSEC

func (e *Entry) SetDNSSEC(val bool)

SetDNSSEC allows modification of the DNSSEC status relative to that entry, if need be afterwards

func (*Entry) String

func (e *Entry) String() string

func (*Entry) UnmarshalJSON

func (e *Entry) UnmarshalJSON(bstr []byte) error

type NameSrvInfo

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

func NewNameSrv

func NewNameSrv(name string, addrs []net.IP) *NameSrvInfo

func (*NameSrvInfo) Addrs

func (n *NameSrvInfo) Addrs() []net.IP

func (*NameSrvInfo) MarshalJSON

func (n *NameSrvInfo) MarshalJSON() ([]byte, error)

func (*NameSrvInfo) Name

func (n *NameSrvInfo) Name() string

func (*NameSrvInfo) UnmarshalJSON

func (n *NameSrvInfo) UnmarshalJSON(bstr []byte) error

type Request

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

Request contains the elements of a request for a delegation information

func NewRequest

func NewRequest(name string, exceptions tools.Exceptions) *Request

NewRequest builds a new request instance

func (*Request) Domain

func (zcr *Request) Domain() string

func (*Request) Equal

func (zcr *Request) Equal(other *Request) bool

func (*Request) Exceptions

func (zcr *Request) Exceptions() tools.Exceptions

func (*Request) RequestTopic

func (zcr *Request) RequestTopic() RequestTopic

func (*Request) Result

func (zcr *Request) Result() (*Entry, *errors.ErrorStack)

Result returns the result of this request. It blocks for the default timeout duration or until an answer is provided. An error is returned upon timeout or if an incident occurred during the discovery of the delegation information. The entry might value nil even if error is nil too, if the request topic is not a zone apex.

func (*Request) ResultWithSpecificTimeout

func (zcr *Request) ResultWithSpecificTimeout(dur time.Duration) (*Entry, *errors.ErrorStack)

ResultWithSpecificTimeout is identical to Result except a timeout duration may be specified.

func (*Request) SetResult

func (zcr *Request) SetResult(res *Entry, err *errors.ErrorStack)

SetResult is used to set/pass along the result associated to this request This function is meant to be called only once, though the implemention does not currently prevent this.

type RequestTopic

type RequestTopic struct {
	// domain is the topic of the request: the name whose delegation info is sought.
	Domain string
	// exceptions is the list of exceptions we are willing to make for this request w.r.t to the DNS standard
	Exceptions tools.Exceptions
}

Jump to

Keyboard shortcuts

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