mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-10-12 01:58:46 +02:00
dns proxy: DNS64 synthesis for IPv6-only networks without CLAT
This commit is contained in:
1 parent
ca27f60bc4
commit
9d724869e9
6 files changed
+965
-21
No files matched your search
@@ -29,6 +29,7 @@ type Key struct {
|
||||
Name string
|
||||
Upstream string
|
||||
ECS string
|
||||
Variant string
|
||||
}
|
||||
|
||||
type Value struct {
|
||||
@@ -71,6 +72,14 @@ func NewKey(msg *dns.Msg, upstream string) Key {
|
||||
return Key{Qtype: q.Qtype, Qclass: q.Qclass, Name: normalizeQname(q.Name), Upstream: upstream, ECS: CanonicalECS(msg)}
|
||||
}
|
||||
|
||||
// NewVariantKey creates a cache key in a named result variant. Variants keep
|
||||
// derived answers separate from the upstream's answer to the same question.
|
||||
func NewVariantKey(msg *dns.Msg, upstream, variant string) Key {
|
||||
key := NewKey(msg, upstream)
|
||||
key.Variant = variant
|
||||
return key
|
||||
}
|
||||
|
||||
// CanonicalECS returns a canonical string form of the EDNS Client Subnet (ECS,
|
||||
// EDNS option 8) carried by msg, suitable for partitioning cache and
|
||||
// singleflight keys. A request with no ECS option returns "", so all ECS-less
|
||||
|
||||
Reference in new issue
Block a user