Documentation ¶
Index ¶
- Constants
- Variables
- func DeriveSerial(f *os.File) (uint32, error)
- func GetSubnets(dataPath string) ([]*net.IPNet, error)
- func ParseIPNet(s string) (ipnet *net.IPNet, err error)
- func ParseRecords(r io.Reader, codec *Codec, results chan<- Record, workers int) error
- func ParseStream(r io.Reader, codec *Codec, results chan<- []MapRecord, workers int) error
- func Putlmaptext(w io.Writer, m Lmap)
- func Putloctext(w io.Writer, lo Loc)
- func Reverseaddr(ip net.IP) []byte
- func WireTypeToTerraformString(t WireType) (string, error)
- type Accum
- type AccumulatorScanner
- type Codec
- type CompositeRecord
- type Feature
- type IPv6
- type Lmap
- type Loc
- type MapMarshaler
- type MapRecord
- type PreprocReader
- type Raddr
- func (r *Raddr) DomainName() string
- func (r *Raddr) Location() Loc
- func (r *Raddr) MarshalMap() ([]MapRecord, error)
- func (r *Raddr) MarshalText() (text []byte, err error)
- func (r *Raddr) TTL() uint32
- func (r *Raddr) TerraformValue() (string, error)
- func (r *Raddr) UnmarshalText(text []byte) error
- func (r *Raddr) WireType() WireType
- type RangePoint
- type RangePoints
- type Raux
- type Rcname
- func (r *Rcname) DomainName() string
- func (r *Rcname) Location() Loc
- func (r *Rcname) MarshalMap() ([]MapRecord, error)
- func (r *Rcname) MarshalText() (text []byte, err error)
- func (r *Rcname) TTL() uint32
- func (r *Rcname) TerraformValue() (string, error)
- func (r *Rcname) UnmarshalText(text []byte) error
- func (r *Rcname) WireType() WireType
- type Rcsmap
- type Rdot
- type Rearranger
- type Record
- type Rfeatures
- type Rhttps
- type Ripmap
- type Rmx
- type Rmx1
- func (r *Rmx1) DomainName() string
- func (r *Rmx1) Location() Loc
- func (r *Rmx1) MarshalMap() ([]MapRecord, error)
- func (r *Rmx1) MarshalText() (text []byte, err error)
- func (r *Rmx1) TTL() uint32
- func (r *Rmx1) TerraformValue() (string, error)
- func (r *Rmx1) UnmarshalText(text []byte) error
- func (r *Rmx1) WireType() WireType
- type Rnet
- type Rns
- type Rns1
- func (r *Rns1) DomainName() string
- func (r *Rns1) Location() Loc
- func (r *Rns1) MarshalMap() ([]MapRecord, error)
- func (r *Rns1) MarshalText() (text []byte, err error)
- func (r *Rns1) TTL() uint32
- func (r *Rns1) TerraformValue() (string, error)
- func (r *Rns1) UnmarshalText(text []byte) error
- func (r *Rns1) WireType() WireType
- type Rpaddr
- type Rptr
- func (r *Rptr) DomainName() string
- func (r *Rptr) Location() Loc
- func (r *Rptr) MarshalMap() ([]MapRecord, error)
- func (r *Rptr) MarshalText() (text []byte, err error)
- func (r *Rptr) TTL() uint32
- func (r *Rptr) TerraformValue() (string, error)
- func (r *Rptr) UnmarshalText(text []byte) error
- func (r *Rptr) WireType() WireType
- type Rrangepoint
- type Rsoa
- type Rsrv
- type Rsrv1
- func (r *Rsrv1) DomainName() string
- func (r *Rsrv1) Location() Loc
- func (r *Rsrv1) MarshalMap() ([]MapRecord, error)
- func (r *Rsrv1) MarshalText() (text []byte, err error)
- func (r *Rsrv1) TTL() uint32
- func (r *Rsrv1) TerraformValue() (string, error)
- func (r *Rsrv1) UnmarshalText(text []byte) error
- func (r *Rsrv1) WireType() WireType
- type Rsvcb
- type Rtxt
- func (r *Rtxt) DomainName() string
- func (r *Rtxt) Location() Loc
- func (r *Rtxt) MarshalMap() ([]MapRecord, error)
- func (r *Rtxt) MarshalText() (text []byte, err error)
- func (r *Rtxt) TTL() uint32
- func (r *Rtxt) TerraformValue() (string, error)
- func (r *Rtxt) UnmarshalText(text []byte) error
- func (r *Rtxt) WireType() WireType
- type Rtype
- type SubnetRanger
- type SubnetRangerScanner
- type TerraformRecord
- type WireRecord
- type WireType
Constants ¶
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
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" )
const (
// InitLocationCount is the initial locationCount for NewRearranger
InitLocationCount = 2
)
const (
// NUMFIELDS is the number of fields to guarantee upon splitting
NUMFIELDS = 15
)
Variables ¶
var ( SEP = []byte(":") // original record separator NSEP = []byte(",") // [FB-only] IPv6-friendly record separator )
two variants of separators
var ErrBadMode = errors.New("bad combination of mode/flags")
ErrBadMode is returned when a function is called with unexpected combination of operation settings
var ErrBadRType = errors.New("bad record type")
ErrBadRType is an error returned when a record with an invalid type character encountered.
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 GetSubnets ¶
GetSubnets parsed data file in tinydns format and returns all subnets from Net records (prefix %)
func ParseIPNet ¶
ParseIPNet parses a CIDR notation string into a net.IPNet, handling the case when the input is a plain IP address.
func ParseRecords ¶
ParseRecords parses data from io.Reader and returns results via results chan. Data is parsed in parallel when workers != 1.
func ParseStream ¶
ParseStream parses data from io.Reader and returns results via results chan. Data is parsed in parallel when workers != 1.
func Putlmaptext ¶
Putlmaptext escapes the map ID and writes it to the writer
func Putloctext ¶
Putloctext escapes the location ID and writes it to the writer
func Reverseaddr ¶
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 ¶
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 ¶
MarshalMap implements MapMarshaler
func (*Accum) MarshalText ¶
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
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 ¶
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 (IPv6) EqualToNetIP ¶
EqualToNetIP checks equality to net.IP object
func (IPv6) MarshalText ¶
MarshalText implements encoding.TextMarshaler
type MapMarshaler ¶
MapMarshaler is the interface used in parsing implemented by all record types
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) 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
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 ¶
MarshalMap implements MapMarshaler
func (*Raddr) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Raddr) TerraformValue ¶
TerraformValue implements TerraformRecord interface
func (*Raddr) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
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 Lmap) (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 ¶
MarshalMap implements MapMarshaler
func (*Raux) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Raux) UnmarshalText ¶
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 ¶
MarshalMap implements MapMarshaler
func (*Rcname) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Rcname) TerraformValue ¶
TerraformValue implements TerraformRecord interface
func (*Rcname) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
type Rcsmap ¶
type Rcsmap Ripmap
Rcsmap is [FB-only] 8 - define an EDNS client subnet-based map
func (*Rcsmap) MarshalMap ¶
MarshalMap implements MapMarshaler
func (*Rcsmap) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Rcsmap) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
type Rdot ¶
Rdot is [composite] . → (NS, A, SOA)
func (*Rdot) DerivedRecords ¶
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 ¶
MarshalMap implements MapMarshaler
func (*Rdot) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Rdot) UnmarshalText ¶
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 ¶
type Record interface { encoding.TextUnmarshaler encoding.TextMarshaler MapMarshaler }
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 ¶
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 ¶
MarshalMap implements MapMarshaler
func (*Rhttps) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Rhttps) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
type Ripmap ¶
type Ripmap struct {
// contains filtered or unexported fields
}
Ripmap is [FB-only] M - define a resolver-based map
func (*Ripmap) MarshalMap ¶
MarshalMap implements MapMarshaler
func (*Ripmap) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Ripmap) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
type Rmx ¶
Rmx is [composite] @ → (MX, A)
func (*Rmx) DerivedRecords ¶
DerivedRecords implements CompositeRecord interface
func (*Rmx) MarshalMap ¶
MarshalMap implements MapMarshaler
func (*Rmx) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Rmx) UnmarshalText ¶
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 ¶
MarshalMap implements MapMarshaler
func (*Rmx1) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Rmx1) TerraformValue ¶
TerraformValue implements TerraformRecord interface
func (*Rmx1) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
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 ¶
MarshalMap implements MapMarshaler
func (*Rnet) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Rnet) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
type Rns ¶
Rns is [composite] & → (NS, A)
func (*Rns) DerivedRecords ¶
DerivedRecords implements CompositeRecord interface
func (*Rns) MarshalMap ¶
MarshalMap implements MapMarshaler
func (*Rns) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Rns) UnmarshalText ¶
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 ¶
MarshalMap implements MapMarshaler
func (*Rns1) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Rns1) TerraformValue ¶
TerraformValue implements TerraformRecord interface
func (*Rns1) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
type Rpaddr ¶
type Rpaddr Raddr
Rpaddr is [composite] = → (A/AAAA, PTR)
func (*Rpaddr) DerivedRecords ¶
DerivedRecords implements CompositeRecord interface
func (*Rpaddr) MarshalMap ¶
MarshalMap implements MapMarshaler
func (*Rpaddr) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Rpaddr) UnmarshalText ¶
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 ¶
MarshalMap implements MapMarshaler
func (*Rptr) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Rptr) TerraformValue ¶
TerraformValue implements TerraformRecord interface
func (*Rptr) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
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 ¶
MarshalMap implements MapMarshaler
func (*Rsoa) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Rsoa) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
type Rsrv ¶
Rsrv is [composite] S → (SRV, A)
func (*Rsrv) DerivedRecords ¶
DerivedRecords implements CompositeRecord interface
func (*Rsrv) MarshalMap ¶
MarshalMap implements MapMarshaler
func (*Rsrv) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Rsrv) UnmarshalText ¶
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 ¶
MarshalMap implements MapMarshaler
func (*Rsrv1) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Rsrv1) TerraformValue ¶
TerraformValue implements TerraformRecord interface
func (*Rsrv1) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
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 ¶
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 ¶
MarshalText implements encoding.TextMarshaler
func (*Rsvcb) UnmarshalText ¶
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 ¶
MarshalMap implements MapMarshaler
func (*Rtxt) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Rtxt) TerraformValue ¶
TerraformValue implements TerraformRecord interface
func (*Rtxt) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
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) 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 ¶
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 ¶
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 )