mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
dns: added new config dnsnoaaaa to filter AAAA response, default to false
This commit is contained in:
1 parent
27de61a59d
commit
2754fdeb60
4 files changed
+9
-3
No files matched your search
@@ -27,6 +27,7 @@ type Config struct {
|
||||
AlwaysTCP bool
|
||||
CacheSize int
|
||||
CacheLog bool
|
||||
NoAAAA bool
|
||||
}
|
||||
|
||||
// Client is a dns client struct.
|
||||
@@ -65,6 +66,10 @@ func (c *Client) Exchange(reqBytes []byte, clientAddr string, preferTCP bool) ([
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if c.config.NoAAAA && req.Question.QTYPE == QTypeAAAA {
|
||||
return nil, errors.New("AAAA query is disabled, qname: " + req.Question.QNAME)
|
||||
}
|
||||
|
||||
if req.Question.QTYPE == QTypeA || req.Question.QTYPE == QTypeAAAA {
|
||||
if v, expired := c.cache.Get(qKey(req.Question)); len(v) > 2 {
|
||||
v = valCopy(v)
|
||||
|
||||
Reference in new issue
Block a user