mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
doc: update for custom dnsrecord
This commit is contained in:
1 parent
a226637bfb
commit
04c6f74343
4 files changed
+39
-14
No files matched your search
+5
-7
@@ -97,7 +97,7 @@ func (c *Client) Exchange(reqBytes []byte, clientAddr string) ([]byte, error) {
|
||||
return respBytes, err
|
||||
}
|
||||
|
||||
ttl := 0
|
||||
ttl := DefaultTTL
|
||||
ips := []string{}
|
||||
for _, answer := range resp.Answers {
|
||||
if answer.TYPE == QTypeA || answer.TYPE == QTypeAAAA {
|
||||
@@ -109,16 +109,14 @@ func (c *Client) Exchange(reqBytes []byte, clientAddr string) ([]byte, error) {
|
||||
ips = append(ips, answer.IP)
|
||||
}
|
||||
|
||||
ttl = int(answer.TTL)
|
||||
if answer.TTL != 0 {
|
||||
ttl = int(answer.TTL)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// if ttl in packet is 0, set it to default value
|
||||
if ttl == 0 {
|
||||
ttl = DefaultTTL
|
||||
}
|
||||
|
||||
// add to cache
|
||||
c.cache.Put(getKey(resp.Question), respBytes, ttl)
|
||||
|
||||
|
||||
Reference in new issue
Block a user