a go dns packet parser

do not append with encode_domain

Changed files
+11 -11
+11 -11
resource_record.go
···
}
func (ns *NS) Encode(bytes []byte, offsets *map[string]uint8) []byte {
-
return append(bytes, encode_domain(bytes, ns.NSDName, offsets)...)
+
return encode_domain(bytes, ns.NSDName, offsets)
}
func (ns NS) String() string {
···
}
func (md *MD) Encode(bytes []byte, offsets *map[string]uint8) []byte {
-
return append(bytes, encode_domain(bytes, md.MADName, offsets)...)
+
return encode_domain(bytes, md.MADName, offsets)
}
func (md MD) String() string {
···
}
func (mf *MF) Encode(bytes []byte, offsets *map[string]uint8) []byte {
-
return append(bytes, encode_domain(bytes, mf.MADName, offsets)...)
+
return encode_domain(bytes, mf.MADName, offsets)
}
func (mf MF) String() string {
···
}
func (c *CNAME) Encode(bytes []byte, offsets *map[string]uint8) []byte {
-
return append(bytes, encode_domain(bytes, c.CName, offsets)...)
+
return encode_domain(bytes, c.CName, offsets)
}
func (c CNAME) String() string {
···
}
func (mb *MB) Encode(bytes []byte, offsets *map[string]uint8) []byte {
-
return append(bytes, encode_domain(bytes, mb.MADName, offsets)...)
+
return encode_domain(bytes, mb.MADName, offsets)
}
func (mb MB) String() string {
···
}
func (mg *MG) Encode(bytes []byte, offsets *map[string]uint8) []byte {
-
return append(bytes, encode_domain(bytes, mg.MGMName, offsets)...)
+
return encode_domain(bytes, mg.MGMName, offsets)
}
func (mg MG) String() string {
···
}
func (mr *MR) Encode(bytes []byte, offsets *map[string]uint8) []byte {
-
return append(bytes, encode_domain(bytes, mr.NEWName, offsets)...)
+
return encode_domain(bytes, mr.NEWName, offsets)
}
func (mr MR) String() string {
···
}
func (ptr *PTR) Encode(bytes []byte, offsets *map[string]uint8) []byte {
-
return append(bytes, encode_domain(bytes, ptr.PTRDName, offsets)...)
+
return encode_domain(bytes, ptr.PTRDName, offsets)
}
func (ptr PTR) String() string {
···
}
func (minfo *MINFO) Encode(bytes []byte, offsets *map[string]uint8) []byte {
-
bytes = append(bytes, encode_domain(bytes, minfo.RMailBx, offsets)...)
-
bytes = append(bytes, encode_domain(bytes, minfo.EMailBx, offsets)...)
+
bytes = encode_domain(bytes, minfo.RMailBx, offsets)
+
bytes = encode_domain(bytes, minfo.EMailBx, offsets)
return bytes
}
···
func (mx *MX) Encode(bytes []byte, offsets *map[string]uint8) []byte {
bytes = binary.BigEndian.AppendUint16(bytes, mx.Preference)
-
bytes = append(bytes, encode_domain(bytes, mx.Exchange, offsets)...)
+
bytes = encode_domain(bytes, mx.Exchange, offsets)
return bytes
}