dnsdata

package
v0.0.0-...-d4f9e80 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LongTTL  = 86400  // the default TTL for most of the record types
	ShortTTL = 2560   // the default TTL for SOA records
	LinkTTL  = 259200 // the default TTL for NS records
)

TTL constants

View Source
const (
	// RangePointKeyMarker is the prefix for the RangePoint keys
	RangePointKeyMarker = "\000\000\000!"
	// MlenNoLoc is the special value of the mask length byte indicating the location is not defined.
	// As it finds its way into the values of the keys, it must stay zero.
	MlenNoLoc = 0
	// FeaturesKey is a special key storing bitmap what format is used for other keys in DB
	FeaturesKey = "\x00o_features"
	// ResourceRecordsKeyMarker is the prefix for the resource record keys
	ResourceRecordsKeyMarker = "\000o"
)
View Source
const (
	// InitLocationCount is the initial locationCount for NewRearranger
	InitLocationCount = 2
)
View Source
const (
	// NUMFIELDS is the number of fields to guarantee upon splitting
	NUMFIELDS = 15
)

Variables

View Source
var (
	SEP  = []byte(":") // original record separator
	NSEP = []byte(",") // [FB-only] IPv6-friendly record separator
)

two variants of separators

View Source
var ErrBadMode = errors.New("bad combination of mode/flags")

ErrBadMode is returned when a function is called with unexpected combination of operation settings

View Source
var ErrBadRType = errors.New("bad record type")

ErrBadRType is an error returned when a record with an invalid type character encountered.

View Source
var ErrInvalidLocation = errors.New("location should be either nil or exactly 2 bytes long as FBDNS depends on it")

ErrInvalidLocation is used when location doesn't match expectations (nil or exactly 2 bytes)

Functions

func DeriveSerial

func DeriveSerial(f *os.File) (uint32, error)

func GetSubnets

func GetSubnets(dataPath string) ([]*net.IPNet, error)

GetSubnets parsed data file in tinydns format and returns all subnets from Net records (prefix %)

func ParseIPNet

func ParseIPNet(s string) (ipnet *net.IPNet, err error)

ParseIPNet parses a CIDR notation string into a net.IPNet, handling the case when the input is a plain IP address.

func ParseRecords

func ParseRecords(r io.Reader, codec *Codec, results chan<- Record, workers int) error

ParseRecords parses data from io.Reader and returns results via results chan. Data is parsed in parallel when workers != 1.

func ParseStream

func ParseStream(r io.Reader, codec *Codec, results chan<- []MapRecord, workers int) error

ParseStream parses data from io.Reader and returns results via results chan. Data is parsed in parallel when workers != 1.

func Reverseaddr

func Reverseaddr(ip net.IP) []byte

Reverseaddr returns the in-addr.arpa. or ip6.arpa. hostname of the IP address addr suitable for rDNS (PTR) record lookup or an error if it fails to parse the IP address. (lifted from https://golang.org/src/net/dnsclient.go?m=text)

func WireTypeToTerraformString

func WireTypeToTerraformString(t WireType) (string, error)

WireTypeToTerraformString converts WireType enum to Terraform type format

Types

type Accum

type Accum struct {
	NoPrefixSets bool // if set, disables emission of the prefix set records - use with Ranger.Enable()

	Ranger SubnetRanger
	// contains filtered or unexported fields
}

Accum accumulates information about subnets we parsed

func (*Accum) MarshalMap

func (r *Accum) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Accum) MarshalText

func (r *Accum) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaller

func (*Accum) OpenScanner

func (r *Accum) OpenScanner() (s *AccumulatorScanner, err error)

OpenScanner creates scanner through accumulated records note that Accum will remain locked until all records are scanned (Scan returns false)

type AccumulatorScanner

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

AccumulatorScanner allows lazy reading of lines generated by accumulator

func (AccumulatorScanner) Err

func (s AccumulatorScanner) Err() error

Err returns error if Scanner met any issues, nil otherwise

func (AccumulatorScanner) Scan

func (s AccumulatorScanner) Scan() bool

Scan pushes scanner to new line if one exists. In this case result will be true and that line could be read with Text() method

func (AccumulatorScanner) Text

func (s AccumulatorScanner) Text() string

Text returns current line

type Codec

