View definition


Defined in


The Cookie EDNS0 option

o := new(dns.OPT)
o.Hdr.Name = "."
o.Hdr.Rrtype = dns.TypeOPT
e := new(dns.EDNS0_COOKIE)
e.Code = dns.EDNS0COOKIE
e.Cookie = "24a5ac.."
o.Option = append(o.Option, e)

The Cookie field consists out of a client cookie (RFC 7873 Section 4), that is always 8 bytes. It may then optionally be followed by the server cookie. The server cookie is of variable length, 8 to a maximum of 32 bytes. In other words:

cCookie := o.Cookie[:16]
sCookie := o.Cookie[16:]

There is no guarantee that the Cookie string has a specific length.

EDNS0_COOKIE is referenced in 1 repository