aboutsummaryrefslogtreecommitdiff
path: root/lib/dns/tcp_client.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dns/tcp_client.go')
-rw-r--r--lib/dns/tcp_client.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/dns/tcp_client.go b/lib/dns/tcp_client.go
index 402540f6..da745892 100644
--- a/lib/dns/tcp_client.go
+++ b/lib/dns/tcp_client.go
@@ -5,7 +5,6 @@
package dns
import (
- "encoding/binary"
"errors"
"fmt"
"io"
@@ -172,12 +171,13 @@ func (cl *TCPClient) Write(msg []byte) (n int, err error) {
}
var (
- lenmsg = len(msg)
- packet = make([]byte, 0, 2+lenmsg)
+ lenmsg = uint16(len(msg))
+ packet = make([]byte, 2+lenmsg)
)
- packet = binary.BigEndian.AppendUint16(packet, uint16(lenmsg))
- packet = append(packet, msg...)
+ packet[0] = byte(lenmsg >> 8)
+ packet[1] = byte(lenmsg)
+ copy(packet[2:], msg)
n, err = cl.conn.Write(packet)
if err != nil {