type Codec struct {
	Serial       uint32    // default SOA serial
	Acc          Accum     // a meta-record which represents an accumulated state over the whole data set
	NoRnetOutput bool      // if set, disables Rnet ("%"-records) output in the output - use with Acc.Ranger.Enable()
	Features     Rfeatures // a meta-record with features supported by generated DB
}

Codec provides accumulator and serial to construct all records

func (*Codec) ConvertLn

func (c *Codec) ConvertLn(text []byte) ([]MapRecord, error)

ConvertLn is the main function used to parse line into MapRecords

func (*Codec) DecodeLn

func (c *Codec) DecodeLn(text []byte) (Record, error)

DecodeLn parses a line without converting

func (*Codec) Preprocess

func (c *Codec) Preprocess(r io.Reader, w io.Writer) error

Preprocess reads textual data from r and writes an equivalent set - which includes the aggregated records - to w.

type CompositeRecord

type CompositeRecord interface {
	DerivedRecords() []Record
}

CompositeRecord is the interface implemented by records which are mapped to 2 or more simple records

type Feature

type Feature uint32

Feature is a bitmap representing different characteristics of DB data

const (
	// V1KeysFeature if set in features key means V2 keys are available in DB
	//  - natural order zone names used in maps (ex facebook.com.)
	//  - no additional prefix for owner name
	//  - location is added as prefix to owner names
	V1KeysFeature Feature = 1 << iota
	// V2KeysFeature if set in features key means V2 keys are available in DB
	//  - reverse zone names in maps (.com.facebook instead of facebook.com.)
	//  - uses \x00o prefix for owner names
	//  - location is added as suffix to owner names, not as prefix
	V2KeysFeature
)

func DecodeFeatures

func DecodeFeatures(data []byte) Feature

DecodeFeatures byte array stored in DB to a Feature

type IPv6

type IPv6 [16]byte

IPv6 is a storage-efficient replacement for net.IP struct net.IP stores IPv6/IPv4 addresses as slices which is really inefficient on 64-bit architecture: * IPv6 takes 40 bytes: 24 bytes slice header + 16 bytes data * IPv4 takes 28 bytes: 24 bytes slice header + 4 bytes data on top of it slice has a reference so it is more expensive for GC handling so this class address that storage inefficiency though delegating a lot of functionality to net.IP class

func FromNetIP

func FromNetIP(other net.IP) IPv6

FromNetIP performs conversion from net.IP structure to more storage efficient IPv6

func ParseIP

func ParseIP(s string) IPv6

ParseIP parses string IP representation to the byte structure

func (IPv6) Equal

func (ip IPv6) Equal(other IPv6) bool

Equal checks equality with another IPv6 object

func (IPv6) EqualToNetIP

func (ip IPv6) EqualToNetIP(other net.IP) bool

EqualToNetIP checks equality to net.IP object

func (IPv6) MarshalText

func (ip IPv6) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler

func (IPv6) String

func (ip IPv6) String() string

String gets string representation of IP

func (IPv6) To4

func (ip IPv6) To4() net.IP

To4 attempts to extract IPv4 if it possible if not - returns nil

type Lmap

type Lmap []byte

Lmap is map ID

func (Lmap) String

func (m Lmap) String() string

type Loc

type Loc []byte

Loc is location ID

type MapMarshaler

type MapMarshaler interface {
	MarshalMap() ([]MapRecord, error)
}

MapMarshaler is the interface used in parsing implemented by all record types

type MapRecord

type MapRecord struct {
	Key   []byte
	Value []byte
}

MapRecord is our main record to represent parsed DNS record

func Parse

func Parse(r io.Reader, codec *Codec, workers int) ([]MapRecord, error)

Parse parses data from Reader in parallel, wrapping ParseStream

type PreprocReader

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

PreprocReader is a streaming io.Reader version of preprocessor

func NewPreprocReader

func NewPreprocReader(r io.Reader, c *Codec) *PreprocReader

NewPreprocReader creates reader that processes input line by line and filters/changes it according to codec settings

func (*PreprocReader) Err

func (p *PreprocReader) Err() error

Err returns error if reader failed

func (*PreprocReader) Read

func (p *PreprocReader) Read(buf []byte) (int, error)

Read implements io.Reader interface

func (*PreprocReader) Scan

func (p *PreprocReader) Scan() bool

Scan pushes Reader to a new line, similar to bufio.Scanner

func (*PreprocReader) Text

func (p *PreprocReader) Text() string

Text returns current reader line

type Raddr

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

