Documentation
¶
Overview ¶
* Copyright (c) 2024 Johan Stenstam, johani@johani.org
* Copyright (c) 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se
* Copyright (c) 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se
* Stolen from https://github.com/miekg/dns/blob/master/scan.go
Index ¶
- Constants
- Variables
- func NewCHUNK() dns.PrivateRdata
- func NewDELEG() dns.PrivateRdata
- func NewDSYNC() dns.PrivateRdata
- func NewHSYNC() dns.PrivateRdata
- func NewHSYNC2() dns.PrivateRdata
- func NewJSONCHUNK() dns.PrivateRdata
- func NewJSONMANIFEST() dns.PrivateRdata
- func NewMSIGNER() dns.PrivateRdata
- func NewNOTIFY() dns.PrivateRdata
- func NewTSYNC() dns.PrivateRdata
- func ParseTransportString(s string) (map[string]uint8, error)
- func RRsetDiffer(zone string, newrrs, oldrrs []dns.RR, rrtype uint16, lg *log.Logger, ...) (bool, []dns.RR, []dns.RR)
- func RegisterCHUNKRR() error
- func RegisterDelegRR() error
- func RegisterDsyncRR() error
- func RegisterHsync2RR() error
- func RegisterHsyncRR() error
- func RegisterJSONCHUNKRR() error
- func RegisterJSONMANIFESTRR() error
- func RegisterMsignerRR() error
- func RegisterNotifyRR() error
- func RegisterTsyncRR() error
- type CHUNK
- type ConcurrentMap
- func (m *ConcurrentMap[K, V]) Clear()
- func (m *ConcurrentMap[K, V]) Count() int
- func (m *ConcurrentMap[K, V]) Get(key K) (V, bool)
- func (m *ConcurrentMap[K, V]) GetShard(key K) *ConcurrentMapShared[K, V]
- func (m *ConcurrentMap[K, V]) Has(key K) bool
- func (m *ConcurrentMap[K, V]) IsEmpty() bool
- func (m *ConcurrentMap[K, V]) Items() map[K]V
- func (m *ConcurrentMap[K, V]) Iter() <-chan Tuple[K, V]deprecated
- func (m *ConcurrentMap[K, V]) IterBuffered() <-chan Tuple[K, V]
- func (m *ConcurrentMap[K, V]) IterCb(fn IterCb[K, V])
- func (m *ConcurrentMap[K, V]) Keys() []K
- func (m *ConcurrentMap[K, V]) MSet(data map[K]V)
- func (m *ConcurrentMap[K, V]) MarshalJSON() ([]byte, error)
- func (m *ConcurrentMap[K, V]) NumShards() int
- func (m *ConcurrentMap[K, V]) Pop(key K) (v V, exists bool)
- func (m *ConcurrentMap[K, V]) Remove(key K)
- func (m *ConcurrentMap[K, V]) RemoveCb(key K, cb RemoveCb[K, V]) bool
- func (m *ConcurrentMap[K, V]) Set(key K, value V)
- func (m *ConcurrentMap[K, V]) SetIfAbsent(key K, value V) bool
- func (m *ConcurrentMap[K, V]) UnmarshalJSON(b []byte) (err error)
- func (m *ConcurrentMap[K, V]) Upsert(key K, value V, cb UpsertCb[V]) (res V)
- type ConcurrentMapShared
- type DELEG
- type DELEGAlpn
- type DELEGIPv4Hint
- type DELEGIPv6Hint
- type DELEGKey
- type DELEGKeyValue
- type DELEGLocal
- type DELEGMandatory
- type DELEGNoDefaultAlpn
- type DELEGPort
- type DNSClient
- type DNSClientOption
- type DSYNC
- type DsyncScheme
- type HSYNC
- type HSYNC2
- func (rd *HSYNC2) Copy(dest dns.PrivateRdata) error
- func (rd *HSYNC2) DoAudit() bool
- func (rd *HSYNC2) DoSign() bool
- func (rd *HSYNC2) GetParentSync() uint16
- func (rd *HSYNC2) IsAgent() bool
- func (rd *HSYNC2) Len() int
- func (rd *HSYNC2) Pack(buf []byte) (int, error)
- func (rd *HSYNC2) Parse(txt []string) error
- func (rd *HSYNC2) SetAudit(enabled bool)
- func (rd *HSYNC2) SetNSmgmt(isAgent bool)
- func (rd *HSYNC2) SetParentSync(value uint16) error
- func (rd *HSYNC2) SetSign(doSign bool)
- func (rd HSYNC2) String() string
- func (rd *HSYNC2) Unpack(buf []byte) (int, error)
- type IterCb
- type JSONCHUNK
- type JSONMANIFEST
- type MSIGNER
- type MsignerMethod
- type NOTIFY
- type ParseError
- type RRset
- func (rrset *RRset) Add(rr dns.RR)
- func (rrset *RRset) Clone() *RRset
- func (rrset *RRset) Delete(rr dns.RR)
- func (rrset *RRset) RRSIGsDiffer(newrrset *RRset) bool
- func (rrset *RRset) RRsetDiffer(newrrset *RRset, lg *log.Logger, verbose, debug bool) (bool, []dns.RR, []dns.RR)
- func (rrset *RRset) RemoveRR(rr dns.RR, verbose, debug bool)
- func (rrset *RRset) String(maxlen int) (out string)
- type RRsetString
- type RemoveCb
- type Stringer
- type TSYNC
- type Transport
- type Tuple
- type UpsertCb
Constants ¶
const ( TypeNOTIFY = 0x0F9A TypeMSIGNER = 0x0F9C TypeHSYNC = 0x0F9D TypeHSYNC2 = 0x0F9E TypeTSYNC = 0x0F9F TypeCHUNK = 65015 // 0xFDF7 - Unified Chunk/Manifest // lots of space TypeJSONMANIFEST = 65100 // Older version of CHUNK TypeJSONCHUNK = 65100 // Older version of CHUNK )
const ( SchemeNotify = 1 SchemeUpdate = 2 SchemeScanner = 3 SchemeAPI = 4 // Private schemes: SchemeMSUpdate = 129 SchemeReport = 130 )
const ( HsyncStateON uint8 = 1 HsyncStateOFF uint8 = 0 HsyncNSmgmtOWNER uint8 = 1 HsyncNSmgmtAGENT uint8 = 2 HsyncSignYES uint8 = 1 HsyncSignNO uint8 = 0 )
const ( // Single bit flags FlagNSmgmt uint16 = 1 << 0 // bit 0: 0=OWNER, 1=AGENT FlagSign uint16 = 1 << 1 // bit 1: 0=NOSIGN, 1=SIGN FlagAudit uint16 = 1 << 2 // bit 2: 0=NO, 1=YES // Multi-bit fields ParentSyncMask uint16 = 0x7 << 3 // bits 3-5: 3 bits for parentsync ParentSyncShift uint = 3 // shift amount for parentsync field )
Define bit positions and masks in the Flags field
const ( ParentSyncOwner uint16 = iota ParentSyncNotify ParentSyncUpdate ParentSyncAPI )
ParentSync values (using iota for sequential values)
const ( Hsync2StateON uint8 = 1 Hsync2StateOFF uint8 = 0 )
Keep these constants for State
const ( MsignerMethodDNS = 1 MsignerMethodAPI = 2 MsignerStateON = 1 MsignerStateOFF = 0 )
const (
FormatJSON = 1 // JSON format (original format)
)
Format constants for CHUNK RR type
const TypeDELEG = 65287
const TypeDSYNC = 0x0042 // 66 is the official IANA code
Variables ¶
var FormatToString = map[uint8]string{ FormatJSON: "JSON", }
FormatToString maps format constants to their string representations
var Hsync2StateToString = map[uint8]string{ Hsync2StateON: "ON", Hsync2StateOFF: "OFF", }
Keep the State mappings
var HsyncNSmgmtToString = map[uint8]string{ HsyncNSmgmtOWNER: "OWNER", HsyncNSmgmtAGENT: "AGENT", }
var HsyncSignToString = map[uint8]string{ HsyncSignYES: "SIGN", HsyncSignNO: "NOSIGN", }
var HsyncStateToString = map[uint8]string{ HsyncStateON: "ON", HsyncStateOFF: "OFF", }
var MsignerMethodToString = map[MsignerMethod]string{ MsignerMethodDNS: "DNS", MsignerMethodAPI: "API", }
var SchemeToString = map[DsyncScheme]string{ SchemeNotify: "NOTIFY", SchemeUpdate: "UPDATE", SchemeScanner: "SCANNER", SchemeAPI: "API", SchemeMSUpdate: "MSUPDATE", SchemeReport: "REPORT", }
var StateToString = map[uint8]string{ MsignerStateON: "ON", MsignerStateOFF: "OFF", }
var StringToFormat = map[string]uint8{ "JSON": FormatJSON, }
StringToFormat maps string representations to format constants (reverse of FormatToString) NOTE: This map must be kept in sync with FormatToString - when adding a new format to FormatToString, also add the corresponding entry here.
var StringToHsync2State = map[string]uint8{ "ON": Hsync2StateON, "OFF": Hsync2StateOFF, }
var StringToHsyncNSmgmt = map[string]uint8{ "OWNER": HsyncNSmgmtOWNER, "AGENT": HsyncNSmgmtAGENT, }
var StringToHsyncSign = map[string]uint8{ "SIGN": HsyncSignYES, "NOSIGN": HsyncSignNO, }
var StringToHsyncState = map[string]uint8{ "ON": HsyncStateON, "OFF": HsyncStateOFF, }
var StringToMsignerMethod = map[string]MsignerMethod{ "DNS": MsignerMethodDNS, "API": MsignerMethodAPI, }
var StringToScheme = map[string]DsyncScheme{ "NOTIFY": SchemeNotify, "UPDATE": SchemeUpdate, "SCANNER": SchemeScanner, "API": SchemeAPI, "MSUPDATE": SchemeMSUpdate, "REPORT": SchemeReport, "REPORTER": SchemeReport, "1": SchemeNotify, "2": SchemeUpdate, "3": SchemeScanner, "4": SchemeAPI, "129": SchemeMSUpdate, "130": SchemeReport, }
var StringToState = map[string]uint8{ "ON": MsignerStateON, "OFF": MsignerStateOFF, }
var TransportToString = map[Transport]string{ TransportDo53: "do53", TransportDoT: "dot", TransportDoH: "doh", TransportDoQ: "doq", }
Functions ¶
func NewCHUNK ¶
func NewCHUNK() dns.PrivateRdata
func NewDELEG ¶
func NewDELEG() dns.PrivateRdata
func NewDSYNC ¶
func NewDSYNC() dns.PrivateRdata
func NewHSYNC ¶
func NewHSYNC() dns.PrivateRdata
func NewHSYNC2 ¶
func NewHSYNC2() dns.PrivateRdata
func NewJSONCHUNK ¶
func NewJSONCHUNK() dns.PrivateRdata
func NewJSONMANIFEST ¶
func NewJSONMANIFEST() dns.PrivateRdata
func NewMSIGNER ¶
func NewMSIGNER() dns.PrivateRdata
func NewNOTIFY ¶
func NewNOTIFY() dns.PrivateRdata
func NewTSYNC ¶
func NewTSYNC() dns.PrivateRdata
func ParseTransportString ¶
ParseTransportString parses a transport string like "doq:30,dot:20" into a map. - Keys are lower-cased and trimmed - Values must be integers in [0,100] - Duplicate keys are rejected
func RRsetDiffer ¶
func RRsetDiffer(zone string, newrrs, oldrrs []dns.RR, rrtype uint16, lg *log.Logger, verbose, debug bool) (bool, []dns.RR, []dns.RR)
RRsetDiffer compares old and new DNS resource record slices for a given RR type in a zone, ignoring RRSIG records. It returns: a boolean that is true if the RRsets differ, a slice of records present in newrrs but not in oldrrs (adds), and a slice of records present in oldrrs but not in newrrs (removes). RRsetDiffer compares old and new DNS resource records of a specific type in a zone and reports whether the RRsets differ, returning slices of records that were added and removed. It ignores RRSIG records and determines equality using dns.IsDuplicate. When verbose or debug are true, comparison details are written to the provided logger.
func RegisterCHUNKRR ¶
func RegisterCHUNKRR() error
func RegisterDsyncRR ¶
func RegisterDsyncRR() error
func RegisterHsync2RR ¶
func RegisterHsync2RR() error
func RegisterHsyncRR ¶
func RegisterHsyncRR() error
func RegisterJSONCHUNKRR ¶
func RegisterJSONCHUNKRR() error
func RegisterJSONMANIFESTRR ¶
func RegisterJSONMANIFESTRR() error
func RegisterMsignerRR ¶
func RegisterMsignerRR() error
func RegisterNotifyRR ¶
func RegisterNotifyRR() error
func RegisterTsyncRR ¶
func RegisterTsyncRR() error
Types ¶
type CHUNK ¶
type CHUNK struct {
Format uint8 // Format identifier (used for manifest, unused for data chunks)
HMACLen uint16 // HMAC length (0 for data chunks, >0 for manifest)
HMAC []byte // HMAC-SHA256 checksum (only present if HMACLen > 0)
Sequence uint16 // Chunk sequence number (unused when Total=0)
Total uint16 // Total chunks or 0 for manifest (0 = manifest, >0 = data chunk)
DataLength uint16 // Length of data
Data []byte // Format-specific data (JSON manifest or chunk payload)
}
type ConcurrentMap ¶
type ConcurrentMap[K comparable, V any] struct { // contains filtered or unexported fields }
A "thread" safe map of type string:Anything. To avoid lock bottlenecks this map is dived to several (shardCount) map shards.
func NewStringer ¶
func NewStringer[K Stringer, V any]() ConcurrentMap[K, V]
Creates a new concurrent map.
func NewWithCustomShardingFunction ¶
func NewWithCustomShardingFunction[K comparable, V any](sharding func(key K) uint32) ConcurrentMap[K, V]
Creates a new concurrent map.
func (*ConcurrentMap[K, V]) Clear ¶
func (m *ConcurrentMap[K, V]) Clear()
Clear removes all items from map.
func (*ConcurrentMap[K, V]) Count ¶
func (m *ConcurrentMap[K, V]) Count() int
Count returns the number of elements within the map.
func (*ConcurrentMap[K, V]) Get ¶
func (m *ConcurrentMap[K, V]) Get(key K) (V, bool)
Get retrieves an element from map under given key.
func (*ConcurrentMap[K, V]) GetShard ¶
func (m *ConcurrentMap[K, V]) GetShard(key K) *ConcurrentMapShared[K, V]
GetShard returns shard under given key
func (*ConcurrentMap[K, V]) Has ¶
func (m *ConcurrentMap[K, V]) Has(key K) bool
Looks up an item under specified key
func (*ConcurrentMap[K, V]) IsEmpty ¶
func (m *ConcurrentMap[K, V]) IsEmpty() bool
IsEmpty checks if map is empty.
func (*ConcurrentMap[K, V]) Items ¶
func (m *ConcurrentMap[K, V]) Items() map[K]V
Items returns all items as map[string]V
func (*ConcurrentMap[K, V]) Iter
deprecated
func (m *ConcurrentMap[K, V]) Iter() <-chan Tuple[K, V]
Iter returns an iterator which could be used in a for range loop.
Deprecated: using IterBuffered() will get a better performence
func (*ConcurrentMap[K, V]) IterBuffered ¶
func (m *ConcurrentMap[K, V]) IterBuffered() <-chan Tuple[K, V]
IterBuffered returns a buffered iterator which could be used in a for range loop.
func (*ConcurrentMap[K, V]) IterCb ¶
func (m *ConcurrentMap[K, V]) IterCb(fn IterCb[K, V])
Callback based iterator, cheapest way to read all elements in a map.
func (*ConcurrentMap[K, V]) Keys ¶
func (m *ConcurrentMap[K, V]) Keys() []K
Keys returns all keys as []string
func (*ConcurrentMap[K, V]) MSet ¶
func (m *ConcurrentMap[K, V]) MSet(data map[K]V)
func (*ConcurrentMap[K, V]) MarshalJSON ¶
func (m *ConcurrentMap[K, V]) MarshalJSON() ([]byte, error)
Reviles ConcurrentMap "private" variables to json marshal.
func (*ConcurrentMap[K, V]) NumShards ¶
func (m *ConcurrentMap[K, V]) NumShards() int
func (*ConcurrentMap[K, V]) Pop ¶
func (m *ConcurrentMap[K, V]) Pop(key K) (v V, exists bool)
Pop removes an element from the map and returns it
func (*ConcurrentMap[K, V]) Remove ¶
func (m *ConcurrentMap[K, V]) Remove(key K)
Remove removes an element from the map.
func (*ConcurrentMap[K, V]) RemoveCb ¶
func (m *ConcurrentMap[K, V]) RemoveCb(key K, cb RemoveCb[K, V]) bool
RemoveCb locks the shard containing the key, retrieves its current value and calls the callback with those params If callback returns true and element exists, it will remove it from the map Returns the value returned by the callback (even if element was not present in the map)
func (*ConcurrentMap[K, V]) Set ¶
func (m *ConcurrentMap[K, V]) Set(key K, value V)
Sets the given value under the specified key.
func (*ConcurrentMap[K, V]) SetIfAbsent ¶
func (m *ConcurrentMap[K, V]) SetIfAbsent(key K, value V) bool
Sets the given value under the specified key if no value was associated with it.
func (*ConcurrentMap[K, V]) UnmarshalJSON ¶
func (m *ConcurrentMap[K, V]) UnmarshalJSON(b []byte) (err error)
Reverse process of Marshal.
func (*ConcurrentMap[K, V]) Upsert ¶
func (m *ConcurrentMap[K, V]) Upsert(key K, value V, cb UpsertCb[V]) (res V)
Insert or Update - updates existing element or inserts a new one using UpsertCb
type ConcurrentMapShared ¶
type ConcurrentMapShared[K comparable, V any] struct { // contains filtered or unexported fields }
A "thread" safe string to anything map.
type DELEG ¶
type DELEG struct {
// Hdr dns.RR_Header
Priority uint16 // If zero, Value must be empty or discarded by the user of this library
Target string `dns:"domain-name"`
Value []DELEGKeyValue `dns:"pairs"`
}
type DELEGAlpn ¶
type DELEGAlpn struct {
Alpn []string
}
SVCBAlpn pair is used to list supported connection protocols. The user of this library must ensure that at least one protocol is listed when alpn is present. Protocol IDs can be found at: https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids Basic use pattern for creating an alpn option:
h := new(dns.HTTPS)
h.Hdr = dns.RR_Header{Name: ".", Rrtype: dns.TypeHTTPS, Class: dns.ClassINET}
e := new(dns.SVCBAlpn)
e.Alpn = []string{"h2", "http/1.1"}
h.Value = append(h.Value, e)
type DELEGIPv4Hint ¶
SVCBIPv4Hint pair suggests an IPv4 address which may be used to open connections if A and AAAA record responses for SVCB's Target domain haven't been received. In that case, optionally, A and AAAA requests can be made, after which the connection to the hinted IP address may be terminated and a new connection may be opened. Basic use pattern for creating an ipv4hint option:
h := new(dns.HTTPS)
h.Hdr = dns.RR_Header{Name: ".", Rrtype: dns.TypeHTTPS, Class: dns.ClassINET}
e := new(dns.SVCBIPv4Hint)
e.Hint = []net.IP{net.IPv4(1,1,1,1).To4()}
Or
e.Hint = []net.IP{net.ParseIP("1.1.1.1").To4()}
h.Value = append(h.Value, e)
func (*DELEGIPv4Hint) Key ¶
func (*DELEGIPv4Hint) Key() DELEGKey
func (*DELEGIPv4Hint) String ¶
func (s *DELEGIPv4Hint) String() string
type DELEGIPv6Hint ¶
SVCBIPv6Hint pair suggests an IPv6 address which may be used to open connections if A and AAAA record responses for SVCB's Target domain haven't been received. In that case, optionally, A and AAAA requests can be made, after which the connection to the hinted IP address may be terminated and a new connection may be opened. Basic use pattern for creating an ipv6hint option:
h := new(dns.HTTPS)
h.Hdr = dns.RR_Header{Name: ".", Rrtype: dns.TypeHTTPS, Class: dns.ClassINET}
e := new(dns.SVCBIPv6Hint)
e.Hint = []net.IP{net.ParseIP("2001:db8::1")}
h.Value = append(h.Value, e)
func (*DELEGIPv6Hint) Key ¶
func (*DELEGIPv6Hint) Key() DELEGKey
func (*DELEGIPv6Hint) String ¶
func (s *DELEGIPv6Hint) String() string
type DELEGKey ¶
type DELEGKey uint16
SVCBKey is the type of the keys used in the SVCB RR.
type DELEGKeyValue ¶
type DELEGKeyValue interface {
Key() DELEGKey // Key returns the numerical key code.
String() string // String returns the string representation of the value.
// contains filtered or unexported methods
}
DELEGKeyValue defines a key=value pair for the DELEG RR type. A DELEG RR can have multiple DELEGKeyValues appended to it.
type DELEGLocal ¶
type DELEGLocal struct {
KeyCode DELEGKey // Never 65535 or any assigned keys.
Data []byte // All byte sequences are allowed.
}
SVCBLocal pair is intended for experimental/private use. The key is recommended to be in the range [SVCB_PRIVATE_LOWER, SVCB_PRIVATE_UPPER]. Basic use pattern for creating a keyNNNNN option:
h := new(dns.HTTPS)
h.Hdr = dns.RR_Header{Name: ".", Rrtype: dns.TypeHTTPS, Class: dns.ClassINET}
e := new(dns.SVCBLocal)
e.KeyCode = 65400
e.Data = []byte("abc")
h.Value = append(h.Value, e)
func (*DELEGLocal) Key ¶
func (s *DELEGLocal) Key() DELEGKey
func (*DELEGLocal) String ¶
func (s *DELEGLocal) String() string
type DELEGMandatory ¶
type DELEGMandatory struct {
Code []DELEGKey
}
SVCBMandatory pair adds to required keys that must be interpreted for the RR to be functional. If ignored, the whole RRSet must be ignored. "port" and "no-default-alpn" are mandatory by default if present, so they shouldn't be included here.
It is incumbent upon the user of this library to reject the RRSet if or avoid constructing such an RRSet that: - "mandatory" is included as one of the keys of mandatory - no key is listed multiple times in mandatory - all keys listed in mandatory are present - escape sequences are not used in mandatory - mandatory, when present, lists at least one key
Basic use pattern for creating a mandatory option:
s := &dns.SVCB{Hdr: dns.RR_Header{Name: ".", Rrtype: dns.TypeSVCB, Class: dns.ClassINET}}
e := new(dns.SVCBMandatory)
e.Code = []uint16{dns.SVCB_ALPN}
s.Value = append(s.Value, e)
t := new(dns.SVCBAlpn)
t.Alpn = []string{"xmpp-client"}
s.Value = append(s.Value, t)
func (*DELEGMandatory) Key ¶
func (*DELEGMandatory) Key() DELEGKey
func (*DELEGMandatory) String ¶
func (s *DELEGMandatory) String() string
type DELEGNoDefaultAlpn ¶
type DELEGNoDefaultAlpn struct{}
SVCBNoDefaultAlpn pair signifies no support for default connection protocols. Should be used in conjunction with alpn. Basic use pattern for creating a no-default-alpn option:
s := &dns.SVCB{Hdr: dns.RR_Header{Name: ".", Rrtype: dns.TypeSVCB, Class: dns.ClassINET}}
t := new(dns.SVCBAlpn)
t.Alpn = []string{"xmpp-client"}
s.Value = append(s.Value, t)
e := new(dns.SVCBNoDefaultAlpn)
s.Value = append(s.Value, e)
func (*DELEGNoDefaultAlpn) Key ¶
func (*DELEGNoDefaultAlpn) Key() DELEGKey
func (*DELEGNoDefaultAlpn) String ¶
func (*DELEGNoDefaultAlpn) String() string
type DELEGPort ¶
type DELEGPort struct {
Port uint16
}
SVCBPort pair defines the port for connection. Basic use pattern for creating a port option:
s := &dns.SVCB{Hdr: dns.RR_Header{Name: ".", Rrtype: dns.TypeSVCB, Class: dns.ClassINET}}
e := new(dns.SVCBPort)
e.Port = 80
s.Value = append(s.Value, e)
type DNSClient ¶
type DNSClient struct {
Port string
Transport Transport
TLSConfig *tls.Config
HTTPClient *http.Client
QUICConfig *quic.Config
Timeout time.Duration
DNSClientUDP *dns.Client
DNSClientTCP *dns.Client
DNSClientTLS *dns.Client
DisableFallback bool
ForceTCP bool
}
DNSClient represents a DNS client that supports multiple transport protocols
func NewDNSClient ¶
func NewDNSClient(transport Transport, port string, tlsConfig *tls.Config, opts ...DNSClientOption) *DNSClient
NewDNSClient creates a new DNS client with the specified transport XXX: Once we can do cert validation we should add a WithVerifyCertificates() option.
type DNSClientOption ¶
type DNSClientOption func(*DNSClient)
func WithDisableFallback ¶
func WithDisableFallback() DNSClientOption
func WithForceTCP ¶
func WithForceTCP() DNSClientOption
type DsyncScheme ¶
type DsyncScheme uint8
type HSYNC ¶
type HSYNC2 ¶
type HSYNC2 struct {
State uint8 // 0=OFF, 1=ON
Flags uint16 // Will hold both NSmgmt and Sign bits
Identity string
Upstream string
}
func (*HSYNC2) GetParentSync ¶
func (*HSYNC2) SetParentSync ¶
type IterCb ¶
type IterCb[K comparable, V any] func(key K, v V)
Iterator callback called for every key,value found in maps. RLock is held for all calls for a given shard therefore callback sees a consistent view of a shard, but not across the shards
type JSONCHUNK ¶
type JSONCHUNK struct {
Sequence uint16 `json:"sequence"` // Chunk sequence number (0-based)
Total uint16 `json:"total"` // Total number of chunks
Data []byte `json:"data"` // Base64-encoded JSON data (raw bytes, not base64 string)
}
JSONCHUNK - Chunked JSON Data Transport Transports large JSON-structured data (zone lists or encrypted blobs) in chunks Format: Base64-encoded JSON data with sequence/total metadata
type JSONMANIFEST ¶
type JSONMANIFEST struct {
ChunkCount uint16 `json:"chunk_count"` // Number of JSONCHUNK records (0 if payload is inline)
ChunkSize uint16 `json:"chunk_size,omitempty"` // Maximum size of each chunk in bytes (optional)
Checksum string `json:"checksum,omitempty"` // SHA-256 checksum (optional)
Metadata map[string]interface{} `json:"metadata,omitempty"` // Additional metadata (must include "content")
Payload []byte `json:"payload,omitempty"` // Inline payload (base64-encoded in JSON, optional)
}
JSONMANIFEST - JSON Distribution Manifest Small metadata about a distribution event for a specific node Format: JSON structure with chunk_count, checksum, metadata Size limit: <500 bytes (never chunked) The Metadata map should contain a "content" field indicating the type:
- "zonelist": List of zone names (JSON array of strings)
- "encrypted_keys": HPKE-encrypted key material
- "clear_text": Clear text payload (base64 encoded)
- "encrypted_text": HPKE-encrypted text payload (base64 encoded)
When payload fits inline (typically < 1000 bytes), it can be included directly in the Payload field, eliminating the need for separate JSONCHUNK queries. In this case, ChunkCount should be 0 (or Payload is used instead of chunks).
func (*JSONMANIFEST) Copy ¶
func (rd *JSONMANIFEST) Copy(dest dns.PrivateRdata) error
func (*JSONMANIFEST) Len ¶
func (rd *JSONMANIFEST) Len() int
func (*JSONMANIFEST) Parse ¶
func (rd *JSONMANIFEST) Parse(txt []string) error
func (JSONMANIFEST) String ¶
func (rd JSONMANIFEST) String() string
type MSIGNER ¶
type MSIGNER struct {
State uint8 // 0=OFF, 1=ON
Method MsignerMethod // 1=DNS, 2=API
// Port uint16
Target string
}
type MsignerMethod ¶
type MsignerMethod uint8
type ParseError ¶
type ParseError struct {
// contains filtered or unexported fields
}
ParseError is a parsing error. It contains the parse error and the location in the io.Reader where the error occurred.
func (*ParseError) Error ¶
func (e *ParseError) Error() (s string)
type RRset ¶
func (*RRset) RRSIGsDiffer ¶
RRSIGsDiffer compares two slices of RRSIGs and returns true if they differ. Two RRSIG slices are considered equal if they contain the same RRSIGs (using dns.IsDuplicate for comparison), regardless of order. Returns true if the RRSIGs differ, false if they are the same.
func (*RRset) RRsetDiffer ¶
type RRsetString ¶
type RRsetString struct {
Name string `json:"name"`
RRtype uint16 `json:"rrtype"`
RRs []string `json:"rrs"`
RRSIGs []string `json:"rrsigs,omitempty"`
}
String-based versions of RRset for JSON marshaling
type RemoveCb ¶
RemoveCb is a callback executed in a map.RemoveCb() call, while Lock is held If returns true, the element will be removed from the map
type Stringer ¶
type Stringer interface {
fmt.Stringer
comparable
}
type TSYNC ¶
TSYNC is a private/custom RRtype similar in style to DSYNC. RDATA fields (wire format order): - Type: uint16 (the RRtype variant within TSYNC namespace; typically dns.TypeTSYNC) - Alias: domain name (mandatory; must be a valid FQDN, cannot be empty) - Transports: string (optional; e.g., "doq=30,dot=20", can be empty) - V4addr: string (optional; comma-separated list of IPv4 addresses, can be empty) - V6addr: string (optional; comma-separated list of IPv6 addresses, can be empty)
type Transport ¶
type Transport uint8
Transport represents the DNS transport protocol
func StringToTransport ¶
StringToTransport converts a string transport name to Transport type
type Tuple ¶
type Tuple[K comparable, V any] struct { Key K Val V }
Used by the Iter & IterBuffered functions to wrap two variables together over a channel,