aboutsummaryrefslogtreecommitdiff
path: root/lib/dns/dot_client.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dns/dot_client.go')
-rw-r--r--lib/dns/dot_client.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/dns/dot_client.go b/lib/dns/dot_client.go
index a3eea4af..870a1395 100644
--- a/lib/dns/dot_client.go
+++ b/lib/dns/dot_client.go
@@ -6,7 +6,6 @@ package dns
import (
"crypto/tls"
- "encoding/binary"
"errors"
"fmt"
"net"
@@ -162,12 +161,13 @@ func (cl *DoTClient) 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 {