Raddr is + → A/AAAA

func (*Raddr) DomainName

func (r *Raddr) DomainName() string

DomainName returns associated record domain name

func (*Raddr) Location

func (r *Raddr) Location() Loc

Location returns location for which record could be used

func (*Raddr) MarshalMap

func (r *Raddr) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Raddr) MarshalText

func (r *Raddr) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Raddr) TTL

func (r *Raddr) TTL() uint32

TTL returns TTL for the record

func (*Raddr) TerraformValue

func (r *Raddr) TerraformValue() (string, error)

TerraformValue implements TerraformRecord interface

func (*Raddr) UnmarshalText

func (r *Raddr) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

func (*Raddr) WireType

func (r *Raddr) WireType() WireType

WireType implements WireRecord interface

type RangePoint

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

RangePoint stores range point along with associated location ID

func (*RangePoint) LocID

func (p *RangePoint) LocID() []byte

LocID returns the location ID for this range

func (*RangePoint) LocIsNull

func (p *RangePoint) LocIsNull() bool

LocIsNull checks if the rangeLocation is a null value (no location defined)

func (*RangePoint) MarshalTextForLmap

func (p *RangePoint) MarshalTextForLmap(lmap string) (text []byte, err error)

MarshalTextForLmap returns a text representation of these RangePoints, with provided lmap value

func (*RangePoint) MaskLen

func (p *RangePoint) MaskLen() uint8

MaskLen returns the length of the matched mask

func (*RangePoint) String

func (p *RangePoint) String() string

String returns a string representation of this location, used for debugging

func (*RangePoint) To16

func (p *RangePoint) To16() IPv6

To16 returns 16-byte IP representation of the rangeStart

type RangePoints

type RangePoints []*RangePoint

RangePoints is an array of RangePoint, the only reason for it to exist is the String() method

func (RangePoints) String

func (r RangePoints) String() string

String returns a string representation of these RangePoints, useful for debugging

type Raux

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

Raux is : → (anything else)

func (*Raux) DomainName

func (r *Raux) DomainName() string

DomainName returns associated record domain name

func (*Raux) Location

func (r *Raux) Location() Loc

Location returns location for which record could be used

func (*Raux) MarshalMap

func (r *Raux) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Raux) MarshalText

func (r *Raux) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Raux) TTL

func (r *Raux) TTL() uint32

TTL returns TTL for the record

func (*Raux) UnmarshalText

func (r *Raux) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type Rcname

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

Rcname is C → CNAME

func (*Rcname) DomainName

func (r *Rcname) DomainName() string

DomainName returns associated record domain name

func (*Rcname) Location

func (r *Rcname) Location() Loc

Location returns location for which record could be used

func (*Rcname) MarshalMap

func (r *Rcname) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Rcname) MarshalText

func (r *Rcname) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Rcname) TTL

func (r *Rcname) TTL() uint32

TTL returns TTL for the record

func (*Rcname) TerraformValue

func (r *Rcname) TerraformValue() (string, error)

TerraformValue implements TerraformRecord interface

func (*Rcname) UnmarshalText

func (r *Rcname) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

func (*Rcname) WireType

func (r *Rcname) WireType() WireType

WireType implements WireRecord interface

type Rcsmap

type Rcsmap Ripmap

Rcsmap is [FB-only] 8 - define an EDNS client subnet-based map

func (*Rcsmap) MarshalMap

func (r *Rcsmap) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Rcsmap) MarshalText

func (r *Rcsmap) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Rcsmap) UnmarshalText

func (r *Rcsmap) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type Rdot

type Rdot struct {
	Rsoa
	Rns
	// contains filtered or unexported fields
}

Rdot is [composite] . → (NS, A, SOA)

func (*Rdot) DerivedRecords

func (r *Rdot) DerivedRecords() []Record

DerivedRecords implements CompositeRecord interface

func (*Rdot) DomainName

func (r *Rdot) DomainName() string

DomainName returns associated record domain name

func (*Rdot) Location

func (r *Rdot) Location() Loc

Location returns location for which record could be used

func (*Rdot) MarshalMap

func (r *Rdot) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Rdot) MarshalText

func (r *Rdot) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Rdot) TTL

func (r *Rdot) TTL() uint32

TTL returns TTL for the record

func (*Rdot) UnmarshalText

func (r *Rdot) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type Rearranger

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

Rearranger translates IP ranges with associated locations to "Start IP -> LocID" ranges

