From 795b6cb581c6407f353a68bfba835dadce0fbf8c Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Sun, 9 Sep 2012 13:36:43 +0200 Subject: [PATCH] Add some more docs A per Ask's request add some docs on how a server should deal with EDNS0 options in the OPT RR. closes #27 --- edns.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/edns.go b/edns.go index 2418ac0a..41bd0224 100644 --- a/edns.go +++ b/edns.go @@ -8,6 +8,20 @@ // o.Hdr.Name = "." // o.Hdr.Rrtype = dns.TypeOPT // +// The rdata of an OPT RR consists out of a slice of EDNS0 interfaces. Currently +// only a few have been standardized: EDNS0_NSID (RFC 5001) and EDNS0_SUBNET (draft). Note that +// these options may be combined in an OPT RR. +// Basic use pattern for a server to check if (and which) options are set: +// +// // o is a dns.RR_OPT +// for _, s := range o.Options { +// switch e := s.(type) { +// case *dns.EDNS0_NSID: +// // do stuff with e.Nsid +// case *dns.EDNS0_SUBNET: +// // access e.Family, e.Address, etc. +// } +// } package dns import ( @@ -130,7 +144,8 @@ type EDNS0 interface { } // The nsid EDNS0 option is used to retrieve some sort of nameserver -// identifier. The identifier is an opaque string encoded as hex. +// identifier. When seding a request Nsid must be set to the empty string +// The identifier is an opaque string encoded as hex. // Basic use pattern for creating an nsid option: // // o := new(dns.RR_OPT)