Documentation ¶
Index ¶
- Constants
- func CreateCacheDir(cacheRootDir string) error
- type CacheFile
- type Entry
- type Request
- func (nr *Request) DetectLoop() bool
- func (nr *Request) Equal(other *Request) bool
- func (nr *Request) Exceptions() tools.Exceptions
- func (nr *Request) Name() string
- func (nr *Request) RequestTopic() RequestTopic
- func (nr *Request) Result() (*Entry, *errors.ErrorStack)
- func (nr *Request) ResultWithSpecificTimeout(dur time.Duration) (*Entry, *errors.ErrorStack)
- func (nr *Request) SetResult(resEntry *Entry, err *errors.ErrorStack)
- type RequestTopic
Constants ¶
const CACHE_DIRNAME = "nameresolver"
CACHE_DIRNAME is the name of the directory under the cache root directory for storage of name resolution cache files
Variables ¶
This section is empty.
Functions ¶
func CreateCacheDir ¶
CreateCacheDir creates the cache dir for storage of name resolution 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.
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
Entry represents the resolution of a name, either into an alias (CNAME) or a list of IP addresses (both v4 and v6).
func NewAliasEntry ¶
NewAliasEntry is the constructor of an entry whose content symbolizes a domain name owning just a CNAME.
func NewIPEntry ¶
NewIPEntry is the constructor of an entry whose content is a domain name and its associated IP addresses.
func (*Entry) CNAMETarget ¶
func (*Entry) UnmarshalJSON ¶
Implements json.Unmarshaler
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request represents a request to the name resolution "finder".
func NewRequest ¶
func NewRequest(name string, except tools.Exceptions) *Request
NewRequest builds a new Request instance. This is the standard way of building new requests from a third-party module.
func NewRequestWithContext ¶
func NewRequestWithContext(name string, except tools.Exceptions, ctx *Request) *Request
NewRequestWithContext builds a new Request instance, adding some context information to it to prevent resolution loops. This is mainly used by github.com/ANSSI-FR/transdep/nameresolver
func (*Request) DetectLoop ¶
DetectLoop returns true if this request is part of a resolution loop
func (*Request) Exceptions ¶
func (nr *Request) Exceptions() tools.Exceptions
func (*Request) RequestTopic ¶
func (nr *Request) RequestTopic() RequestTopic
func (*Request) Result ¶
func (nr *Request) Result() (*Entry, *errors.ErrorStack)
Result returns the result of a name resolution or an error. The error may be caused by a timeout after the default timeout duration, or an error during the resolution process.
func (*Request) ResultWithSpecificTimeout ¶
ResultWithSpecificTimeout is similar to Result except that a timeout duration may be specified.
type RequestTopic ¶
type RequestTopic struct { // name is the request topic. Name string // except is the list of exceptions/violations of the DNS protocol that we are willing to accept for this query Exceptions tools.Exceptions }