From d7a57ee1747a9e9c44921f84f3e7096def465158 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Tue, 10 Jan 2012 09:02:13 +0100 Subject: [PATCH] Some tweaks --- rawmsg.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rawmsg.go b/rawmsg.go index 412da6d4..c2ad5c61 100644 --- a/rawmsg.go +++ b/rawmsg.go @@ -26,7 +26,7 @@ type rawmove struct { length int // used in calculating how much to shrink the message } -// Compress performs name comression in the dns message contained in buf. +// Compress performs name compression in the dns message contained in buf. // It returns the shortened buffer. func Compress(msg []byte) []byte { @@ -39,6 +39,8 @@ func Compress(msg []byte) []byte { // moves. // TODO: Maybe it should be optimized. // TODO: put this in the packRR function + // TODO: only compresses owner names, not the well known RR + // These all those defined in 1035, important ones: CNAME, MX, NS, PTR, SOA // Map the labels to the offset in the message table := make(map[string]int) @@ -111,7 +113,7 @@ Loop: break Loop } // If we are too deep in the message we cannot point to - // it, so skip this label. + // it, otherwise we can just save it. if off < maxPointer { l[i] = rawlabel{offset: off, name: string(msg[off : off+c+1])} i++