func NewRearranger

func NewRearranger(locationCount int) *Rearranger

NewRearranger creates an instance of Rearranger for estimated locationCount

func (*Rearranger) AddLocation

func (r *Rearranger) AddLocation(ipnet *net.IPNet, locID []byte) error

AddLocation converts the location into a pair of RangePoints, where: * the starting RangePoint is the first IP of the Location, and we immediately know the LocID for this RangePoint * the next RangePoint is the first IP _after_ the end of this Location, so it is marked as rangePointEnd, and the LocID is to be determined

func (*Rearranger) Rearrange

func (r *Rearranger) Rearrange() RangePoints

Rearrange returns a slice with RangePoints with resolved LocID for finish RangePoint. It also adds implicit "null" locations spanning all unmatched ranges (if necessary).

type Record

Record is the interface implemented by all record types

type Rfeatures

type Rfeatures struct {
	// if true:
	//  - reverse zone names in maps (.com.facebook instead of facebook.com.)
	//  - uses \x00o prefix for owner names
	//  - location is added as suffix to owner names, not as prefix
	UseV2Keys bool
}

Rfeatures [FB-only] - meta record storing set of features supported by current data format

func (*Rfeatures) MarshalMap

func (r *Rfeatures) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

type Rhttps

type Rhttps Rsvcb

Rhttps is HTTPS record, which is exactly SVCB but for HTTPS info exchange Type number is different

func (*Rhttps) MarshalMap

func (r *Rhttps) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Rhttps) MarshalText

func (r *Rhttps) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Rhttps) UnmarshalText

func (r *Rhttps) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

func (*Rhttps) WireType

func (r *Rhttps) WireType() WireType

WireType implements WireRecord interface

type Ripmap

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

Ripmap is [FB-only] M - define a resolver-based map

func (*Ripmap) MarshalMap

func (r *Ripmap) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Ripmap) MarshalText

func (r *Ripmap) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Ripmap) UnmarshalText

func (r *Ripmap) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type Rmx

type Rmx struct {
	Rmx1
	Raddr
	// contains filtered or unexported fields
}

Rmx is [composite] @ → (MX, A)

func (*Rmx) DerivedRecords

func (r *Rmx) DerivedRecords() []Record

DerivedRecords implements CompositeRecord interface

func (*Rmx) MarshalMap

func (r *Rmx) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Rmx) MarshalText

func (r *Rmx) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Rmx) UnmarshalText

func (r *Rmx) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type Rmx1

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

Rmx1 is just MX

func (*Rmx1) DomainName

func (r *Rmx1) DomainName() string

DomainName returns associated record domain name

func (*Rmx1) Location

func (r *Rmx1) Location() Loc

Location returns location for which record could be used

func (*Rmx1) MarshalMap

func (r *Rmx1) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Rmx1) MarshalText

func (r *Rmx1) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Rmx1) TTL

func (r *Rmx1) TTL() uint32

TTL returns TTL for the record

func (*Rmx1) TerraformValue

func (r *Rmx1) TerraformValue() (string, error)

TerraformValue implements TerraformRecord interface

func (*Rmx1) UnmarshalText

func (r *Rmx1) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

func (*Rmx1) WireType

func (r *Rmx1) WireType() WireType

WireType implements WireRecord interface

type Rnet

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

Rnet is "%" - Client subnet-to-location record. Used internally by the server to group client/resolver's subnets into locations.

func (*Rnet) MarshalMap

func (r *Rnet) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Rnet) MarshalText

func (r *Rnet) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Rnet) UnmarshalText

func (r *Rnet) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type Rns

type Rns struct {
	Rns1
	Raddr
	// contains filtered or unexported fields
}

Rns is [composite] & → (NS, A)

func (*Rns) DerivedRecords

func (r *Rns) DerivedRecords() []Record

DerivedRecords implements CompositeRecord interface

func (*Rns) MarshalMap

func (r *Rns) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Rns) MarshalText

func (r *Rns) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Rns) UnmarshalText

func (r *Rns) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type Rns1

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

Rns1 is just NS

func (*Rns1) DomainName

func (r *Rns1) DomainName() string

DomainName returns associated record domain name

func (*Rns1) Location

func (r *Rns1) Location() Loc

Location returns location for which record could be used

func (*Rns1) MarshalMap

func (r *Rns1) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Rns1) MarshalText

