diff --git a/_examples/q/q.go b/_examples/q/q.go index fcdb645b..2cdb00d6 100644 --- a/_examples/q/q.go +++ b/_examples/q/q.go @@ -4,6 +4,8 @@ import ( "net" "dns" "dns/resolver" + "bytes" + "compress/gzip" "os" "flag" "fmt" @@ -105,6 +107,13 @@ FLAGS: } fmt.Printf("%v\n", in.Dns) fmt.Printf("%s\n", in.Meta) + // zip the message + msgbuf, _ := in.Dns.Pack() + var zbuff bytes.Buffer + w, _ := gzip.NewWriterLevel(&zbuff, gzip.BestCompression) + w.Write(msgbuf) + w.Close() + fmt.Printf(";; Compressed: %d\n", zbuff.Len()) } else { fmt.Printf("%v\n", in.Error.String()) }