Documentation ¶
Index ¶
- Constants
- Variables
- func AAAAAnswer(msg *dns.Msg) []netip.Addr
- func AAnswer(msg *dns.Msg) []netip.Addr
- func AName(ans dns.RR) (string, error)
- func AQuadAForQuery(q *dns.Msg, ips ...netip.Addr) (a *dns.Msg, err error)
- func AQuadAUnspecified(msg *dns.Msg) bool
- func AddEDNS0PaddingIfNoneFound(msg *dns.Msg)
- func Ans(msg *dns.Msg) (s string)
- func AsMsg(packet []byte) *dns.Msg
- func AsMsg2(packet []byte) (*dns.Msg, error)
- func BlockResponseFromMessage(q []byte) (*dns.Msg, error)
- func ComputePaddingSize(msg *dns.Msg) int
- func DnsIPPort(s string) (ipp netip.AddrPort, err error)
- func EDNS0PadLen(msg *dns.Msg) int
- func EmptyResponseFromMessage(srcMsg *dns.Msg) *dns.Msg
- func ExtractMDNSDomain(msg *dns.Msg) (svc, tld string)
- func FindUnique(s []string, n []string) (u []string)
- func GetBlocklistStampFromURL(rawurl string) (string, error)
- func GetBlocklistStampHeaderKey() string
- func GetInterestingRData(msg *dns.Msg) string
- func GetRethinkDNSRegionHeaderKey1() string
- func GetRethinkDNSRegionHeaderKey2() (r string)
- func HasAAAAAnswer(msg *dns.Msg) bool
- func HasAAAAQuestion(msg *dns.Msg) bool
- func HasAAnswer(msg *dns.Msg) bool
- func HasAQuadAQuestion(msg *dns.Msg) bool
- func HasAQuestion(msg *dns.Msg) bool
- func HasAnyAnswer(msg *dns.Msg) bool
- func HasAnyQuestion(msg *dns.Msg) bool
- func HasHTTPQuestion(msg *dns.Msg) (ok bool)
- func HasRcodeSuccess(msg *dns.Msg) bool
- func HasSVCBQuestion(msg *dns.Msg) (ok bool)
- func HasTCFlag(msg *dns.Msg) bool
- func HasTCFlag2(packet []byte) bool
- func IPHints(msg *dns.Msg, x dns.SVCBKey) []netip.Addr
- func IsAAAAQType(qtype uint16) bool
- func IsAQType(qtype uint16) bool
- func IsARecord(rr dns.RR) bool
- func IsHTTPQuestion(q *dns.Question) bool
- func IsHTTPSQType(qtype uint16) bool
- func IsMDNSQuery(qname string) bool
- func IsNXDomain(msg *dns.Msg) bool
- func IsSVCBQType(qtype uint16) bool
- func IsSVCBQuestion(q *dns.Question) bool
- func IsServFailOrInvalid(msg *dns.Msg) bool
- func Len(msg *dns.Msg) int
- func MakeAAAARecord(name string, ip6 string, expiry int) *dns.AAAA
- func MakeARecord(name string, ip4 string, expiry int) *dns.A
- func Max(a, b int) int
- func MaybeToQuadA(answer dns.RR, prefix *net.IPNet, minttl uint32) *dns.AAAA
- func Min(a, b int) int
- func Net2ProxyID(network string) (proto string, pids []string)
- func NetAndProxyID(proto string, pidcsv ...string) string
- func NormalizeQName(str string) (string, error)
- func PrefixWithSize(packet []byte) ([]byte, error)
- func QName(msg *dns.Msg) string
- func QType(msg *dns.Msg) uint16
- func Question(domain string, qtyp uint16) ([]byte, error)
- func RTtl(msg *dns.Msg) int
- func Rcode(msg *dns.Msg) int
- func ReadPrefixed(conn *net.Conn) ([]byte, error)
- func RefusedResponseFromMessage(srcMsg *dns.Msg) (dstMsg *dns.Msg, err error)
- func RemoveEDNS0Options(msg *dns.Msg) bool
- func Request4FromRequest6(msg6 *dns.Msg) *dns.Msg
- func Request4FromResponse6(msg6 *dns.Msg) *dns.Msg
- func RequestFromResponse(msg *dns.Msg) *dns.Msg
- func Servfail(q *dns.Msg) *dns.Msg
- func Size(msg *dns.Msg) int
- func StringReverse(s string) string
- func SubstAAAARecords(out *dns.Msg, subip6s netip.Addr, ttl int) bool
- func SubstARecords(out *dns.Msg, subip4s netip.Addr, ttl int) bool
- func SubstSVCBRecordIPs(out *dns.Msg, x dns.SVCBKey, subiphints netip.Addr, ttl int) bool
- func Targets(msg *dns.Msg) (targets []string)
- func ToIp6Hint(answer dns.RR, prefix *net.IPNet) dns.RR
- func TruncatedResponse(packet []byte) ([]byte, error)
- func WithTtl(msg *dns.Msg, secs uint32) (ok bool)
- type CryptoConstruction
Constants ¶
const (
ClientMagicLen = 8
)
Variables ¶
var ( CertMagic = [4]byte{0x44, 0x4e, 0x53, 0x43} ServerMagic = [8]byte{0x72, 0x36, 0x66, 0x6e, 0x76, 0x57, 0x6a, 0x38} MinDNSPacketSize = 12 + 5 MaxDNSPacketSize = 4096 MaxDNSUDPPacketSize = 4096 MaxDNSUDPSafePacketSize = 1252 BlockTTL = uint32(5) AnsTTL = uint32(60) MaxMTU = 0xffff // 65k, ought to be enough for everybody )
Functions ¶
func AQuadAUnspecified ¶
func ComputePaddingSize ¶
Compute the number of padding bytes needed, excluding headers.
func EDNS0PadLen ¶
func ExtractMDNSDomain ¶
func FindUnique ¶
returns unique strings in n not in s as new array
func GetBlocklistStampFromURL ¶
TODO: Move to dnsx?
func GetBlocklistStampHeaderKey ¶
func GetBlocklistStampHeaderKey() string
GetBlocklistStampHeaderKey returns the http-header key for blocklists stamp
func GetInterestingRData ¶
func GetRethinkDNSRegionHeaderKey1 ¶
func GetRethinkDNSRegionHeaderKey1() string
GetBlocklistStampHeaderKey1 returns the http-header key for region set by rdns upstream on Fly
func GetRethinkDNSRegionHeaderKey2 ¶
func GetRethinkDNSRegionHeaderKey2() (r string)
GetBlocklistStampHeaderKey2 returns the http-header key for region set by rdns upstream on Cloudflare
func HasAAAAAnswer ¶
func HasAAAAQuestion ¶
whether the given msg (ans/query) has a AAAA question section
func HasAAnswer ¶
func HasAQuadAQuestion ¶
whether the given msg (ans/query) has a a/aaaa question section
func HasAQuestion ¶
whether the given msg (ans/query) has a A question section
func HasAnyAnswer ¶
func HasAnyQuestion ¶
func HasHTTPQuestion ¶
whether the given msg (ans/query) has a https question section
func HasRcodeSuccess ¶
func HasSVCBQuestion ¶
whether the given msg (ans/query) has a svcb question section
func HasTCFlag2 ¶
func IsHTTPQuestion ¶
whether question q is a https question
func IsMDNSQuery ¶
func IsNXDomain ¶
func IsSVCBQuestion ¶
whether question q is a svcb question
func IsServFailOrInvalid ¶
func MaybeToQuadA ¶
MaybeToQuadA translates an A record to a AAAA record if the prefix is not nil. The ttl of the new record is the minimum of the original ttl and minttl. If the prefix is nil or answer has an empty A record, it returns nil.
func Net2ProxyID ¶
Net2ProxyID splits network string into proto and pid; proto is the network protocol and pid is the proxy ID. May return empty strings.
func NetAndProxyID ¶
NetAndProxyID joins proto and pid into a network string. proto is the network protocol and pid is the proxy ID. May return just the separator ":", if both proto, pid are empty.
func NormalizeQName ¶
func PrefixWithSize ¶
func ReadPrefixed ¶
TODO: merge this with doh.Accept
func RemoveEDNS0Options ¶
func StringReverse ¶
func SubstSVCBRecordIPs ¶
func TruncatedResponse ¶
Types ¶
type CryptoConstruction ¶
type CryptoConstruction uint16
const ( UndefinedConstruction CryptoConstruction = iota XSalsa20Poly1305 XChacha20Poly1305 )