func (r *Rns1) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Rns1) TTL

func (r *Rns1) TTL() uint32

TTL returns TTL for the record

func (*Rns1) TerraformValue

func (r *Rns1) TerraformValue() (string, error)

TerraformValue implements TerraformRecord interface

func (*Rns1) UnmarshalText

func (r *Rns1) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

func (*Rns1) WireType

func (r *Rns1) WireType() WireType

WireType implements WireRecord interface

type Rpaddr

type Rpaddr Raddr

Rpaddr is [composite] = → (A/AAAA, PTR)

func (*Rpaddr) DerivedRecords

func (r *Rpaddr) DerivedRecords() []Record

DerivedRecords implements CompositeRecord interface

func (*Rpaddr) MarshalMap

func (r *Rpaddr) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Rpaddr) MarshalText

func (r *Rpaddr) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Rpaddr) UnmarshalText

func (r *Rpaddr) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type Rptr

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

Rptr is ^ → PTR

func (*Rptr) DomainName

func (r *Rptr) DomainName() string

DomainName returns associated record domain name

func (*Rptr) Location

func (r *Rptr) Location() Loc

Location returns location for which record could be used

func (*Rptr) MarshalMap

func (r *Rptr) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Rptr) MarshalText

func (r *Rptr) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Rptr) TTL

func (r *Rptr) TTL() uint32

TTL returns TTL for the record

func (*Rptr) TerraformValue

func (r *Rptr) TerraformValue() (string, error)

TerraformValue implements TerraformRecord interface

func (*Rptr) UnmarshalText

func (r *Rptr) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

func (*Rptr) WireType

func (r *Rptr) WireType() WireType

WireType implements WireRecord interface

type Rrangepoint

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

Rrangepoint [FB-only] - an internal record type generated from "%" records using the "rearrangement" process

func (*Rrangepoint) MarshalMap

func (r *Rrangepoint) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Rrangepoint) MarshalText

func (r *Rrangepoint) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Rrangepoint) UnmarshalText

func (r *Rrangepoint) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type Rsoa

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

Rsoa is "Z" - SOA record.

func (*Rsoa) DomainName

func (r *Rsoa) DomainName() string

DomainName returns associated record domain name

func (*Rsoa) Location

func (r *Rsoa) Location() Loc

Location returns location for which record could be used

func (*Rsoa) MarshalMap

func (r *Rsoa) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Rsoa) MarshalText

func (r *Rsoa) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Rsoa) TTL

func (r *Rsoa) TTL() uint32

TTL returns TTL for the record

func (*Rsoa) UnmarshalText

func (r *Rsoa) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

func (*Rsoa) WireType

func (r *Rsoa) WireType() WireType

WireType implements WireRecord interface

type Rsrv

type Rsrv struct {
	Rsrv1
	Raddr
	// contains filtered or unexported fields
}

Rsrv is [composite] S → (SRV, A)

func (*Rsrv) DerivedRecords

func (r *Rsrv) DerivedRecords() []Record

DerivedRecords implements CompositeRecord interface

func (*Rsrv) MarshalMap

func (r *Rsrv) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Rsrv) MarshalText

func (r *Rsrv) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Rsrv) UnmarshalText

func (r *Rsrv) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type Rsrv1

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

Rsrv1 is just SRV

func (*Rsrv1) DomainName

func (r *Rsrv1) DomainName() string

DomainName returns associated record domain name

func (*Rsrv1) Location

func (r *Rsrv1) Location() Loc

Location returns location for which record could be used

func (*Rsrv1) MarshalMap

func (r *Rsrv1) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Rsrv1) MarshalText

func (r *Rsrv1) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Rsrv1) TTL

func (r *Rsrv1) TTL() uint32

TTL returns TTL for the record

func (*Rsrv1) TerraformValue

func (r *Rsrv1) TerraformValue() (string, error)

TerraformValue implements TerraformRecord interface

func (*Rsrv1) UnmarshalText

func (r *Rsrv1) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

func (*Rsrv1) WireType

func (r *Rsrv1) WireType() WireType

WireType implements WireRecord interface

type Rsvcb

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

Rsvcb is SVCB (service binding) record other SVCB-like records share the same layout as Rsvcb's

func (*Rsvcb) DomainName

func (r *Rsvcb) DomainName() string

DomainName returns associated record domain name

func (*Rsvcb) Location

func (r *Rsvcb) Location() Loc

