diff --git a/msg.go b/msg.go index 1d90fa33..d8300ca2 100644 --- a/msg.go +++ b/msg.go @@ -666,6 +666,7 @@ func structValue(any interface{}) reflect.Value { return reflect.ValueOf(any).Elem() } +// PackStruct packs any structure to wire format. func PackStruct(any interface{}, msg []byte, off int) (off1 int, err error) { off, err = packStructValue(structValue(any), msg, off, nil, false) return off, err @@ -1028,6 +1029,8 @@ func unpackUint16(msg []byte, off int) (v uint16, off1 int) { return } +// UnpackStruct unpacks a binary message from offset off to the interface +// value given. func UnpackStruct(any interface{}, msg []byte, off int) (off1 int, err error) { off, err = unpackStructValue(structValue(any), msg, off) return off, err diff --git a/zscan.go b/zscan.go index 0d934244..b6bfff40 100644 --- a/zscan.go +++ b/zscan.go @@ -96,7 +96,7 @@ type lex struct { type Token struct { RR // the scanned resource record when error is not nil Error *ParseError // when an error occured, this has the error specifics - Comment string // A potential comment positioned after the RR, but on the same line + Comment string // A potential comment positioned after the RR and on the same line } // NewRR reads the RR contained in the string s. Only the first RR is returned. @@ -140,7 +140,7 @@ func ReadRR(q io.Reader, filename string) (RR, error) { // // foo. IN A 10.0.0.1 ; this is a comment // -// The text "; this is comment" is returned in Token.comment . Comments inside the +// The text "; this is comment" is returned in Token.Comment . Comments inside the // RR are discarded. Comments on a line by themselves are discarded too. func ParseZone(r io.Reader, origin, file string) chan Token { return parseZoneHelper(r, origin, file, 10000)