mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
general: optimize memory allocations
This commit is contained in:
1 parent
167e6e5d29
commit
31f7c50cbc
9 files changed
+73
-67
No files matched your search
+7
-2
@@ -3,7 +3,6 @@ package dns
|
||||
import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"strings"
|
||||
@@ -308,5 +307,11 @@ func (c *Client) MakeResponse(domain string, ip string) (*Message, error) {
|
||||
}
|
||||
|
||||
func qKey(q *Question) string {
|
||||
return fmt.Sprintf("%s/%d", q.QNAME, q.QTYPE)
|
||||
switch q.QTYPE {
|
||||
case QTypeA:
|
||||
return q.QNAME + "/4"
|
||||
case QTypeAAAA:
|
||||
return q.QNAME + "/6"
|
||||
}
|
||||
return q.QNAME
|
||||
}
|
||||
Reference in new issue
Block a user