Location returns location for which record could be used

func (*Rsvcb) MarshalMap

func (r *Rsvcb) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler. It creates a map record for Rsvcb, based on the type of the caller. The map key includes the domain name and location, the value is "rrhead" + RDATA

func (*Rsvcb) MarshalText

func (r *Rsvcb) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Rsvcb) TTL

func (r *Rsvcb) TTL() uint32

TTL returns TTL for the record

func (*Rsvcb) UnmarshalText

func (r *Rsvcb) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type Rtxt

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

Rtxt is ' → TXT

func (*Rtxt) DomainName

func (r *Rtxt) DomainName() string

DomainName returns associated record domain name

func (*Rtxt) Location

func (r *Rtxt) Location() Loc

Location returns location for which record could be used

func (*Rtxt) MarshalMap

func (r *Rtxt) MarshalMap() ([]MapRecord, error)

MarshalMap implements MapMarshaler

func (*Rtxt) MarshalText

func (r *Rtxt) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*Rtxt) TTL

func (r *Rtxt) TTL() uint32

TTL returns TTL for the record

func (*Rtxt) TerraformValue

func (r *Rtxt) TerraformValue() (string, error)

TerraformValue implements TerraformRecord interface

func (*Rtxt) UnmarshalText

func (r *Rtxt) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

func (*Rtxt) WireType

func (r *Rtxt) WireType() WireType

WireType implements WireRecord interface

type Rtype

type Rtype string

Rtype is record type

type SubnetRanger

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

SubnetRanger represents an aggregate structure responsible for building the auxiliary structures for the subnet-based location lookup

func (*SubnetRanger) Enable

func (r *SubnetRanger) Enable()

Enable enables the functionality

func (*SubnetRanger) MarshalMap

func (r *SubnetRanger) MarshalMap() (result []MapRecord, err error)

MarshalMap implements MapMarshaler

func (*SubnetRanger) OpenScanner

func (r *SubnetRanger) OpenScanner() (s *SubnetRangerScanner)

OpenScanner creates Scanner which allows lazy reading of subnet range records in a text form

type SubnetRangerScanner

type SubnetRangerScanner struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

SubnetRangerScanner allows lazy reading of subnet range records in a text form

func (*SubnetRangerScanner) Err

func (s *SubnetRangerScanner) Err() error

Err returns error if Scanner met any issues, nil otherwise

func (*SubnetRangerScanner) Scan

func (s *SubnetRangerScanner) Scan() bool

Scan pushes scanner to new line if one exists. In this case result will be true and that line could be read with Text() method

func (*SubnetRangerScanner) SetError

func (s *SubnetRangerScanner) SetError(err error)

SetError sets error which happened during the scan (if any)

func (*SubnetRangerScanner) Text

func (s *SubnetRangerScanner) Text() string

Text returns current line

type TerraformRecord

type TerraformRecord interface {
	WireRecord
	TerraformValue() (string, error)
}

TerraformRecord provides ability to extract value for terraform configuration

type WireRecord

type WireRecord interface {
	WireType() WireType
	DomainName() string
	Location() Loc
	TTL() uint32
}

WireRecord is the interface implemented by all record types which could be transferred on a wire directly (non-composite or specialized ones)

type WireType

type WireType uint16

WireType represent DNS wire types

const (
	// TypeA represents A record type
	TypeA WireType = 1
	// TypeNS represents NS record type
	TypeNS WireType = 2
	// TypeCNAME represents CNAME record type
	TypeCNAME WireType = 5
	// TypeSOA represents SOA record type
	TypeSOA WireType = 6
	// TypePTR represents PTR record type
	TypePTR WireType = 12
	// TypeMX represents MX record type
	TypeMX WireType = 15
	// TypeTXT represents TXT record type
	TypeTXT WireType = 16
	// TypeAAAA represents AAAA record type
	TypeAAAA WireType = 28
	// TypeSRV represents SRV record type
	TypeSRV WireType = 33
	// TypeSVCB represents SVCB record type
	// for SVCB/HTTPS, see https://datatracker.ietf.org/doc/html/draft-ietf-dnsop-svcb-https-08
	TypeSVCB WireType = 64
	// TypeHTTPS represents HTTPS record type
	TypeHTTPS WireType = 65
)

func (WireType) String

func (w WireType) String() string

Directories

Path Synopsis
rdb

Jump to

Keyboard shortcuts

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