diff --git a/defaults.go b/defaults.go index b059f6fc..8add6ab1 100644 --- a/defaults.go +++ b/defaults.go @@ -105,7 +105,7 @@ func (dns *Msg) SetAxfr(z string) *Msg { // SetTsig appends a TSIG RR to the message. // This is only a skeleton TSIG RR that is added as the last RR in the -// additional section. The Tsig is calculated when the message is being send. +// additional section. The TSIG is calculated when the message is being send. func (dns *Msg) SetTsig(z, algo string, fudge uint16, timesigned int64) *Msg { t := new(TSIG) t.Hdr = RR_Header{z, TypeTSIG, ClassANY, 0, 0} @@ -364,7 +364,7 @@ func (t Type) String() string { // String returns the string representation for the class c. func (c Class) String() string { if s, ok := ClassToString[uint16(c)]; ok { - // Only emit mnemonics when they are unambiguous, specically ANY is in both. + // Only emit mnemonics when they are unambiguous, specially ANY is in both. if _, ok := StringToType[s]; !ok { return s } diff --git a/doc.go b/doc.go index 3318b77e..92421681 100644 --- a/doc.go +++ b/doc.go @@ -209,7 +209,7 @@ Basic use pattern validating and replying to a message that has TSIG set. // *Msg r has an TSIG record and it was validated m.SetTsig("axfr.", dns.HmacMD5, 300, time.Now().Unix()) } else { - // *Msg r has an TSIG records and it was not valided + // *Msg r has an TSIG records and it was not validated } } w.WriteMsg(m) diff --git a/duplicate.go b/duplicate.go index 49e6940b..d21ae1ca 100644 --- a/duplicate.go +++ b/duplicate.go @@ -3,9 +3,8 @@ package dns //go:generate go run duplicate_generate.go // IsDuplicate checks of r1 and r2 are duplicates of each other, excluding the TTL. -// So this means the header data is equal *and* the RDATA is the same. Return true -// is so, otherwise false. -// It's a protocol violation to have identical RRs in a message. +// So this means the header data is equal *and* the RDATA is the same. Returns true +// if so, otherwise false. It's a protocol violation to have identical RRs in a message. func IsDuplicate(r1, r2 RR) bool { // Check whether the record header is identical. if !r1.Header().isDuplicate(r2.Header()) { diff --git a/labels.go b/labels.go index 10d82471..df1675df 100644 --- a/labels.go +++ b/labels.go @@ -83,7 +83,7 @@ func CompareDomainName(s1, s2 string) (n int) { return } -// CountLabel counts the the number of labels in the string s. +// CountLabel counts the number of labels in the string s. // s must be a syntactically valid domain name. func CountLabel(s string) (labels int) { if s == "." { diff --git a/nsecx.go b/nsecx.go index 8f071a47..f8826817 100644 --- a/nsecx.go +++ b/nsecx.go @@ -43,7 +43,7 @@ func HashName(label string, ha uint8, iter uint16, salt string) string { return toBase32(nsec3) } -// Cover returns true if a name is covered by the NSEC3 record +// Cover returns true if a name is covered by the NSEC3 record. func (rr *NSEC3) Cover(name string) bool { nameHash := HashName(name, rr.Hash, rr.Iterations, rr.Salt) owner := strings.ToUpper(rr.Hdr.Name) diff --git a/privaterr.go b/privaterr.go index e28f0663..cda6cae3 100644 --- a/privaterr.go +++ b/privaterr.go @@ -13,7 +13,6 @@ type PrivateRdata interface { // Pack is used when packing a private RR into a buffer. Pack([]byte) (int, error) // Unpack is used when unpacking a private RR from a buffer. - // TODO(miek): diff. signature than Pack, see edns0.go for instance. Unpack([]byte) (int, error) // Copy copies the Rdata into the PrivateRdata argument. Copy(PrivateRdata) error diff --git a/scan.go b/scan.go index 671018b1..e52f43c9 100644 --- a/scan.go +++ b/scan.go @@ -103,15 +103,12 @@ type ttlState struct { isByDirective bool // isByDirective indicates whether ttl was set by a $TTL directive } -// NewRR reads the RR contained in the string s. Only the first RR is -// returned. If s contains no records, NewRR will return nil with no -// error. +// NewRR reads the RR contained in the string s. Only the first RR is returned. +// If s contains no records, NewRR will return nil with no error. // -// The class defaults to IN and TTL defaults to 3600. The full zone -// file syntax like $TTL, $ORIGIN, etc. is supported. -// -// All fields of the returned RR are set, except RR.Header().Rdlength -// which is set to 0. +// The class defaults to IN and TTL defaults to 3600. The full zone file syntax +// like $TTL, $ORIGIN, etc. is supported. All fields of the returned RR are +// set, except RR.Header().Rdlength which is set to 0. func NewRR(s string) (RR, error) { if len(s) > 0 && s[len(s)-1] != '\n' { // We need a closing newline return ReadRR(strings.NewReader(s+"\n"), "") @@ -247,7 +244,7 @@ type ZoneParser struct { includeDepth uint8 - includeAllowed bool + includeAllowed bool generateDisallowed bool } diff --git a/types.go b/types.go index a6048cb1..b8c75557 100644 --- a/types.go +++ b/types.go @@ -165,11 +165,11 @@ const ( _RD = 1 << 8 // recursion desired _RA = 1 << 7 // recursion available _Z = 1 << 6 // Z - _AD = 1 << 5 // authticated data + _AD = 1 << 5 // authenticated data _CD = 1 << 4 // checking disabled ) -// Various constants used in the LOC RR, See RFC 1887. +// Various constants used in the LOC RR. See RFC 1887. const ( LOC_EQUATOR = 1 << 31 // RFC 1876, Section 2. LOC_PRIMEMERIDIAN = 1 << 31 // RFC 1876, Section 2. @@ -231,7 +231,7 @@ func (q *Question) String() (s string) { return s } -// ANY is a wildcard record. See RFC 1035, Section 3.2.3. ANY +// ANY is a wild card record. See RFC 1035, Section 3.2.3. ANY // is named "*" there. type ANY struct { Hdr RR_Header @@ -759,8 +759,8 @@ type LOC struct { Altitude uint32 } -// cmToM takes a cm value expressed in RFC1876 SIZE mantissa/exponent -// format and returns a string in m (two decimals for the cm) +// cmToM takes a cm value expressed in RFC 1876 SIZE mantissa/exponent +// format and returns a string in m (two decimals for the cm). func cmToM(m, e uint8) string { if e < 2 { if e == 1 { diff --git a/version.go b/version.go index cab46b4f..bab2c990 100644 --- a/version.go +++ b/version.go @@ -3,13 +3,13 @@ package dns import "fmt" // Version is current version of this library. -var Version = V{1, 1, 27} +var Version = v{1, 1, 27} -// V holds the version of this library. -type V struct { +// v holds the version of this library. +type v struct { Major, Minor, Patch int } -func (v V) String() string { +func (v v) String() string { return fmt.Sprintf("%d.%d.%d", v.Major, v.Minor, v.Patch) } diff --git a/version_test.go b/version_test.go index 61c40484..3aff390c 100644 --- a/version_test.go +++ b/version_test.go @@ -3,7 +3,7 @@ package dns import "testing" func TestVersion(t *testing.T) { - v := V{1, 0, 0} + v := v{1, 0, 0} if x := v.String(); x != "1.0.0" { t.Fatalf("Failed to convert version %v, got: %s", v, x) }