mirror of
https://github.com/miekg/dns.git
synced 2025-12-16 17:21:17 +01:00
Small doc cleanups
This commit is contained in:
parent
8de6ade9ec
commit
5b9c36bf67
11
doc.go
11
doc.go
@ -13,7 +13,8 @@ Resource records are native types. They are not stored in wire format.
|
|||||||
Basic usage pattern for creating a new resource record:
|
Basic usage pattern for creating a new resource record:
|
||||||
|
|
||||||
r := new(dns.MX)
|
r := new(dns.MX)
|
||||||
r.Hdr = dns.RR_Header{Name: "miek.nl.", Rrtype: dns.TypeMX, Class: dns.ClassINET, Ttl: 3600}
|
r.Hdr = dns.RR_Header{Name: "miek.nl.", Rrtype: dns.TypeMX,
|
||||||
|
Class: dns.ClassINET, Ttl: 3600}
|
||||||
r.Preference = 10
|
r.Preference = 10
|
||||||
r.Mx = "mx.miek.nl."
|
r.Mx = "mx.miek.nl."
|
||||||
|
|
||||||
@ -57,8 +58,8 @@ server configured on 127.0.0.1 and port 53:
|
|||||||
c := new(dns.Client)
|
c := new(dns.Client)
|
||||||
in, rtt, err := c.Exchange(m1, "127.0.0.1:53")
|
in, rtt, err := c.Exchange(m1, "127.0.0.1:53")
|
||||||
|
|
||||||
Suppressing
|
Suppressing multiple outstanding queries (with the same question, type and
|
||||||
multiple outstanding queries (with the same question, type and class) is as easy as setting:
|
class) is as easy as setting:
|
||||||
|
|
||||||
c.SingleInflight = true
|
c.SingleInflight = true
|
||||||
|
|
||||||
@ -118,7 +119,7 @@ certain resource records or names in a zone to specify if resource records
|
|||||||
should be added or removed. The table from RFC 2136 supplemented with the Go
|
should be added or removed. The table from RFC 2136 supplemented with the Go
|
||||||
DNS function shows which functions exist to specify the prerequisites.
|
DNS function shows which functions exist to specify the prerequisites.
|
||||||
|
|
||||||
3.2.4 - Table Of Metavalues Used In Prerequisite Section
|
3.2.4 - Table Of Metavalues Used In Prerequisite Section
|
||||||
|
|
||||||
CLASS TYPE RDATA Meaning Function
|
CLASS TYPE RDATA Meaning Function
|
||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
@ -133,7 +134,7 @@ If you have decided on the prerequisites you can tell what RRs should
|
|||||||
be added or deleted. The next table shows the options you have and
|
be added or deleted. The next table shows the options you have and
|
||||||
what functions to call.
|
what functions to call.
|
||||||
|
|
||||||
3.4.2.6 - Table Of Metavalues Used In Update Section
|
3.4.2.6 - Table Of Metavalues Used In Update Section
|
||||||
|
|
||||||
CLASS TYPE RDATA Meaning Function
|
CLASS TYPE RDATA Meaning Function
|
||||||
---------------------------------------------------------------
|
---------------------------------------------------------------
|
||||||
|
|||||||
@ -102,7 +102,7 @@ func CountLabel(s string) (labels int) {
|
|||||||
|
|
||||||
// Split splits a name s into its label indexes.
|
// Split splits a name s into its label indexes.
|
||||||
// www.miek.nl. returns []int{0, 4, 9}, www.miek.nl also returns []int{0, 4, 9}.
|
// www.miek.nl. returns []int{0, 4, 9}, www.miek.nl also returns []int{0, 4, 9}.
|
||||||
// The root name (.) returns nil. Also see dns.SplitDomainName.
|
// The root name (.) returns nil. Also see SplitDomainName.
|
||||||
func Split(s string) []int {
|
func Split(s string) []int {
|
||||||
if s == "." {
|
if s == "." {
|
||||||
return nil
|
return nil
|
||||||
@ -123,6 +123,7 @@ func Split(s string) []int {
|
|||||||
// NextLabel returns the index of the start of the next label in the
|
// NextLabel returns the index of the start of the next label in the
|
||||||
// string s starting at offset.
|
// string s starting at offset.
|
||||||
// The bool end is true when the end of the string has been reached.
|
// The bool end is true when the end of the string has been reached.
|
||||||
|
// Also see PrevLabel.
|
||||||
func NextLabel(s string, offset int) (i int, end bool) {
|
func NextLabel(s string, offset int) (i int, end bool) {
|
||||||
quote := false
|
quote := false
|
||||||
for i = offset; i < len(s)-1; i++ {
|
for i = offset; i < len(s)-1; i++ {
|
||||||
@ -145,6 +146,7 @@ func NextLabel(s string, offset int) (i int, end bool) {
|
|||||||
// PrevLabel returns the index of the label when starting from the right and
|
// PrevLabel returns the index of the label when starting from the right and
|
||||||
// jumping n labels to the left.
|
// jumping n labels to the left.
|
||||||
// The bool start is true when the start of the string has been overshot.
|
// The bool start is true when the start of the string has been overshot.
|
||||||
|
// Also see NextLabel.
|
||||||
func PrevLabel(s string, n int) (i int, start bool) {
|
func PrevLabel(s string, n int) (i int, start bool) {
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
return len(s), false
|
return len(s), false
|
||||||
|
|||||||
12
types.go
12
types.go
@ -91,26 +91,24 @@ const (
|
|||||||
TypeLP uint16 = 107
|
TypeLP uint16 = 107
|
||||||
TypeEUI48 uint16 = 108
|
TypeEUI48 uint16 = 108
|
||||||
TypeEUI64 uint16 = 109
|
TypeEUI64 uint16 = 109
|
||||||
|
TypeURI uint16 = 256
|
||||||
|
TypeCAA uint16 = 257
|
||||||
|
|
||||||
TypeTKEY uint16 = 249
|
TypeTKEY uint16 = 249
|
||||||
TypeTSIG uint16 = 250
|
TypeTSIG uint16 = 250
|
||||||
|
|
||||||
// valid Question.Qtype only
|
// valid Question.Qtype only
|
||||||
|
|
||||||
TypeIXFR uint16 = 251
|
TypeIXFR uint16 = 251
|
||||||
TypeAXFR uint16 = 252
|
TypeAXFR uint16 = 252
|
||||||
TypeMAILB uint16 = 253
|
TypeMAILB uint16 = 253
|
||||||
TypeMAILA uint16 = 254
|
TypeMAILA uint16 = 254
|
||||||
TypeANY uint16 = 255
|
TypeANY uint16 = 255
|
||||||
|
|
||||||
TypeURI uint16 = 256
|
|
||||||
TypeCAA uint16 = 257
|
|
||||||
TypeTA uint16 = 32768
|
TypeTA uint16 = 32768
|
||||||
TypeDLV uint16 = 32769
|
TypeDLV uint16 = 32769
|
||||||
TypeReserved uint16 = 65535
|
TypeReserved uint16 = 65535
|
||||||
|
|
||||||
// valid Question.Qclass
|
// valid Question.Qclass
|
||||||
|
|
||||||
ClassINET = 1
|
ClassINET = 1
|
||||||
ClassCSNET = 2
|
ClassCSNET = 2
|
||||||
ClassCHAOS = 3
|
ClassCHAOS = 3
|
||||||
@ -118,8 +116,7 @@ const (
|
|||||||
ClassNONE = 254
|
ClassNONE = 254
|
||||||
ClassANY = 255
|
ClassANY = 255
|
||||||
|
|
||||||
// Msg.rcode
|
// Message Response Codes.
|
||||||
|
|
||||||
RcodeSuccess = 0
|
RcodeSuccess = 0
|
||||||
RcodeFormatError = 1
|
RcodeFormatError = 1
|
||||||
RcodeServerFailure = 2
|
RcodeServerFailure = 2
|
||||||
@ -140,8 +137,7 @@ const (
|
|||||||
RcodeBadAlg = 21
|
RcodeBadAlg = 21
|
||||||
RcodeBadTrunc = 22 // TSIG
|
RcodeBadTrunc = 22 // TSIG
|
||||||
|
|
||||||
// Opcode, there is no 3
|
// Message Opcodes. There is no 3.
|
||||||
|
|
||||||
OpcodeQuery = 0
|
OpcodeQuery = 0
|
||||||
OpcodeIQuery = 1
|
OpcodeIQuery = 1
|
||||||
OpcodeStatus = 2
|
OpcodeStatus = 2
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user