From 21ba49c291a44bd348308dbd01de337dcf0ab7f0 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Sun, 21 Jan 2024 05:19:35 -0500 Subject: [PATCH] Improve NewRR documentation (#1531) In particular, document the default origin. --- scan.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scan.go b/scan.go index 1f92ae421..315bf8a6f 100644 --- a/scan.go +++ b/scan.go @@ -101,12 +101,13 @@ 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. +// NewRR reads a string s and returns the first RR. // 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, TTL defaults to 3600, and +// origin for resolving relative domain names defaults to the DNS root (.). +// Full zone file syntax is supported, including directives like $TTL and $ORIGIN. +// All fields of the returned RR are set from the read data, 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"), "")