+ auto-hosts: respond to PTR requests
Close #1562 Squashed commit of the following: commit d5c6bb0e5f0c8c1618bd0df764ae86a5e62a850b Author: Simon Zolin <s.zolin@adguard.com> Date: Mon Apr 13 14:10:10 2020 +0300 + auto-hosts: respond to PTR requests
This commit is contained in:
@@ -273,8 +273,13 @@ type Result struct {
|
||||
FilterID int64 `json:",omitempty"` // Filter ID the rule belongs to
|
||||
|
||||
// for ReasonRewrite:
|
||||
CanonName string `json:",omitempty"` // CNAME value
|
||||
IPList []net.IP `json:",omitempty"` // list of IP addresses
|
||||
CanonName string `json:",omitempty"` // CNAME value
|
||||
|
||||
// for RewriteEtcHosts:
|
||||
ReverseHost string `json:",omitempty"`
|
||||
|
||||
// for ReasonRewrite & RewriteEtcHosts:
|
||||
IPList []net.IP `json:",omitempty"` // list of IP addresses
|
||||
|
||||
// for FilteredBlockedService:
|
||||
ServiceName string `json:",omitempty"` // Name of the blocked service
|
||||
@@ -312,12 +317,19 @@ func (d *Dnsfilter) CheckHost(host string, qtype uint16, setts *RequestFiltering
|
||||
}
|
||||
|
||||
if d.Config.AutoHosts != nil {
|
||||
ips := d.Config.AutoHosts.Process(host)
|
||||
ips := d.Config.AutoHosts.Process(host, qtype)
|
||||
if ips != nil {
|
||||
result.Reason = RewriteEtcHosts
|
||||
result.IPList = ips
|
||||
return result, nil
|
||||
}
|
||||
|
||||
revHost := d.Config.AutoHosts.ProcessReverse(host, qtype)
|
||||
if len(revHost) != 0 {
|
||||
result.Reason = RewriteEtcHosts
|
||||
result.ReverseHost = revHost + "."
|
||||
return result, nil
|
||||
}
|
||||
}
|
||||
|
||||
// try filter lists first
|
||||
|
||||
Reference in New Issue
Block a user