docstring_tokens
stringlengths 0
76.5k
| code_tokens
stringlengths 75
1.81M
| label_window
sequencelengths 4
2.12k
| html_url
stringlengths 74
116
| file_name
stringlengths 3
311
|
---|---|---|---|---|
Filters []plugFilter | <mask> ParentalBlockHost string
<mask> QueryLogEnabled bool
<mask> BlockedTTL uint32 // in seconds, default 3600
<mask> }
<mask>
<mask> type plug struct {
<mask> d *dnsfilter.Dnsfilter
<mask> Next plugin.Handler
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove FilterFile string `yaml:"-"`
Port int `yaml:"port"`
ProtectionEnabled bool `yaml:"protection_enabled"`
FilteringEnabled bool `yaml:"filtering_enabled"`
SafeBrowsingEnabled bool `yaml:"safebrowsing_enabled"`
SafeSearchEnabled bool `yaml:"safesearch_enabled"`
ParentalEnabled bool `yaml:"parental_enabled"`
ParentalSensitivity int `yaml:"parental_sensitivity"`
BlockedResponseTTL int `yaml:"blocked_response_ttl"`
QueryLogEnabled bool `yaml:"querylog_enabled"`
Pprof string `yaml:"-"`
Cache string `yaml:"-"`
Prometheus string `yaml:"-"`
UpstreamDNS []string `yaml:"upstream_dns"`
</s> add Filters []coreDnsFilter `yaml:"-"`
Port int `yaml:"port"`
ProtectionEnabled bool `yaml:"protection_enabled"`
FilteringEnabled bool `yaml:"filtering_enabled"`
SafeBrowsingEnabled bool `yaml:"safebrowsing_enabled"`
SafeSearchEnabled bool `yaml:"safesearch_enabled"`
ParentalEnabled bool `yaml:"parental_enabled"`
ParentalSensitivity int `yaml:"parental_sensitivity"`
BlockedResponseTTL int `yaml:"blocked_response_ttl"`
QueryLogEnabled bool `yaml:"querylog_enabled"`
Pprof string `yaml:"-"`
Cache string `yaml:"-"`
Prometheus string `yaml:"-"`
UpstreamDNS []string `yaml:"upstream_dns"` </s> remove BindHost string `yaml:"bind_host"`
BindPort int `yaml:"bind_port"`
AuthName string `yaml:"auth_name"`
AuthPass string `yaml:"auth_pass"`
CoreDNS coreDNSConfig `yaml:"coredns"`
Filters []filter `yaml:"filters"`
UserRules []string `yaml:"user_rules"`
</s> add // Schema version of the config file. This value is used when performing the app updates.
SchemaVersion int `yaml:"schema_version"`
BindHost string `yaml:"bind_host"`
BindPort int `yaml:"bind_port"`
AuthName string `yaml:"auth_name"`
AuthPass string `yaml:"auth_pass"`
CoreDNS coreDNSConfig `yaml:"coredns"`
Filters []filter `yaml:"filters"`
UserRules []string `yaml:"user_rules"` | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | coredns_plugin/coredns_plugin.go |
Filters: make([]plugFilter, 0), | <mask> ParentalBlockHost: "family.block.dns.adguard.com",
<mask> BlockedTTL: 3600, // in seconds
<mask> }
<mask>
<mask> //
<mask> // coredns handling functions
<mask> //
<mask> func setupPlugin(c *caddy.Controller) (*plug, error) {
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove return value
</s> add return nil </s> remove func (filter *filter) update(now time.Time) (bool, error) {
</s> add // Checks for filters updates
// If "force" is true -- does not check the filter's LastUpdated field
func (filter *filter) update(force bool) (bool, error) { </s> remove // eat all args so that coredns can start happily
</s> add // Eat all args so that coredns can start happily </s> remove func clamp(value, low, high int) int {
if value < low {
return low
</s> add // ----------------------------------
// helper functions for working with files
// ----------------------------------
// Writes data first to a temporary file and then renames it to what's specified in path
func writeFileSafe(path string, data []byte) error {
dir := filepath.Dir(path)
err := os.MkdirAll(dir, 0755)
if err != nil {
return err
}
tmpPath := path + ".tmp"
err = ioutil.WriteFile(tmpPath, data, 0644)
if err != nil {
return err </s> remove binaryFile: "coredns", // only filename, no path
coreFile: "Corefile", // only filename, no path
FilterFile: "dnsfilter.txt", // only filename, no path
</s> add binaryFile: "coredns", // only filename, no path
coreFile: "Corefile", // only filename, no path | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | coredns_plugin/coredns_plugin.go |
log.Println("Initializing the CoreDNS plugin")
| <mask> settings: defaultPluginSettings,
<mask> d: dnsfilter.New(),
<mask> }
<mask>
<mask> filterFileNames := []string{}
<mask> for c.Next() {
<mask> args := c.RemainingArgs()
<mask> if len(args) > 0 {
<mask> filterFileNames = append(filterFileNames, args...)
<mask> }
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove args := c.RemainingArgs()
if len(args) > 0 {
filterFileNames = append(filterFileNames, args...)
}
</s> add </s> remove switch c.Val() {
</s> add blockValue := c.Val()
switch blockValue { </s> remove log.Printf("filterFileNames = %+v", filterFileNames)
</s> add for _, filter := range p.settings.Filters {
log.Printf("Loading rules from %s", filter.Path) </s> remove for i, filterFileName := range filterFileNames {
file, err := os.Open(filterFileName)
</s> add file, err := os.Open(filter.Path) </s> remove // eat all args so that coredns can start happily
</s> add // Eat all args so that coredns can start happily | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | coredns_plugin/coredns_plugin.go |
<mask> }
<mask>
<mask> filterFileNames := []string{}
<mask> for c.Next() {
<mask> args := c.RemainingArgs()
<mask> if len(args) > 0 {
<mask> filterFileNames = append(filterFileNames, args...)
<mask> }
<mask> for c.NextBlock() {
<mask> switch c.Val() {
<mask> case "safebrowsing":
<mask> p.d.EnableSafeBrowsing()
<mask> if c.NextArg() {
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove switch c.Val() {
</s> add blockValue := c.Val()
switch blockValue { </s> remove filterFileNames := []string{}
</s> add log.Println("Initializing the CoreDNS plugin")
</s> remove log.Printf("filterFileNames = %+v", filterFileNames)
</s> add for _, filter := range p.settings.Filters {
log.Printf("Loading rules from %s", filter.Path) </s> remove for i, filterFileName := range filterFileNames {
file, err := os.Open(filterFileName)
</s> add file, err := os.Open(filter.Path) </s> remove err := writeFilterFile()
if err != nil {
errortext := fmt.Sprintf("Couldn't write filter file: %s", err)
log.Println(errortext)
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | coredns_plugin/coredns_plugin.go |
|
blockValue := c.Val()
switch blockValue { | <mask> if len(args) > 0 {
<mask> filterFileNames = append(filterFileNames, args...)
<mask> }
<mask> for c.NextBlock() {
<mask> switch c.Val() {
<mask> case "safebrowsing":
<mask> p.d.EnableSafeBrowsing()
<mask> if c.NextArg() {
<mask> if len(c.Val()) == 0 {
<mask> return nil, c.ArgErr()
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove args := c.RemainingArgs()
if len(args) > 0 {
filterFileNames = append(filterFileNames, args...)
}
</s> add </s> remove filterFileNames := []string{}
</s> add log.Println("Initializing the CoreDNS plugin")
</s> remove err = d.AddRule(line, 0)
if err == dnsfilter.ErrAlreadyExists || err == dnsfilter.ErrInvalidSyntax {
continue
}
if err != nil {
log.Printf("Cannot add rule %s from %s: %s", line, filter.URL, err)
// Just ignore invalid rules
continue
}
</s> add </s> remove d := dnsfilter.New()
</s> add // Count lines in the filter </s> remove log.Printf("filterFileNames = %+v", filterFileNames)
</s> add for _, filter := range p.settings.Filters {
log.Printf("Loading rules from %s", filter.Path) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | coredns_plugin/coredns_plugin.go |
for _, filter := range p.settings.Filters {
log.Printf("Loading rules from %s", filter.Path) | <mask> }
<mask> }
<mask> }
<mask>
<mask> log.Printf("filterFileNames = %+v", filterFileNames)
<mask>
<mask> for i, filterFileName := range filterFileNames {
<mask> file, err := os.Open(filterFileName)
<mask> if err != nil {
<mask> return nil, err
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove for i, filterFileName := range filterFileNames {
file, err := os.Open(filterFileName)
</s> add file, err := os.Open(filter.Path) </s> remove if doConfigRename {
err := renameOldConfigIfNeccessary()
if err != nil {
panic(err)
}
}
</s> add </s> remove config.RUnlock()
err := ioutil.WriteFile(filterpath+".tmp", data, 0644)
if err != nil {
log.Printf("Couldn't write filter file: %s", err)
</s> add filterFilePath := filter.getFilterFilePath()
log.Printf("Loading filter %d contents to: %s", filter.ID, filterFilePath)
if _, err := os.Stat(filterFilePath); os.IsNotExist(err) {
// do nothing, file doesn't exist </s> remove return err
</s> add return nil | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | coredns_plugin/coredns_plugin.go |
file, err := os.Open(filter.Path) | <mask> }
<mask>
<mask> log.Printf("filterFileNames = %+v", filterFileNames)
<mask>
<mask> for i, filterFileName := range filterFileNames {
<mask> file, err := os.Open(filterFileName)
<mask> if err != nil {
<mask> return nil, err
<mask> }
<mask> defer file.Close()
<mask>
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove log.Printf("filterFileNames = %+v", filterFileNames)
</s> add for _, filter := range p.settings.Filters {
log.Printf("Loading rules from %s", filter.Path) </s> remove config.RUnlock()
err := ioutil.WriteFile(filterpath+".tmp", data, 0644)
if err != nil {
log.Printf("Couldn't write filter file: %s", err)
</s> add filterFilePath := filter.getFilterFilePath()
log.Printf("Loading filter %d contents to: %s", filter.ID, filterFilePath)
if _, err := os.Stat(filterFilePath); os.IsNotExist(err) {
// do nothing, file doesn't exist </s> remove if doConfigRename {
err := renameOldConfigIfNeccessary()
if err != nil {
panic(err)
}
}
</s> add </s> remove return err
</s> add return nil | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | coredns_plugin/coredns_plugin.go |
//noinspection GoDeferInLoop | <mask> if err != nil {
<mask> return nil, err
<mask> }
<mask> defer file.Close()
<mask>
<mask> count := 0
<mask> scanner := bufio.NewScanner(file)
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove for i, filterFileName := range filterFileNames {
file, err := os.Open(filterFileName)
</s> add file, err := os.Open(filter.Path) </s> remove err = p.d.AddRule(text, uint32(i))
</s> add err = p.d.AddRule(text, filter.ID) </s> remove log.Printf("filterFileNames = %+v", filterFileNames)
</s> add for _, filter := range p.settings.Filters {
log.Printf("Loading rules from %s", filter.Path) </s> remove err := writeFilterFile()
if err != nil {
errortext := fmt.Sprintf("Couldn't write filter file: %s", err)
log.Println(errortext)
}
</s> add </s> remove return err
</s> add return nil | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | coredns_plugin/coredns_plugin.go |
err = p.d.AddRule(text, filter.ID) | <mask> scanner := bufio.NewScanner(file)
<mask> for scanner.Scan() {
<mask> text := scanner.Text()
<mask>
<mask> err = p.d.AddRule(text, uint32(i))
<mask> if err == dnsfilter.ErrAlreadyExists || err == dnsfilter.ErrInvalidSyntax {
<mask> continue
<mask> }
<mask> if err != nil {
<mask> log.Printf("Cannot add rule %s: %s", text, err)
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove err = d.AddRule(line, 0)
if err == dnsfilter.ErrAlreadyExists || err == dnsfilter.ErrInvalidSyntax {
continue
}
if err != nil {
log.Printf("Cannot add rule %s from %s: %s", line, filter.URL, err)
// Just ignore invalid rules
continue
}
</s> add </s> remove config.RUnlock()
err := ioutil.WriteFile(filterpath+".tmp", data, 0644)
if err != nil {
log.Printf("Couldn't write filter file: %s", err)
</s> add filterFilePath := filter.getFilterFilePath()
log.Printf("Loading filter %d contents to: %s", filter.ID, filterFilePath)
if _, err := os.Stat(filterFilePath); os.IsNotExist(err) {
// do nothing, file doesn't exist </s> remove updated, err := filter.update(now)
</s> add updated, err := filter.update(false) </s> remove err = os.Rename(oldConfigFile, newConfigFile)
if err != nil {
log.Printf("Failed to rename %s to %s: %s", oldConfigFile, newConfigFile, err)
return err
</s> add // Perform upgrade operations for each consecutive version upgrade
for oldVersion, newVersion := config.SchemaVersion, config.SchemaVersion+1; newVersion <= SchemaVersion; {
err := upgradeConfigSchema(oldVersion, newVersion)
if err != nil {
log.Fatal(err)
}
// Increment old and new versions
oldVersion++
newVersion++
}
// Save the current schema version
config.SchemaVersion = SchemaVersion
return nil
}
// Upgrade from oldVersion to newVersion
func upgradeConfigSchema(oldVersion int, newVersion int) error {
if oldVersion == 0 && newVersion == 1 {
log.Printf("Updating schema from %d to %d", oldVersion, newVersion)
// The first schema upgrade:
// Added "ID" field to "filter" -- we need to populate this field now
// Added "config.ourDataDir" -- where we will now store filters contents
for i := range config.Filters {
filter := &config.Filters[i] // otherwise we will be operating on a copy
log.Printf("Seting ID=%d for filter %s", i, filter.URL)
filter.ID = i + 1 // start with ID=1
// Forcibly update the filter
_, err := filter.update(true)
if err != nil {
log.Fatal(err)
}
}
// No more "dnsfilter.txt", filters are now loaded from config.ourDataDir/filters/
dnsFilterPath := filepath.Join(config.ourBinaryDir, "dnsfilter.txt")
_, err := os.Stat(dnsFilterPath)
if !os.IsNotExist(err) {
log.Printf("Deleting %s as we don't need it anymore", dnsFilterPath)
err = os.Remove(dnsFilterPath)
if err != nil {
log.Printf("Cannot remove %s due to %s", dnsFilterPath, err)
}
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | coredns_plugin/coredns_plugin.go |
log.Printf("Added %d rules from %d", count, filter.ID) | <mask> continue
<mask> }
<mask> count++
<mask> }
<mask> log.Printf("Added %d rules from %s", count, filterFileName)
<mask>
<mask> if err = scanner.Err(); err != nil {
<mask> return nil, err
<mask> }
<mask> }
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove err = d.AddRule(line, 0)
if err == dnsfilter.ErrAlreadyExists || err == dnsfilter.ErrInvalidSyntax {
continue
}
if err != nil {
log.Printf("Cannot add rule %s from %s: %s", line, filter.URL, err)
// Just ignore invalid rules
continue
}
</s> add </s> remove log.Printf("filterFileNames = %+v", filterFileNames)
</s> add for _, filter := range p.settings.Filters {
log.Printf("Loading rules from %s", filter.Path) </s> remove for i, filterFileName := range filterFileNames {
file, err := os.Open(filterFileName)
</s> add file, err := os.Open(filter.Path) </s> remove err = writeFilterFile()
if err != nil {
errortext := fmt.Sprintf("Couldn't write filter file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
</s> add </s> remove log.Printf("Couldn't write DNS config: %s", err)
}
err = os.Rename(corefile+".tmp", corefile)
if err != nil {
log.Printf("Couldn't rename DNS config: %s", err)
</s> add log.Printf("Couldn't save DNS config: %s", err)
return err | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | coredns_plugin/coredns_plugin.go |
//noinspection GoUnusedParameter | <mask> }
<mask>
<mask> type statsFunc func(ch interface{}, name string, text string, value float64, valueType prometheus.ValueType)
<mask>
<mask> func doDesc(ch interface{}, name string, text string, value float64, valueType prometheus.ValueType) {
<mask> realch, ok := ch.(chan<- *prometheus.Desc)
<mask> if !ok {
<mask> log.Printf("Couldn't convert ch to chan<- *prometheus.Desc\n")
<mask> return
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove func clamp(value, low, high int) int {
if value < low {
return low
</s> add // ----------------------------------
// helper functions for working with files
// ----------------------------------
// Writes data first to a temporary file and then renames it to what's specified in path
func writeFileSafe(path string, data []byte) error {
dir := filepath.Dir(path)
err := os.MkdirAll(dir, 0755)
if err != nil {
return err
}
tmpPath := path + ".tmp"
err = ioutil.WriteFile(tmpPath, data, 0644)
if err != nil {
return err </s> remove func _Func() string {
pc := make([]uintptr, 10) // at least 1 entry needed
runtime.Callers(2, pc)
f := runtime.FuncForPC(pc[0])
return path.Base(f.Name())
}
</s> add </s> remove if value > high {
return high
</s> add err = os.Rename(tmpPath, path)
if err != nil {
return err </s> remove // extract filter name and count number of rules
</s> add // Extract filter name and count number of rules </s> remove return value
</s> add return nil | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | coredns_plugin/coredns_plugin.go |
return dns.RcodeFormatError, dnsfilter.Result{}, fmt.Errorf("got a DNS request with more than one Question") | <mask>
<mask> func (p *plug) serveDNSInternal(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, dnsfilter.Result, error) {
<mask> if len(r.Question) != 1 {
<mask> // google DNS, bind and others do the same
<mask> return dns.RcodeFormatError, dnsfilter.Result{}, fmt.Errorf("Got DNS request with != 1 questions")
<mask> }
<mask> for _, question := range r.Question {
<mask> host := strings.ToLower(strings.TrimSuffix(question.Name, "."))
<mask> // is it a safesearch domain?
<mask> p.RLock()
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove err = os.Rename(oldConfigFile, newConfigFile)
if err != nil {
log.Printf("Failed to rename %s to %s: %s", oldConfigFile, newConfigFile, err)
return err
</s> add // Perform upgrade operations for each consecutive version upgrade
for oldVersion, newVersion := config.SchemaVersion, config.SchemaVersion+1; newVersion <= SchemaVersion; {
err := upgradeConfigSchema(oldVersion, newVersion)
if err != nil {
log.Fatal(err)
}
// Increment old and new versions
oldVersion++
newVersion++
}
// Save the current schema version
config.SchemaVersion = SchemaVersion
return nil
}
// Upgrade from oldVersion to newVersion
func upgradeConfigSchema(oldVersion int, newVersion int) error {
if oldVersion == 0 && newVersion == 1 {
log.Printf("Updating schema from %d to %d", oldVersion, newVersion)
// The first schema upgrade:
// Added "ID" field to "filter" -- we need to populate this field now
// Added "config.ourDataDir" -- where we will now store filters contents
for i := range config.Filters {
filter := &config.Filters[i] // otherwise we will be operating on a copy
log.Printf("Seting ID=%d for filter %s", i, filter.URL)
filter.ID = i + 1 // start with ID=1
// Forcibly update the filter
_, err := filter.update(true)
if err != nil {
log.Fatal(err)
}
}
// No more "dnsfilter.txt", filters are now loaded from config.ourDataDir/filters/
dnsFilterPath := filepath.Join(config.ourBinaryDir, "dnsfilter.txt")
_, err := os.Stat(dnsFilterPath)
if !os.IsNotExist(err) {
log.Printf("Deleting %s as we don't need it anymore", dnsFilterPath)
err = os.Remove(dnsFilterPath)
if err != nil {
log.Printf("Cannot remove %s due to %s", dnsFilterPath, err)
}
} </s> remove func clamp(value, low, high int) int {
if value < low {
return low
</s> add // ----------------------------------
// helper functions for working with files
// ----------------------------------
// Writes data first to a temporary file and then renames it to what's specified in path
func writeFileSafe(path string, data []byte) error {
dir := filepath.Dir(path)
err := os.MkdirAll(dir, 0755)
if err != nil {
return err
}
tmpPath := path + ".tmp"
err = ioutil.WriteFile(tmpPath, data, 0644)
if err != nil {
return err </s> remove err := writeConfig()
</s> add // Do the upgrade if necessary
err := upgradeConfig()
if err != nil {
log.Fatal(err)
}
// Save the updated config
err = writeConfig() </s> remove elapsed := time.Since(filter.LastUpdated)
if elapsed <= updatePeriod {
</s> add if !force && time.Since(filter.LastUpdated) <= updatePeriod { </s> remove func (filter *filter) update(now time.Time) (bool, error) {
</s> add // Checks for filters updates
// If "force" is true -- does not check the filter's LastUpdated field
func (filter *filter) update(force bool) (bool, error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | coredns_plugin/coredns_plugin.go |
// TODO: Change tests -- there's new config template now | <mask> )
<mask>
<mask> func TestSetup(t *testing.T) {
<mask> for i, testcase := range []struct {
<mask> config string
<mask> failing bool
<mask> }{
<mask> {`dnsfilter`, false},
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove log.Printf("filterFileNames = %+v", filterFileNames)
</s> add for _, filter := range p.settings.Filters {
log.Printf("Loading rules from %s", filter.Path) </s> remove for i, filterFileName := range filterFileNames {
file, err := os.Open(filterFileName)
</s> add file, err := os.Open(filter.Path) </s> remove FilterFile string `yaml:"-"`
Port int `yaml:"port"`
ProtectionEnabled bool `yaml:"protection_enabled"`
FilteringEnabled bool `yaml:"filtering_enabled"`
SafeBrowsingEnabled bool `yaml:"safebrowsing_enabled"`
SafeSearchEnabled bool `yaml:"safesearch_enabled"`
ParentalEnabled bool `yaml:"parental_enabled"`
ParentalSensitivity int `yaml:"parental_sensitivity"`
BlockedResponseTTL int `yaml:"blocked_response_ttl"`
QueryLogEnabled bool `yaml:"querylog_enabled"`
Pprof string `yaml:"-"`
Cache string `yaml:"-"`
Prometheus string `yaml:"-"`
UpstreamDNS []string `yaml:"upstream_dns"`
</s> add Filters []coreDnsFilter `yaml:"-"`
Port int `yaml:"port"`
ProtectionEnabled bool `yaml:"protection_enabled"`
FilteringEnabled bool `yaml:"filtering_enabled"`
SafeBrowsingEnabled bool `yaml:"safebrowsing_enabled"`
SafeSearchEnabled bool `yaml:"safesearch_enabled"`
ParentalEnabled bool `yaml:"parental_enabled"`
ParentalSensitivity int `yaml:"parental_sensitivity"`
BlockedResponseTTL int `yaml:"blocked_response_ttl"`
QueryLogEnabled bool `yaml:"querylog_enabled"`
Pprof string `yaml:"-"`
Cache string `yaml:"-"`
Prometheus string `yaml:"-"`
UpstreamDNS []string `yaml:"upstream_dns"` | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | coredns_plugin/coredns_plugin_test.go |
"io/ioutil" | <mask> "bufio"
<mask> "errors"
<mask> "fmt"
<mask> "io"
<mask> "net/http"
<mask> "os"
<mask> "path"
<mask> "path/filepath"
<mask> "runtime"
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove func clamp(value, low, high int) int {
if value < low {
return low
</s> add // ----------------------------------
// helper functions for working with files
// ----------------------------------
// Writes data first to a temporary file and then renames it to what's specified in path
func writeFileSafe(path string, data []byte) error {
dir := filepath.Dir(path)
err := os.MkdirAll(dir, 0755)
if err != nil {
return err
}
tmpPath := path + ".tmp"
err = ioutil.WriteFile(tmpPath, data, 0644)
if err != nil {
return err </s> remove func _Func() string {
pc := make([]uintptr, 10) // at least 1 entry needed
runtime.Callers(2, pc)
f := runtime.FuncForPC(pc[0])
return path.Base(f.Name())
}
</s> add </s> remove {{if .ProtectionEnabled}}dnsfilter {{if .FilteringEnabled}}{{.FilterFile}}{{end}} {
</s> add {{if .ProtectionEnabled}}dnsfilter { | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | helpers.go |
"path/filepath" | <mask> "io/ioutil"
<mask> "net/http"
<mask> "os"
<mask> "path"
<mask> "runtime"
<mask> "strings"
<mask> )
<mask>
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove "github.com/AdguardTeam/AdGuardHome/dnsfilter"
</s> add </s> remove func clamp(value, low, high int) int {
if value < low {
return low
</s> add // ----------------------------------
// helper functions for working with files
// ----------------------------------
// Writes data first to a temporary file and then renames it to what's specified in path
func writeFileSafe(path string, data []byte) error {
dir := filepath.Dir(path)
err := os.MkdirAll(dir, 0755)
if err != nil {
return err
}
tmpPath := path + ".tmp"
err = ioutil.WriteFile(tmpPath, data, 0644)
if err != nil {
return err </s> remove
"gopkg.in/yaml.v2"
</s> add | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | helpers.go |
// ----------------------------------
// helper functions for working with files
// ----------------------------------
// Writes data first to a temporary file and then renames it to what's specified in path
func writeFileSafe(path string, data []byte) error {
dir := filepath.Dir(path)
err := os.MkdirAll(dir, 0755)
if err != nil {
return err
}
tmpPath := path + ".tmp"
err = ioutil.WriteFile(tmpPath, data, 0644)
if err != nil {
return err | <mask> "runtime"
<mask> "strings"
<mask> )
<mask>
<mask> func clamp(value, low, high int) int {
<mask> if value < low {
<mask> return low
<mask> }
<mask> if value > high {
<mask> return high
<mask> }
<mask> return value
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove if value > high {
return high
</s> add err = os.Rename(tmpPath, path)
if err != nil {
return err </s> remove return value
</s> add return nil </s> remove err := writeFilterFile()
if err != nil {
errortext := fmt.Sprintf("Couldn't write filter file: %s", err)
log.Println(errortext)
}
</s> add </s> remove switch c.Val() {
</s> add blockValue := c.Val()
switch blockValue { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | helpers.go |
err = os.Rename(tmpPath, path)
if err != nil {
return err | <mask> func clamp(value, low, high int) int {
<mask> if value < low {
<mask> return low
<mask> }
<mask> if value > high {
<mask> return high
<mask> }
<mask> return value
<mask> }
<mask>
<mask> // ----------------------------------
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove func clamp(value, low, high int) int {
if value < low {
return low
</s> add // ----------------------------------
// helper functions for working with files
// ----------------------------------
// Writes data first to a temporary file and then renames it to what's specified in path
func writeFileSafe(path string, data []byte) error {
dir := filepath.Dir(path)
err := os.MkdirAll(dir, 0755)
if err != nil {
return err
}
tmpPath := path + ".tmp"
err = ioutil.WriteFile(tmpPath, data, 0644)
if err != nil {
return err </s> remove return value
</s> add return nil </s> remove err := writeFilterFile()
if err != nil {
errortext := fmt.Sprintf("Couldn't write filter file: %s", err)
log.Println(errortext)
}
</s> add </s> remove func (filter *filter) update(now time.Time) (bool, error) {
</s> add // Checks for filters updates
// If "force" is true -- does not check the filter's LastUpdated field
func (filter *filter) update(force bool) (bool, error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | helpers.go |
return nil | <mask> }
<mask> if value > high {
<mask> return high
<mask> }
<mask> return value
<mask> }
<mask>
<mask> // ----------------------------------
<mask> // helper functions for HTTP handlers
<mask> // ----------------------------------
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove if value > high {
return high
</s> add err = os.Rename(tmpPath, path)
if err != nil {
return err </s> remove func clamp(value, low, high int) int {
if value < low {
return low
</s> add // ----------------------------------
// helper functions for working with files
// ----------------------------------
// Writes data first to a temporary file and then renames it to what's specified in path
func writeFileSafe(path string, data []byte) error {
dir := filepath.Dir(path)
err := os.MkdirAll(dir, 0755)
if err != nil {
return err
}
tmpPath := path + ".tmp"
err = ioutil.WriteFile(tmpPath, data, 0644)
if err != nil {
return err </s> remove func (filter *filter) update(now time.Time) (bool, error) {
</s> add // Checks for filters updates
// If "force" is true -- does not check the filter's LastUpdated field
func (filter *filter) update(force bool) (bool, error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | helpers.go |
<mask>
<mask> // ---------------------
<mask> // debug logging helpers
<mask> // ---------------------
<mask> func _Func() string {
<mask> pc := make([]uintptr, 10) // at least 1 entry needed
<mask> runtime.Callers(2, pc)
<mask> f := runtime.FuncForPC(pc[0])
<mask> return path.Base(f.Name())
<mask> }
<mask>
<mask> func trace(format string, args ...interface{}) {
<mask> pc := make([]uintptr, 10) // at least 1 entry needed
<mask> runtime.Callers(2, pc)
<mask> f := runtime.FuncForPC(pc[0])
<mask> var buf strings.Builder
</s> Fix #371 #421
Filters are now saved to a file
Also, they're loaded from the file on startup
Filter ID is not passed to the CoreDNS plugin config (server-side AG DNS must be changed accordingly)
Some minor refactoring, unused functions removed </s> remove func renameOldConfigIfNeccessary() error {
oldConfigFile := filepath.Join(config.ourBinaryDir, "AdguardDNS.yaml")
_, err := os.Stat(oldConfigFile)
if os.IsNotExist(err) {
// do nothing, file doesn't exist
trace("File %s doesn't exist, nothing to do", oldConfigFile)
</s> add // Performs necessary upgrade operations if needed
func upgradeConfig() error {
if config.SchemaVersion == SchemaVersion {
// No upgrade, do nothing </s> remove // eat all args so that coredns can start happily
</s> add // Eat all args so that coredns can start happily </s> remove return dns.RcodeFormatError, dnsfilter.Result{}, fmt.Errorf("Got DNS request with != 1 questions")
</s> add return dns.RcodeFormatError, dnsfilter.Result{}, fmt.Errorf("got a DNS request with more than one Question") </s> remove err := writeConfig()
</s> add // Do the upgrade if necessary
err := upgradeConfig()
if err != nil {
log.Fatal(err)
}
// Save the updated config
err = writeConfig() | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/32d4e80c93cba5b3ef4bb96c79f7256b5cb4d913 | helpers.go |
|
clientID, err = clientIDFromDNSContextHTTPS(pctx)
if err != nil {
return "", fmt.Errorf("checking url: %w", err)
} else if clientID != "" {
return clientID, nil
}
// Go on and check the domain name as well. | <mask> // is not one of these, clientID is an empty string and err is nil.
<mask> func (s *Server) clientIDFromDNSContext(pctx *proxy.DNSContext) (clientID string, err error) {
<mask> proto := pctx.Proto
<mask> if proto == proxy.ProtoHTTPS {
<mask> return clientIDFromDNSContextHTTPS(pctx)
<mask> } else if proto != proxy.ProtoTLS && proto != proxy.ProtoQUIC {
<mask> return "", nil
<mask> }
<mask>
<mask> hostSrvName := s.conf.ServerName
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove cliSrvName := ""
</s> add cliSrvName, err := clientServerName(pctx, proto)
if err != nil {
return "", err
}
clientID, err = clientIDFromClientServerName(
hostSrvName,
cliSrvName,
s.conf.StrictSNICheck,
)
if err != nil {
return "", fmt.Errorf("clientid check: %w", err)
}
return clientID, nil
}
// clientServerName returns the TLS server name based on the protocol.
func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string, err error) { </s> remove case proxy.ProtoTLS:
conn := pctx.Conn
tc, ok := conn.(tlsConn)
if !ok {
return "", fmt.Errorf(
"proxy ctx conn of proto %s is %T, want *tls.Conn",
proto,
conn,
)
</s> add case proxy.ProtoHTTPS:
if connState := pctx.HTTPRequest.TLS; connState != nil {
srvName = pctx.HTTPRequest.TLS.ServerName </s> remove return clientID, nil
</s> add return srvName, nil </s> remove pctx.QUICConnection,
</s> add qConn, </s> remove cliSrvName = conn.ConnectionState().TLS.ServerName
}
</s> add srvName = conn.ConnectionState().TLS.ServerName
case proxy.ProtoTLS:
conn := pctx.Conn
tc, ok := conn.(tlsConn)
if !ok {
return "", fmt.Errorf("proxy ctx conn of proto %s is %T, want *tls.Conn", proto, conn)
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid.go |
cliSrvName, err := clientServerName(pctx, proto)
if err != nil {
return "", err
}
clientID, err = clientIDFromClientServerName(
hostSrvName,
cliSrvName,
s.conf.StrictSNICheck,
)
if err != nil {
return "", fmt.Errorf("clientid check: %w", err)
}
return clientID, nil
}
// clientServerName returns the TLS server name based on the protocol.
func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string, err error) { | <mask> if hostSrvName == "" {
<mask> return "", nil
<mask> }
<mask>
<mask> cliSrvName := ""
<mask> switch proto {
<mask> case proxy.ProtoTLS:
<mask> conn := pctx.Conn
<mask> tc, ok := conn.(tlsConn)
<mask> if !ok {
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove case proxy.ProtoTLS:
conn := pctx.Conn
tc, ok := conn.(tlsConn)
if !ok {
return "", fmt.Errorf(
"proxy ctx conn of proto %s is %T, want *tls.Conn",
proto,
conn,
)
</s> add case proxy.ProtoHTTPS:
if connState := pctx.HTTPRequest.TLS; connState != nil {
srvName = pctx.HTTPRequest.TLS.ServerName </s> remove cliSrvName = conn.ConnectionState().TLS.ServerName
}
</s> add srvName = conn.ConnectionState().TLS.ServerName
case proxy.ProtoTLS:
conn := pctx.Conn
tc, ok := conn.(tlsConn)
if !ok {
return "", fmt.Errorf("proxy ctx conn of proto %s is %T, want *tls.Conn", proto, conn)
} </s> remove return clientIDFromDNSContextHTTPS(pctx)
</s> add clientID, err = clientIDFromDNSContextHTTPS(pctx)
if err != nil {
return "", fmt.Errorf("checking url: %w", err)
} else if clientID != "" {
return clientID, nil
}
// Go on and check the domain name as well. </s> remove conn, ok := pctx.QUICConnection.(quicConnection)
</s> add qConn := pctx.QUICConnection
conn, ok := qConn.(quicConnection) </s> remove
cliSrvName = tc.ConnectionState().ServerName
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid.go |
case proxy.ProtoHTTPS:
if connState := pctx.HTTPRequest.TLS; connState != nil {
srvName = pctx.HTTPRequest.TLS.ServerName | <mask> }
<mask>
<mask> cliSrvName := ""
<mask> switch proto {
<mask> case proxy.ProtoTLS:
<mask> conn := pctx.Conn
<mask> tc, ok := conn.(tlsConn)
<mask> if !ok {
<mask> return "", fmt.Errorf(
<mask> "proxy ctx conn of proto %s is %T, want *tls.Conn",
<mask> proto,
<mask> conn,
<mask> )
<mask> }
<mask>
<mask> cliSrvName = tc.ConnectionState().ServerName
<mask> case proxy.ProtoQUIC:
<mask> conn, ok := pctx.QUICConnection.(quicConnection)
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove
cliSrvName = tc.ConnectionState().ServerName
</s> add </s> remove conn, ok := pctx.QUICConnection.(quicConnection)
</s> add qConn := pctx.QUICConnection
conn, ok := qConn.(quicConnection) </s> remove cliSrvName = conn.ConnectionState().TLS.ServerName
}
</s> add srvName = conn.ConnectionState().TLS.ServerName
case proxy.ProtoTLS:
conn := pctx.Conn
tc, ok := conn.(tlsConn)
if !ok {
return "", fmt.Errorf("proxy ctx conn of proto %s is %T, want *tls.Conn", proto, conn)
} </s> remove pctx.QUICConnection,
</s> add qConn, </s> remove cliSrvName := ""
</s> add cliSrvName, err := clientServerName(pctx, proto)
if err != nil {
return "", err
}
clientID, err = clientIDFromClientServerName(
hostSrvName,
cliSrvName,
s.conf.StrictSNICheck,
)
if err != nil {
return "", fmt.Errorf("clientid check: %w", err)
}
return clientID, nil
}
// clientServerName returns the TLS server name based on the protocol.
func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string, err error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid.go |
<mask> proto,
<mask> conn,
<mask> )
<mask> }
<mask>
<mask> cliSrvName = tc.ConnectionState().ServerName
<mask> case proxy.ProtoQUIC:
<mask> conn, ok := pctx.QUICConnection.(quicConnection)
<mask> if !ok {
<mask> return "", fmt.Errorf(
<mask> "proxy ctx quic conn of proto %s is %T, want quic.Connection",
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove conn, ok := pctx.QUICConnection.(quicConnection)
</s> add qConn := pctx.QUICConnection
conn, ok := qConn.(quicConnection) </s> remove pctx.QUICConnection,
</s> add qConn, </s> remove case proxy.ProtoTLS:
conn := pctx.Conn
tc, ok := conn.(tlsConn)
if !ok {
return "", fmt.Errorf(
"proxy ctx conn of proto %s is %T, want *tls.Conn",
proto,
conn,
)
</s> add case proxy.ProtoHTTPS:
if connState := pctx.HTTPRequest.TLS; connState != nil {
srvName = pctx.HTTPRequest.TLS.ServerName </s> remove cliSrvName = conn.ConnectionState().TLS.ServerName
}
</s> add srvName = conn.ConnectionState().TLS.ServerName
case proxy.ProtoTLS:
conn := pctx.Conn
tc, ok := conn.(tlsConn)
if !ok {
return "", fmt.Errorf("proxy ctx conn of proto %s is %T, want *tls.Conn", proto, conn)
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid.go |
|
qConn := pctx.QUICConnection
conn, ok := qConn.(quicConnection) | <mask> }
<mask>
<mask> cliSrvName = tc.ConnectionState().ServerName
<mask> case proxy.ProtoQUIC:
<mask> conn, ok := pctx.QUICConnection.(quicConnection)
<mask> if !ok {
<mask> return "", fmt.Errorf(
<mask> "proxy ctx quic conn of proto %s is %T, want quic.Connection",
<mask> proto,
<mask> pctx.QUICConnection,
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove
cliSrvName = tc.ConnectionState().ServerName
</s> add </s> remove pctx.QUICConnection,
</s> add qConn, </s> remove case proxy.ProtoTLS:
conn := pctx.Conn
tc, ok := conn.(tlsConn)
if !ok {
return "", fmt.Errorf(
"proxy ctx conn of proto %s is %T, want *tls.Conn",
proto,
conn,
)
</s> add case proxy.ProtoHTTPS:
if connState := pctx.HTTPRequest.TLS; connState != nil {
srvName = pctx.HTTPRequest.TLS.ServerName </s> remove cliSrvName = conn.ConnectionState().TLS.ServerName
}
</s> add srvName = conn.ConnectionState().TLS.ServerName
case proxy.ProtoTLS:
conn := pctx.Conn
tc, ok := conn.(tlsConn)
if !ok {
return "", fmt.Errorf("proxy ctx conn of proto %s is %T, want *tls.Conn", proto, conn)
} </s> remove cliSrvName := ""
</s> add cliSrvName, err := clientServerName(pctx, proto)
if err != nil {
return "", err
}
clientID, err = clientIDFromClientServerName(
hostSrvName,
cliSrvName,
s.conf.StrictSNICheck,
)
if err != nil {
return "", fmt.Errorf("clientid check: %w", err)
}
return clientID, nil
}
// clientServerName returns the TLS server name based on the protocol.
func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string, err error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid.go |
qConn, | <mask> if !ok {
<mask> return "", fmt.Errorf(
<mask> "proxy ctx quic conn of proto %s is %T, want quic.Connection",
<mask> proto,
<mask> pctx.QUICConnection,
<mask> )
<mask> }
<mask>
<mask> cliSrvName = conn.ConnectionState().TLS.ServerName
<mask> }
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove
cliSrvName = tc.ConnectionState().ServerName
</s> add </s> remove conn, ok := pctx.QUICConnection.(quicConnection)
</s> add qConn := pctx.QUICConnection
conn, ok := qConn.(quicConnection) </s> remove cliSrvName = conn.ConnectionState().TLS.ServerName
}
</s> add srvName = conn.ConnectionState().TLS.ServerName
case proxy.ProtoTLS:
conn := pctx.Conn
tc, ok := conn.(tlsConn)
if !ok {
return "", fmt.Errorf("proxy ctx conn of proto %s is %T, want *tls.Conn", proto, conn)
} </s> remove case proxy.ProtoTLS:
conn := pctx.Conn
tc, ok := conn.(tlsConn)
if !ok {
return "", fmt.Errorf(
"proxy ctx conn of proto %s is %T, want *tls.Conn",
proto,
conn,
)
</s> add case proxy.ProtoHTTPS:
if connState := pctx.HTTPRequest.TLS; connState != nil {
srvName = pctx.HTTPRequest.TLS.ServerName </s> remove clientID, err = clientIDFromClientServerName(
hostSrvName,
cliSrvName,
s.conf.StrictSNICheck,
)
if err != nil {
return "", fmt.Errorf("clientid check: %w", err)
</s> add srvName = tc.ConnectionState().ServerName | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid.go |
srvName = conn.ConnectionState().TLS.ServerName
case proxy.ProtoTLS:
conn := pctx.Conn
tc, ok := conn.(tlsConn)
if !ok {
return "", fmt.Errorf("proxy ctx conn of proto %s is %T, want *tls.Conn", proto, conn)
} | <mask> pctx.QUICConnection,
<mask> )
<mask> }
<mask>
<mask> cliSrvName = conn.ConnectionState().TLS.ServerName
<mask> }
<mask>
<mask> clientID, err = clientIDFromClientServerName(
<mask> hostSrvName,
<mask> cliSrvName,
<mask> s.conf.StrictSNICheck,
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove clientID, err = clientIDFromClientServerName(
hostSrvName,
cliSrvName,
s.conf.StrictSNICheck,
)
if err != nil {
return "", fmt.Errorf("clientid check: %w", err)
</s> add srvName = tc.ConnectionState().ServerName </s> remove cliSrvName := ""
</s> add cliSrvName, err := clientServerName(pctx, proto)
if err != nil {
return "", err
}
clientID, err = clientIDFromClientServerName(
hostSrvName,
cliSrvName,
s.conf.StrictSNICheck,
)
if err != nil {
return "", fmt.Errorf("clientid check: %w", err)
}
return clientID, nil
}
// clientServerName returns the TLS server name based on the protocol.
func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string, err error) { </s> remove pctx.QUICConnection,
</s> add qConn, </s> remove return clientID, nil
</s> add return srvName, nil </s> remove return clientIDFromDNSContextHTTPS(pctx)
</s> add clientID, err = clientIDFromDNSContextHTTPS(pctx)
if err != nil {
return "", fmt.Errorf("checking url: %w", err)
} else if clientID != "" {
return clientID, nil
}
// Go on and check the domain name as well. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid.go |
srvName = tc.ConnectionState().ServerName | <mask>
<mask> cliSrvName = conn.ConnectionState().TLS.ServerName
<mask> }
<mask>
<mask> clientID, err = clientIDFromClientServerName(
<mask> hostSrvName,
<mask> cliSrvName,
<mask> s.conf.StrictSNICheck,
<mask> )
<mask> if err != nil {
<mask> return "", fmt.Errorf("clientid check: %w", err)
<mask> }
<mask>
<mask> return clientID, nil
<mask> }
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove return clientID, nil
</s> add return srvName, nil </s> remove cliSrvName := ""
</s> add cliSrvName, err := clientServerName(pctx, proto)
if err != nil {
return "", err
}
clientID, err = clientIDFromClientServerName(
hostSrvName,
cliSrvName,
s.conf.StrictSNICheck,
)
if err != nil {
return "", fmt.Errorf("clientid check: %w", err)
}
return clientID, nil
}
// clientServerName returns the TLS server name based on the protocol.
func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string, err error) { </s> remove cliSrvName = conn.ConnectionState().TLS.ServerName
}
</s> add srvName = conn.ConnectionState().TLS.ServerName
case proxy.ProtoTLS:
conn := pctx.Conn
tc, ok := conn.(tlsConn)
if !ok {
return "", fmt.Errorf("proxy ctx conn of proto %s is %T, want *tls.Conn", proto, conn)
} </s> remove return clientIDFromDNSContextHTTPS(pctx)
</s> add clientID, err = clientIDFromDNSContextHTTPS(pctx)
if err != nil {
return "", fmt.Errorf("checking url: %w", err)
} else if clientID != "" {
return clientID, nil
}
// Go on and check the domain name as well. </s> remove pctx.QUICConnection,
</s> add qConn, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid.go |
return srvName, nil | <mask> if err != nil {
<mask> return "", fmt.Errorf("clientid check: %w", err)
<mask> }
<mask>
<mask> return clientID, nil
<mask> }
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove clientID, err = clientIDFromClientServerName(
hostSrvName,
cliSrvName,
s.conf.StrictSNICheck,
)
if err != nil {
return "", fmt.Errorf("clientid check: %w", err)
</s> add srvName = tc.ConnectionState().ServerName </s> remove cliSrvName := ""
</s> add cliSrvName, err := clientServerName(pctx, proto)
if err != nil {
return "", err
}
clientID, err = clientIDFromClientServerName(
hostSrvName,
cliSrvName,
s.conf.StrictSNICheck,
)
if err != nil {
return "", fmt.Errorf("clientid check: %w", err)
}
return clientID, nil
}
// clientServerName returns the TLS server name based on the protocol.
func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string, err error) { </s> remove return clientIDFromDNSContextHTTPS(pctx)
</s> add clientID, err = clientIDFromDNSContextHTTPS(pctx)
if err != nil {
return "", fmt.Errorf("checking url: %w", err)
} else if clientID != "" {
return clientID, nil
}
// Go on and check the domain name as well. </s> remove case proxy.ProtoTLS:
conn := pctx.Conn
tc, ok := conn.(tlsConn)
if !ok {
return "", fmt.Errorf(
"proxy ctx conn of proto %s is %T, want *tls.Conn",
proto,
conn,
)
</s> add case proxy.ProtoHTTPS:
if connState := pctx.HTTPRequest.TLS; connState != nil {
srvName = pctx.HTTPRequest.TLS.ServerName </s> remove cliSrvName = conn.ConnectionState().TLS.ServerName
}
</s> add srvName = conn.ConnectionState().TLS.ServerName
case proxy.ProtoTLS:
conn := pctx.Conn
tc, ok := conn.(tlsConn)
if !ok {
return "", fmt.Errorf("proxy ctx conn of proto %s is %T, want *tls.Conn", proto, conn)
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid.go |
var (
conn net.Conn
qconn quic.Connection
httpReq *http.Request
)
switch tc.proto {
case proxy.ProtoHTTPS:
u := &url.URL{
Path: "/dns-query",
}
connState := &tls.ConnectionState{
ServerName: tc.cliSrvName, | <mask> srv := &Server{
<mask> conf: ServerConfig{TLSConfig: tlsConf},
<mask> }
<mask>
<mask> var conn net.Conn
<mask> if tc.proto == proxy.ProtoTLS {
<mask> conn = testTLSConn{
<mask> serverName: tc.cliSrvName,
<mask> }
<mask> }
<mask>
<mask> var qconn quic.Connection
<mask> if tc.proto == proxy.ProtoQUIC {
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove }
</s> add </s> remove var qconn quic.Connection
if tc.proto == proxy.ProtoQUIC {
</s> add httpReq = &http.Request{
URL: u,
TLS: connState,
}
case proxy.ProtoQUIC: </s> remove return clientIDFromDNSContextHTTPS(pctx)
</s> add clientID, err = clientIDFromDNSContextHTTPS(pctx)
if err != nil {
return "", fmt.Errorf("checking url: %w", err)
} else if clientID != "" {
return clientID, nil
}
// Go on and check the domain name as well. </s> remove cliSrvName := ""
</s> add cliSrvName, err := clientServerName(pctx, proto)
if err != nil {
return "", err
}
clientID, err = clientIDFromClientServerName(
hostSrvName,
cliSrvName,
s.conf.StrictSNICheck,
)
if err != nil {
return "", fmt.Errorf("clientid check: %w", err)
}
return clientID, nil
}
// clientServerName returns the TLS server name based on the protocol.
func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string, err error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid_test.go |
<mask> if tc.proto == proxy.ProtoTLS {
<mask> conn = testTLSConn{
<mask> serverName: tc.cliSrvName,
<mask> }
<mask> }
<mask>
<mask> var qconn quic.Connection
<mask> if tc.proto == proxy.ProtoQUIC {
<mask> qconn = testQUICConnection{
<mask> serverName: tc.cliSrvName,
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove var qconn quic.Connection
if tc.proto == proxy.ProtoQUIC {
</s> add httpReq = &http.Request{
URL: u,
TLS: connState,
}
case proxy.ProtoQUIC: </s> remove var conn net.Conn
if tc.proto == proxy.ProtoTLS {
conn = testTLSConn{
serverName: tc.cliSrvName,
</s> add var (
conn net.Conn
qconn quic.Connection
httpReq *http.Request
)
switch tc.proto {
case proxy.ProtoHTTPS:
u := &url.URL{
Path: "/dns-query",
}
connState := &tls.ConnectionState{
ServerName: tc.cliSrvName, </s> remove return clientIDFromDNSContextHTTPS(pctx)
</s> add clientID, err = clientIDFromDNSContextHTTPS(pctx)
if err != nil {
return "", fmt.Errorf("checking url: %w", err)
} else if clientID != "" {
return clientID, nil
}
// Go on and check the domain name as well. </s> remove cliSrvName := ""
</s> add cliSrvName, err := clientServerName(pctx, proto)
if err != nil {
return "", err
}
clientID, err = clientIDFromClientServerName(
hostSrvName,
cliSrvName,
s.conf.StrictSNICheck,
)
if err != nil {
return "", fmt.Errorf("clientid check: %w", err)
}
return clientID, nil
}
// clientServerName returns the TLS server name based on the protocol.
func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string, err error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid_test.go |
|
httpReq = &http.Request{
URL: u,
TLS: connState,
}
case proxy.ProtoQUIC: | <mask> serverName: tc.cliSrvName,
<mask> }
<mask> }
<mask>
<mask> var qconn quic.Connection
<mask> if tc.proto == proxy.ProtoQUIC {
<mask> qconn = testQUICConnection{
<mask> serverName: tc.cliSrvName,
<mask> }
<mask> }
<mask>
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove }
</s> add </s> remove var conn net.Conn
if tc.proto == proxy.ProtoTLS {
conn = testTLSConn{
serverName: tc.cliSrvName,
</s> add var (
conn net.Conn
qconn quic.Connection
httpReq *http.Request
)
switch tc.proto {
case proxy.ProtoHTTPS:
u := &url.URL{
Path: "/dns-query",
}
connState := &tls.ConnectionState{
ServerName: tc.cliSrvName, </s> remove return clientIDFromDNSContextHTTPS(pctx)
</s> add clientID, err = clientIDFromDNSContextHTTPS(pctx)
if err != nil {
return "", fmt.Errorf("checking url: %w", err)
} else if clientID != "" {
return clientID, nil
}
// Go on and check the domain name as well. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid_test.go |
case proxy.ProtoTLS:
conn = testTLSConn{
serverName: tc.cliSrvName,
} | <mask> case proxy.ProtoQUIC:
<mask> qconn = testQUICConnection{
<mask> serverName: tc.cliSrvName,
<mask> }
<mask> }
<mask>
<mask> pctx := &proxy.DNSContext{
<mask> Proto: tc.proto,
<mask> Conn: conn,
<mask> HTTPRequest: httpReq,
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove var qconn quic.Connection
if tc.proto == proxy.ProtoQUIC {
</s> add httpReq = &http.Request{
URL: u,
TLS: connState,
}
case proxy.ProtoQUIC: </s> remove }
</s> add </s> remove var conn net.Conn
if tc.proto == proxy.ProtoTLS {
conn = testTLSConn{
serverName: tc.cliSrvName,
</s> add var (
conn net.Conn
qconn quic.Connection
httpReq *http.Request
)
switch tc.proto {
case proxy.ProtoHTTPS:
u := &url.URL{
Path: "/dns-query",
}
connState := &tls.ConnectionState{
ServerName: tc.cliSrvName, | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid_test.go |
HTTPRequest: httpReq, | <mask> pctx := &proxy.DNSContext{
<mask> Proto: tc.proto,
<mask> Conn: conn,
<mask> QUICConnection: qconn,
<mask> }
<mask>
<mask> clientID, err := srv.clientIDFromDNSContext(pctx)
<mask> assert.Equal(t, tc.wantClientID, clientID)
<mask>
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove clientID, err = clientIDFromClientServerName(
hostSrvName,
cliSrvName,
s.conf.StrictSNICheck,
)
if err != nil {
return "", fmt.Errorf("clientid check: %w", err)
</s> add srvName = tc.ConnectionState().ServerName </s> remove cliSrvName := ""
</s> add cliSrvName, err := clientServerName(pctx, proto)
if err != nil {
return "", err
}
clientID, err = clientIDFromClientServerName(
hostSrvName,
cliSrvName,
s.conf.StrictSNICheck,
)
if err != nil {
return "", fmt.Errorf("clientid check: %w", err)
}
return clientID, nil
}
// clientServerName returns the TLS server name based on the protocol.
func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string, err error) { </s> remove return clientID, nil
</s> add return srvName, nil | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid_test.go |
cliSrvName string | <mask> name string
<mask> path string
<mask> wantClientID string
<mask> wantErrMsg string
<mask> }{{
<mask> name: "no_clientid",
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove return clientIDFromDNSContextHTTPS(pctx)
</s> add clientID, err = clientIDFromDNSContextHTTPS(pctx)
if err != nil {
return "", fmt.Errorf("checking url: %w", err)
} else if clientID != "" {
return clientID, nil
}
// Go on and check the domain name as well. | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid_test.go |
cliSrvName: "example.com", | <mask> name: "no_clientid",
<mask> path: "/dns-query",
<mask> wantClientID: "",
<mask> wantErrMsg: "",
<mask> }, {
<mask> name: "no_clientid_slash",
<mask> path: "/dns-query/",
<mask> cliSrvName: "example.com",
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid_test.go |
cliSrvName: "example.com", | <mask> wantErrMsg: "",
<mask> }, {
<mask> name: "no_clientid_slash",
<mask> path: "/dns-query/",
<mask> wantClientID: "",
<mask> wantErrMsg: "",
<mask> }, {
<mask> name: "clientid",
<mask> path: "/dns-query/cli",
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid_test.go |
cliSrvName: "example.com", | <mask> name: "clientid",
<mask> path: "/dns-query/cli",
<mask> wantClientID: "cli",
<mask> wantErrMsg: "",
<mask> }, {
<mask> name: "clientid_slash",
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid_test.go |
cliSrvName: "example.com", | <mask> wantErrMsg: "",
<mask> }, {
<mask> name: "clientid_slash",
<mask> path: "/dns-query/cli/",
<mask> wantClientID: "cli",
<mask> wantErrMsg: "",
<mask> }, {
<mask> name: "clientid_case",
<mask> path: "/dns-query/InSeNsItIvE",
<mask> cliSrvName: "example.com",
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid_test.go |
cliSrvName: "example.com", | <mask> name: "clientid_case",
<mask> path: "/dns-query/InSeNsItIvE",
<mask> wantClientID: "insensitive",
<mask> wantErrMsg: ``,
<mask> }, {
<mask> name: "bad_url",
<mask> path: "/foo",
<mask> cliSrvName: "example.com",
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid_test.go |
cliSrvName: "example.com", | <mask> wantErrMsg: ``,
<mask> }, {
<mask> name: "bad_url",
<mask> path: "/foo",
<mask> wantClientID: "",
<mask> wantErrMsg: `clientid check: invalid path "/foo"`,
<mask> }, {
<mask> name: "extra",
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid_test.go |
cliSrvName: "example.com", | <mask> name: "extra",
<mask> path: "/dns-query/cli/foo",
<mask> wantClientID: "",
<mask> wantErrMsg: `clientid check: invalid path "/dns-query/cli/foo": extra parts`,
<mask> }, {
<mask> name: "invalid_clientid",
<mask> path: "/dns-query/!!!",
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid_test.go |
cliSrvName: "example.com", | <mask> name: "invalid_clientid",
<mask> path: "/dns-query/!!!",
<mask> wantClientID: "",
<mask> wantErrMsg: `clientid check: invalid clientid "!!!": bad domain name label rune '!'`,
<mask> }, {
<mask> name: "both_ids",
<mask> path: "/dns-query/right",
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid_test.go |
}, {
name: "both_ids",
path: "/dns-query/right",
cliSrvName: "wrong.example.com",
wantClientID: "right",
wantErrMsg: "", | <mask> cliSrvName: "example.com",
<mask> wantClientID: "",
<mask> wantErrMsg: `clientid check: invalid clientid "!!!": bad domain name label rune '!'`,
<mask> }}
<mask>
<mask> for _, tc := range testCases {
<mask> t.Run(tc.name, func(t *testing.T) {
<mask> connState := &tls.ConnectionState{
<mask> ServerName: tc.cliSrvName,
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove var conn net.Conn
if tc.proto == proxy.ProtoTLS {
conn = testTLSConn{
serverName: tc.cliSrvName,
</s> add var (
conn net.Conn
qconn quic.Connection
httpReq *http.Request
)
switch tc.proto {
case proxy.ProtoHTTPS:
u := &url.URL{
Path: "/dns-query",
}
connState := &tls.ConnectionState{
ServerName: tc.cliSrvName, | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid_test.go |
connState := &tls.ConnectionState{
ServerName: tc.cliSrvName,
}
| <mask> }}
<mask>
<mask> for _, tc := range testCases {
<mask> t.Run(tc.name, func(t *testing.T) {
<mask> r := &http.Request{
<mask> URL: &url.URL{
<mask> Path: tc.path,
<mask> },
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove var qconn quic.Connection
if tc.proto == proxy.ProtoQUIC {
</s> add httpReq = &http.Request{
URL: u,
TLS: connState,
}
case proxy.ProtoQUIC: </s> remove var conn net.Conn
if tc.proto == proxy.ProtoTLS {
conn = testTLSConn{
serverName: tc.cliSrvName,
</s> add var (
conn net.Conn
qconn quic.Connection
httpReq *http.Request
)
switch tc.proto {
case proxy.ProtoHTTPS:
u := &url.URL{
Path: "/dns-query",
}
connState := &tls.ConnectionState{
ServerName: tc.cliSrvName, | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid_test.go |
TLS: connState, | <mask> URL: &url.URL{
<mask> Path: tc.path,
<mask> },
<mask> }
<mask>
<mask> pctx := &proxy.DNSContext{
<mask> Proto: proxy.ProtoHTTPS,
<mask> HTTPRequest: r,
</s> Pull request: 3418-clientid-doh
Closes #3418.
Squashed commit of the following:
commit 8a1180f8ef03d30ea3ae6a3e3121ddcac513f45b
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 17:26:22 2022 +0300
all: imp docs, tests
commit 9629c69b39540db119044f2f79c1c4ed39de911f
Author: Ainar Garipov <[email protected]>
Date: Wed Oct 5 15:34:33 2022 +0300
dnsforward: accept clientids from doh client srvname </s> remove var conn net.Conn
if tc.proto == proxy.ProtoTLS {
conn = testTLSConn{
serverName: tc.cliSrvName,
</s> add var (
conn net.Conn
qconn quic.Connection
httpReq *http.Request
)
switch tc.proto {
case proxy.ProtoHTTPS:
u := &url.URL{
Path: "/dns-query",
}
connState := &tls.ConnectionState{
ServerName: tc.cliSrvName, </s> remove var qconn quic.Connection
if tc.proto == proxy.ProtoQUIC {
</s> add httpReq = &http.Request{
URL: u,
TLS: connState,
}
case proxy.ProtoQUIC: | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/330ac303242970d79b557e611bec3227b0af5a7b | internal/dnsforward/clientid_test.go |
--green79: #67b279; | <mask> :root {
<mask> --yellow-pale: rgba(247, 181, 0, 0.1);
<mask> --green79: #67B279;
<mask> --gray-a5: #a5a5a5;
<mask> --gray-d8: #d8d8d8;
<mask> --gray-f3: #F3F3F3;
<mask> --font-family-monospace: Monaco, Menlo, "Ubuntu Mono", Consolas, source-code-pro, monospace;
<mask> }
</s> Fix a couple of stylelint violations </s> remove --gray-f3: #F3F3F3;
</s> add --gray-f3: #f3f3f3; </s> remove --btn-unblock-disabled: #D8D8D8;
--btn-unblock-active: #4D4D4D;
</s> add --btn-unblock-disabled: #d8d8d8;
--btn-unblock-active: #4d4d4d; </s> remove content: ':';
</s> add content: ":"; </s> remove .dashboard-title__button{
</s> add .dashboard-title__button { </s> remove .dashboard-title__button{
</s> add .dashboard-title__button { | [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/334b3fc636025657ac6af2df0b90ec01332c8187 | client/src/components/App/index.css |
--gray-f3: #f3f3f3; | <mask> --yellow-pale: rgba(247, 181, 0, 0.1);
<mask> --green79: #67B279;
<mask> --gray-a5: #a5a5a5;
<mask> --gray-d8: #d8d8d8;
<mask> --gray-f3: #F3F3F3;
<mask> --font-family-monospace: Monaco, Menlo, "Ubuntu Mono", Consolas, source-code-pro, monospace;
<mask> }
<mask>
<mask> body {
<mask> margin: 0;
</s> Fix a couple of stylelint violations </s> remove --green79: #67B279;
</s> add --green79: #67b279; </s> remove .dashboard-title__button{
</s> add .dashboard-title__button { </s> remove .dashboard-title__button{
</s> add .dashboard-title__button { </s> remove content: '';
</s> add content: ""; </s> remove --btn-unblock-disabled: #D8D8D8;
--btn-unblock-active: #4D4D4D;
</s> add --btn-unblock-disabled: #d8d8d8;
--btn-unblock-active: #4d4d4d; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/334b3fc636025657ac6af2df0b90ec01332c8187 | client/src/components/App/index.css |
.dashboard-title__button { | <mask> display: flex;
<mask> align-items: center;
<mask> }
<mask>
<mask> .dashboard-title__button{
<mask> margin: 0 0.5rem;
<mask> }
<mask>
<mask> @media (max-width: 767.98px) {
<mask> .page-title--dashboard {
</s> Fix a couple of stylelint violations </s> remove .dashboard-title__button{
</s> add .dashboard-title__button { </s> remove --btn-unblock-disabled: #D8D8D8;
--btn-unblock-active: #4D4D4D;
</s> add --btn-unblock-disabled: #d8d8d8;
--btn-unblock-active: #4d4d4d; </s> remove content: ':';
</s> add content: ":"; </s> remove background: var(--white) url('../ui/svg/chevron-down.svg') no-repeat;
</s> add background: var(--white) url("../ui/svg/chevron-down.svg") no-repeat; </s> remove --gray-f3: #F3F3F3;
</s> add --gray-f3: #f3f3f3; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/334b3fc636025657ac6af2df0b90ec01332c8187 | client/src/components/Dashboard/Dashboard.css |
.dashboard-title__button { | <mask> flex-direction: column;
<mask> align-items: flex-start;
<mask> }
<mask>
<mask> .dashboard-title__button{
<mask> margin: 0.5rem 0;
<mask> display: block;
<mask> }
<mask> }
</s> Fix a couple of stylelint violations </s> remove .dashboard-title__button{
</s> add .dashboard-title__button { </s> remove --gray-f3: #F3F3F3;
</s> add --gray-f3: #f3f3f3; </s> remove content: ':';
</s> add content: ":"; </s> remove content: '';
</s> add content: ""; </s> remove background: var(--white) url('../ui/svg/chevron-down.svg') no-repeat;
</s> add background: var(--white) url("../ui/svg/chevron-down.svg") no-repeat; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/334b3fc636025657ac6af2df0b90ec01332c8187 | client/src/components/Dashboard/Dashboard.css |
content: ":"; | <mask> }
<mask> }
<mask>
<mask> .grid .key-colon:nth-child(odd)::after {
<mask> content: ':';
<mask> }
<mask>
<mask> .grid__one-row {
<mask> grid-template-columns: 15rem;
<mask> }
</s> Fix a couple of stylelint violations </s> remove content: '';
</s> add content: ""; </s> remove .dashboard-title__button{
</s> add .dashboard-title__button { </s> remove .dashboard-title__button{
</s> add .dashboard-title__button { </s> remove background: var(--white) url('../ui/svg/chevron-down.svg') no-repeat;
</s> add background: var(--white) url("../ui/svg/chevron-down.svg") no-repeat; </s> remove --btn-unblock-disabled: #D8D8D8;
--btn-unblock-active: #4D4D4D;
</s> add --btn-unblock-disabled: #d8d8d8;
--btn-unblock-active: #4d4d4d; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/334b3fc636025657ac6af2df0b90ec01332c8187 | client/src/components/Logs/Cells/IconTooltip.css |
content: ""; | <mask> padding-top: 2rem;
<mask> }
<mask>
<mask> .title--border:before {
<mask> content: '';
<mask> position: absolute;
<mask> left: 0;
<mask> border-top: 0.5px solid var(--gray-d8) !important;
<mask> width: 100%;
<mask> margin-top: -1rem;
</s> Fix a couple of stylelint violations </s> remove content: ':';
</s> add content: ":"; </s> remove .dashboard-title__button{
</s> add .dashboard-title__button { </s> remove --gray-f3: #F3F3F3;
</s> add --gray-f3: #f3f3f3; </s> remove .dashboard-title__button{
</s> add .dashboard-title__button { </s> remove background: var(--white) url('../ui/svg/chevron-down.svg') no-repeat;
</s> add background: var(--white) url("../ui/svg/chevron-down.svg") no-repeat; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/334b3fc636025657ac6af2df0b90ec01332c8187 | client/src/components/Logs/Cells/IconTooltip.css |
--gray-4d: #4d4d4d;
--gray-f3: #f3f3f3; | <mask> --size-domain: 180;
<mask> --size-response: 150;
<mask> --size-client: 123;
<mask> --gray-216: rgba(216, 216, 216, 0.23);
<mask> --gray-4d: #4D4D4D;
<mask> --gray-f3: #F3F3F3;
<mask> --gray-8: #888;
<mask> --gray-3: #333;
<mask> --danger: #DF3812;
<mask> --white80: rgba(255, 255, 255, 0.8);
<mask>
</s> Fix a couple of stylelint violations </s> remove --danger: #DF3812;
</s> add --danger: #df3812; </s> remove
--btn-block: #C23814;
--btn-block-disabled: #E3B3A6;
--btn-block-active: #A62200;
</s> add --btn-block: #c23814;
--btn-block-disabled: #e3b3a6;
--btn-block-active: #a62200; </s> remove --gray-f3: #F3F3F3;
</s> add --gray-f3: #f3f3f3; </s> remove --green79: #67B279;
</s> add --green79: #67b279; </s> remove --btn-unblock-disabled: #D8D8D8;
--btn-unblock-active: #4D4D4D;
</s> add --btn-unblock-disabled: #d8d8d8;
--btn-unblock-active: #4d4d4d; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/334b3fc636025657ac6af2df0b90ec01332c8187 | client/src/components/Logs/Logs.css |
--danger: #df3812; | <mask> --gray-4d: #4D4D4D;
<mask> --gray-f3: #F3F3F3;
<mask> --gray-8: #888;
<mask> --gray-3: #333;
<mask> --danger: #DF3812;
<mask> --white80: rgba(255, 255, 255, 0.8);
<mask>
<mask> --btn-block: #C23814;
<mask> --btn-block-disabled: #E3B3A6;
<mask> --btn-block-active: #A62200;
</s> Fix a couple of stylelint violations </s> remove
--btn-block: #C23814;
--btn-block-disabled: #E3B3A6;
--btn-block-active: #A62200;
</s> add --btn-block: #c23814;
--btn-block-disabled: #e3b3a6;
--btn-block-active: #a62200; </s> remove --gray-4d: #4D4D4D;
--gray-f3: #F3F3F3;
</s> add --gray-4d: #4d4d4d;
--gray-f3: #f3f3f3; </s> remove --btn-unblock-disabled: #D8D8D8;
--btn-unblock-active: #4D4D4D;
</s> add --btn-unblock-disabled: #d8d8d8;
--btn-unblock-active: #4d4d4d; </s> remove --gray-f3: #F3F3F3;
</s> add --gray-f3: #f3f3f3; </s> remove --green79: #67B279;
</s> add --green79: #67b279; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/334b3fc636025657ac6af2df0b90ec01332c8187 | client/src/components/Logs/Logs.css |
--btn-block: #c23814;
--btn-block-disabled: #e3b3a6;
--btn-block-active: #a62200; | <mask> --gray-8: #888;
<mask> --gray-3: #333;
<mask> --danger: #DF3812;
<mask> --white80: rgba(255, 255, 255, 0.8);
<mask>
<mask> --btn-block: #C23814;
<mask> --btn-block-disabled: #E3B3A6;
<mask> --btn-block-active: #A62200;
<mask>
<mask> --btn-unblock: #888888;
<mask> --btn-unblock-disabled: #D8D8D8;
<mask> --btn-unblock-active: #4D4D4D;
<mask>
<mask> --option-border-radius: 4px;
</s> Fix a couple of stylelint violations </s> remove --danger: #DF3812;
</s> add --danger: #df3812; </s> remove --btn-unblock-disabled: #D8D8D8;
--btn-unblock-active: #4D4D4D;
</s> add --btn-unblock-disabled: #d8d8d8;
--btn-unblock-active: #4d4d4d; </s> remove --gray-4d: #4D4D4D;
--gray-f3: #F3F3F3;
</s> add --gray-4d: #4d4d4d;
--gray-f3: #f3f3f3; </s> remove background: var(--white) url('../ui/svg/chevron-down.svg') no-repeat;
</s> add background: var(--white) url("../ui/svg/chevron-down.svg") no-repeat; </s> remove content: '';
</s> add content: ""; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/334b3fc636025657ac6af2df0b90ec01332c8187 | client/src/components/Logs/Logs.css |
--btn-unblock-disabled: #d8d8d8;
--btn-unblock-active: #4d4d4d; | <mask> --btn-block-disabled: #E3B3A6;
<mask> --btn-block-active: #A62200;
<mask>
<mask> --btn-unblock: #888888;
<mask> --btn-unblock-disabled: #D8D8D8;
<mask> --btn-unblock-active: #4D4D4D;
<mask>
<mask> --option-border-radius: 4px;
<mask> }
<mask>
<mask> .logs__text {
<mask> padding: 0 1px;
</s> Fix a couple of stylelint violations </s> remove
--btn-block: #C23814;
--btn-block-disabled: #E3B3A6;
--btn-block-active: #A62200;
</s> add --btn-block: #c23814;
--btn-block-disabled: #e3b3a6;
--btn-block-active: #a62200; </s> remove --danger: #DF3812;
</s> add --danger: #df3812; </s> remove .dashboard-title__button{
</s> add .dashboard-title__button { </s> remove content: ':';
</s> add content: ":"; </s> remove .dashboard-title__button{
</s> add .dashboard-title__button { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/334b3fc636025657ac6af2df0b90ec01332c8187 | client/src/components/Logs/Logs.css |
background: var(--white) url("../ui/svg/chevron-down.svg") no-repeat; | <mask> cursor: pointer;
<mask> }
<mask>
<mask> .custom-select__arrow--left {
<mask> background: var(--white) url('../ui/svg/chevron-down.svg') no-repeat;
<mask> background-position: 5px 9px;
<mask> background-size: 22px;
<mask> }
<mask>
<mask> .custom-select--logs {
</s> Fix a couple of stylelint violations </s> remove content: ':';
</s> add content: ":"; </s> remove .dashboard-title__button{
</s> add .dashboard-title__button { </s> remove .dashboard-title__button{
</s> add .dashboard-title__button { </s> remove --btn-unblock-disabled: #D8D8D8;
--btn-unblock-active: #4D4D4D;
</s> add --btn-unblock-disabled: #d8d8d8;
--btn-unblock-active: #4d4d4d; </s> remove content: '';
</s> add content: ""; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/334b3fc636025657ac6af2df0b90ec01332c8187 | client/src/components/Logs/Logs.css |
REWRITE_RULE: 'RewriteRule', | <mask> REWRITE: 'Rewrite',
<mask> REWRITE_HOSTS: 'RewriteEtcHosts',
<mask> FILTERED_SAFE_SEARCH: 'FilteredSafeSearch',
<mask> FILTERED_SAFE_BROWSING: 'FilteredSafeBrowsing',
<mask> FILTERED_PARENTAL: 'FilteredParental',
<mask> };
<mask>
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove res.Reason = ReasonRewrite
</s> add res.Reason = Rewritten </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | client/src/helpers/constants.js |
[FILTERED_STATUS.REWRITE_RULE]: {
LABEL: RESPONSE_FILTER.REWRITTEN.LABEL,
COLOR: QUERY_STATUS_COLORS.BLUE,
}, | <mask> LABEL: RESPONSE_FILTER.REWRITTEN.LABEL,
<mask> COLOR: QUERY_STATUS_COLORS.BLUE,
<mask> },
<mask> [FILTERED_STATUS.FILTERED_SAFE_BROWSING]: {
<mask> LABEL: RESPONSE_FILTER.BLOCKED_THREATS.LABEL,
<mask> COLOR: QUERY_STATUS_COLORS.YELLOW,
<mask> },
<mask> [FILTERED_STATUS.FILTERED_PARENTAL]: {
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove } else if res.Reason == dnsfilter.DNSRewriteRule {
</s> add } else if res.Reason == dnsfilter.RewrittenRule { </s> remove } else if res.Reason == dnsfilter.ReasonRewrite || res.Reason == dnsfilter.RewriteAutoHosts {
</s> add } else if res.Reason == dnsfilter.Rewritten || res.Reason == dnsfilter.RewrittenAutoHosts { </s> remove if res.Reason == DNSRewriteRule && res.CanonName == host {
</s> add if res.Reason == RewrittenRule && res.CanonName == host { </s> remove } else if res.Reason == dnsfilter.RewriteAutoHosts && len(res.ReverseHosts) != 0 {
</s> add } else if res.Reason == dnsfilter.RewrittenAutoHosts && len(res.ReverseHosts) != 0 { </s> remove result.Reason = RewriteAutoHosts
</s> add result.Reason = RewrittenAutoHosts | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | client/src/helpers/constants.js |
// Rewritten is returned when there was a rewrite by a legacy DNS
// rewrite rule.
Rewritten
// RewrittenAutoHosts is returned when there was a rewrite by autohosts
// rules (/etc/hosts and so on).
RewrittenAutoHosts
// RewrittenRule is returned when a $dnsrewrite filter rule was applied.
//
// TODO(a.garipov): Remove Rewritten and RewrittenAutoHosts by merging
// their functionality into RewrittenRule.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/2499.
RewrittenRule | <mask> FilteredSafeSearch
<mask> // FilteredBlockedService - the host is blocked by "blocked services" settings
<mask> FilteredBlockedService
<mask>
<mask> // ReasonRewrite is returned when there was a rewrite by
<mask> // a legacy DNS Rewrite rule.
<mask> ReasonRewrite
<mask>
<mask> // RewriteAutoHosts is returned when there was a rewrite by
<mask> // autohosts rules (/etc/hosts and so on).
<mask> RewriteAutoHosts
<mask>
<mask> // DNSRewriteRule is returned when a $dnsrewrite filter rule was
<mask> // applied.
<mask> DNSRewriteRule
<mask> )
<mask>
<mask> // TODO(a.garipov): Resync with actual code names or replace completely
<mask> // in HTTP API v1.
<mask> var reasonNames = []string{
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove if res.Reason == DNSRewriteRule && res.CanonName == host {
</s> add if res.Reason == RewrittenRule && res.CanonName == host { </s> remove // It is empty unless Reason is set to ReasonRewrite.
</s> add // It is empty unless Reason is set to Rewritten or RewrittenRule. </s> remove // Reason is set to RewriteAutoHosts or ReasonRewrite.
</s> add // Reason is set to RewrittenAutoHosts or Rewritten. </s> remove // empty unless Reason is set to RewriteAutoHosts.
</s> add // empty unless Reason is set to RewrittenAutoHosts. </s> remove - 'DNSRewriteRule'
</s> add - 'RewriteRule' | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/dnsfilter.go |
Rewritten: "Rewrite",
RewrittenAutoHosts: "RewriteEtcHosts",
RewrittenRule: "RewriteRule", | <mask> FilteredInvalid: "FilteredInvalid",
<mask> FilteredSafeSearch: "FilteredSafeSearch",
<mask> FilteredBlockedService: "FilteredBlockedService",
<mask>
<mask> ReasonRewrite: "Rewrite",
<mask>
<mask> RewriteAutoHosts: "RewriteEtcHosts",
<mask>
<mask> DNSRewriteRule: "DNSRewriteRule",
<mask> }
<mask>
<mask> func (r Reason) String() string {
<mask> if r < 0 || int(r) >= len(reasonNames) {
<mask> return ""
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove // for ReasonRewrite:
</s> add // for Rewritten: </s> remove } else if res.Reason == dnsfilter.ReasonRewrite || res.Reason == dnsfilter.RewriteAutoHosts {
</s> add } else if res.Reason == dnsfilter.Rewritten || res.Reason == dnsfilter.RewrittenAutoHosts { </s> remove } else if res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.DNSRewriteRule) &&
</s> add } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenRule) && </s> remove result.Reason = RewriteAutoHosts
</s> add result.Reason = RewrittenAutoHosts </s> remove } else if res.Reason == dnsfilter.DNSRewriteRule {
</s> add } else if res.Reason == dnsfilter.RewrittenRule { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/dnsfilter.go |
// empty unless Reason is set to RewrittenAutoHosts. | <mask> // is not nil.
<mask> Rules []*ResultRule `json:",omitempty"`
<mask>
<mask> // ReverseHosts is the reverse lookup rewrite result. It is
<mask> // empty unless Reason is set to RewriteAutoHosts.
<mask> ReverseHosts []string `json:",omitempty"`
<mask>
<mask> // IPList is the lookup rewrite result. It is empty unless
<mask> // Reason is set to RewriteAutoHosts or ReasonRewrite.
<mask> IPList []net.IP `json:",omitempty"`
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove // Reason is set to RewriteAutoHosts or ReasonRewrite.
</s> add // Reason is set to RewrittenAutoHosts or Rewritten. </s> remove // It is empty unless Reason is set to ReasonRewrite.
</s> add // It is empty unless Reason is set to Rewritten or RewrittenRule. </s> remove // ReasonRewrite is returned when there was a rewrite by
// a legacy DNS Rewrite rule.
ReasonRewrite
// RewriteAutoHosts is returned when there was a rewrite by
// autohosts rules (/etc/hosts and so on).
RewriteAutoHosts
// DNSRewriteRule is returned when a $dnsrewrite filter rule was
// applied.
DNSRewriteRule
</s> add // Rewritten is returned when there was a rewrite by a legacy DNS
// rewrite rule.
Rewritten
// RewrittenAutoHosts is returned when there was a rewrite by autohosts
// rules (/etc/hosts and so on).
RewrittenAutoHosts
// RewrittenRule is returned when a $dnsrewrite filter rule was applied.
//
// TODO(a.garipov): Remove Rewritten and RewrittenAutoHosts by merging
// their functionality into RewrittenRule.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/2499.
RewrittenRule </s> remove } else if res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.DNSRewriteRule) &&
</s> add } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenRule) && </s> remove if res.Reason == DNSRewriteRule && res.CanonName == host {
</s> add if res.Reason == RewrittenRule && res.CanonName == host { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/dnsfilter.go |
// Reason is set to RewrittenAutoHosts or Rewritten. | <mask> // empty unless Reason is set to RewriteAutoHosts.
<mask> ReverseHosts []string `json:",omitempty"`
<mask>
<mask> // IPList is the lookup rewrite result. It is empty unless
<mask> // Reason is set to RewriteAutoHosts or ReasonRewrite.
<mask> IPList []net.IP `json:",omitempty"`
<mask>
<mask> // CanonName is the CNAME value from the lookup rewrite result.
<mask> // It is empty unless Reason is set to ReasonRewrite.
<mask> CanonName string `json:",omitempty"`
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove // empty unless Reason is set to RewriteAutoHosts.
</s> add // empty unless Reason is set to RewrittenAutoHosts. </s> remove // It is empty unless Reason is set to ReasonRewrite.
</s> add // It is empty unless Reason is set to Rewritten or RewrittenRule. </s> remove // ReasonRewrite is returned when there was a rewrite by
// a legacy DNS Rewrite rule.
ReasonRewrite
// RewriteAutoHosts is returned when there was a rewrite by
// autohosts rules (/etc/hosts and so on).
RewriteAutoHosts
// DNSRewriteRule is returned when a $dnsrewrite filter rule was
// applied.
DNSRewriteRule
</s> add // Rewritten is returned when there was a rewrite by a legacy DNS
// rewrite rule.
Rewritten
// RewrittenAutoHosts is returned when there was a rewrite by autohosts
// rules (/etc/hosts and so on).
RewrittenAutoHosts
// RewrittenRule is returned when a $dnsrewrite filter rule was applied.
//
// TODO(a.garipov): Remove Rewritten and RewrittenAutoHosts by merging
// their functionality into RewrittenRule.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/2499.
RewrittenRule </s> remove // for ReasonRewrite:
</s> add // for Rewritten: </s> remove case dnsfilter.ReasonRewrite,
dnsfilter.DNSRewriteRule:
</s> add case dnsfilter.Rewritten,
dnsfilter.RewrittenRule: | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/dnsfilter.go |
// It is empty unless Reason is set to Rewritten or RewrittenRule. | <mask> // Reason is set to RewriteAutoHosts or ReasonRewrite.
<mask> IPList []net.IP `json:",omitempty"`
<mask>
<mask> // CanonName is the CNAME value from the lookup rewrite result.
<mask> // It is empty unless Reason is set to ReasonRewrite.
<mask> CanonName string `json:",omitempty"`
<mask>
<mask> // ServiceName is the name of the blocked service. It is empty
<mask> // unless Reason is set to FilteredBlockedService.
<mask> ServiceName string `json:",omitempty"`
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove // Reason is set to RewriteAutoHosts or ReasonRewrite.
</s> add // Reason is set to RewrittenAutoHosts or Rewritten. </s> remove // empty unless Reason is set to RewriteAutoHosts.
</s> add // empty unless Reason is set to RewrittenAutoHosts. </s> remove // for ReasonRewrite:
</s> add // for Rewritten: </s> remove // ReasonRewrite is returned when there was a rewrite by
// a legacy DNS Rewrite rule.
ReasonRewrite
// RewriteAutoHosts is returned when there was a rewrite by
// autohosts rules (/etc/hosts and so on).
RewriteAutoHosts
// DNSRewriteRule is returned when a $dnsrewrite filter rule was
// applied.
DNSRewriteRule
</s> add // Rewritten is returned when there was a rewrite by a legacy DNS
// rewrite rule.
Rewritten
// RewrittenAutoHosts is returned when there was a rewrite by autohosts
// rules (/etc/hosts and so on).
RewrittenAutoHosts
// RewrittenRule is returned when a $dnsrewrite filter rule was applied.
//
// TODO(a.garipov): Remove Rewritten and RewrittenAutoHosts by merging
// their functionality into RewrittenRule.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/2499.
RewrittenRule </s> remove } else if res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.DNSRewriteRule) &&
</s> add } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenRule) && | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/dnsfilter.go |
if result.Reason == Rewritten { | <mask> var err error
<mask>
<mask> // first - check rewrites, they have the highest priority
<mask> result = d.processRewrites(host, qtype)
<mask> if result.Reason == ReasonRewrite {
<mask> return result, nil
<mask> }
<mask>
<mask> // Now check the hosts file -- do we have any rules for it?
<mask> // just like DNS rewrites, it has higher priority than filtering rules.
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove result.Reason = RewriteAutoHosts
</s> add result.Reason = RewrittenAutoHosts </s> remove case dnsfilter.ReasonRewrite,
dnsfilter.DNSRewriteRule:
</s> add case dnsfilter.Rewritten,
dnsfilter.RewrittenRule: </s> remove } else if res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.DNSRewriteRule) &&
</s> add } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenRule) && </s> remove if res.Reason == DNSRewriteRule && res.CanonName == host {
</s> add if res.Reason == RewrittenRule && res.CanonName == host { </s> remove } else if res.Reason == dnsfilter.DNSRewriteRule {
</s> add } else if res.Reason == dnsfilter.RewrittenRule { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/dnsfilter.go |
result.Reason = RewrittenAutoHosts | <mask>
<mask> func (d *DNSFilter) checkAutoHosts(host string, qtype uint16, result *Result) (matched bool) {
<mask> ips := d.Config.AutoHosts.Process(host, qtype)
<mask> if ips != nil {
<mask> result.Reason = RewriteAutoHosts
<mask> result.IPList = ips
<mask>
<mask> return true
<mask> }
<mask>
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove result.Reason = RewriteAutoHosts
</s> add result.Reason = RewrittenAutoHosts </s> remove if result.Reason == ReasonRewrite {
</s> add if result.Reason == Rewritten { </s> remove } else if res.Reason == dnsfilter.DNSRewriteRule {
</s> add } else if res.Reason == dnsfilter.RewrittenRule { </s> remove res.Reason = ReasonRewrite
</s> add res.Reason = Rewritten </s> remove } else if res.Reason == dnsfilter.ReasonRewrite || res.Reason == dnsfilter.RewriteAutoHosts {
</s> add } else if res.Reason == dnsfilter.Rewritten || res.Reason == dnsfilter.RewrittenAutoHosts { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/dnsfilter.go |
result.Reason = RewrittenAutoHosts | <mask> }
<mask>
<mask> revHosts := d.Config.AutoHosts.ProcessReverse(host, qtype)
<mask> if len(revHosts) != 0 {
<mask> result.Reason = RewriteAutoHosts
<mask>
<mask> // TODO(a.garipov): Optimize this with a buffer.
<mask> result.ReverseHosts = make([]string, len(revHosts))
<mask> for i := range revHosts {
<mask> result.ReverseHosts[i] = revHosts[i] + "."
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove result.Reason = RewriteAutoHosts
</s> add result.Reason = RewrittenAutoHosts </s> remove } else if res.Reason == dnsfilter.RewriteAutoHosts && len(res.ReverseHosts) != 0 {
</s> add } else if res.Reason == dnsfilter.RewrittenAutoHosts && len(res.ReverseHosts) != 0 { </s> remove res.Reason = ReasonRewrite
</s> add res.Reason = Rewritten </s> remove } else if res.Reason == dnsfilter.ReasonRewrite || res.Reason == dnsfilter.RewriteAutoHosts {
</s> add } else if res.Reason == dnsfilter.Rewritten || res.Reason == dnsfilter.RewrittenAutoHosts { </s> remove if result.Reason == ReasonRewrite {
</s> add if result.Reason == Rewritten { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/dnsfilter.go |
res.Reason = Rewritten | <mask> defer d.confLock.RUnlock()
<mask>
<mask> rr := findRewrites(d.Rewrites, host)
<mask> if len(rr) != 0 {
<mask> res.Reason = ReasonRewrite
<mask> }
<mask>
<mask> cnames := map[string]bool{}
<mask> origHost := host
<mask> for len(rr) != 0 && rr[0].Type == dns.TypeCNAME {
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove } else if res.Reason == dnsfilter.RewriteAutoHosts && len(res.ReverseHosts) != 0 {
</s> add } else if res.Reason == dnsfilter.RewrittenAutoHosts && len(res.ReverseHosts) != 0 { </s> remove } else if res.Reason == dnsfilter.ReasonRewrite || res.Reason == dnsfilter.RewriteAutoHosts {
</s> add } else if res.Reason == dnsfilter.Rewritten || res.Reason == dnsfilter.RewrittenAutoHosts { </s> remove if res.Reason == DNSRewriteRule && res.CanonName == host {
</s> add if res.Reason == RewrittenRule && res.CanonName == host { </s> remove result.Reason = RewriteAutoHosts
</s> add result.Reason = RewrittenAutoHosts </s> remove } else if res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.DNSRewriteRule) &&
</s> add } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenRule) && | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/dnsfilter.go |
if res.Reason == RewrittenRule && res.CanonName == host { | <mask> // Check DNS rewrites first, because the API there is a bit
<mask> // awkward.
<mask> if dnsr := dnsres.DNSRewrites(); len(dnsr) > 0 {
<mask> res = d.processDNSRewrites(dnsr)
<mask> if res.Reason == DNSRewriteRule && res.CanonName == host {
<mask> // A rewrite of a host to itself. Go on and
<mask> // try matching other things.
<mask> } else {
<mask> return res, nil
<mask> }
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove // ReasonRewrite is returned when there was a rewrite by
// a legacy DNS Rewrite rule.
ReasonRewrite
// RewriteAutoHosts is returned when there was a rewrite by
// autohosts rules (/etc/hosts and so on).
RewriteAutoHosts
// DNSRewriteRule is returned when a $dnsrewrite filter rule was
// applied.
DNSRewriteRule
</s> add // Rewritten is returned when there was a rewrite by a legacy DNS
// rewrite rule.
Rewritten
// RewrittenAutoHosts is returned when there was a rewrite by autohosts
// rules (/etc/hosts and so on).
RewrittenAutoHosts
// RewrittenRule is returned when a $dnsrewrite filter rule was applied.
//
// TODO(a.garipov): Remove Rewritten and RewrittenAutoHosts by merging
// their functionality into RewrittenRule.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/2499.
RewrittenRule </s> remove } else if res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.DNSRewriteRule) &&
</s> add } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenRule) && </s> remove } else if res.Reason == dnsfilter.DNSRewriteRule {
</s> add } else if res.Reason == dnsfilter.RewrittenRule { </s> remove } else if res.Reason == dnsfilter.RewriteAutoHosts && len(res.ReverseHosts) != 0 {
</s> add } else if res.Reason == dnsfilter.RewrittenAutoHosts && len(res.ReverseHosts) != 0 { </s> remove } else if res.Reason == dnsfilter.ReasonRewrite || res.Reason == dnsfilter.RewriteAutoHosts {
</s> add } else if res.Reason == dnsfilter.Rewritten || res.Reason == dnsfilter.RewrittenAutoHosts { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/dnsfilter.go |
Reason: RewrittenRule, | <mask> Text: nr.RuleText,
<mask> }}
<mask>
<mask> return Result{
<mask> Reason: DNSRewriteRule,
<mask> Rules: rules,
<mask> CanonName: dr.NewCNAME,
<mask> }
<mask> }
<mask>
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove Reason: DNSRewriteRule,
</s> add Reason: RewrittenRule, </s> remove Reason: DNSRewriteRule,
</s> add Reason: RewrittenRule, </s> remove Reason: dnsfilter.ReasonRewrite,
</s> add Reason: dnsfilter.Rewritten, </s> remove } else if res.Reason == dnsfilter.DNSRewriteRule {
</s> add } else if res.Reason == dnsfilter.RewrittenRule { </s> remove } else if res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.DNSRewriteRule) &&
</s> add } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenRule) && | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/dnsrewrite.go |
Reason: RewrittenRule, | <mask> RCode: dr.RCode,
<mask> }
<mask>
<mask> return Result{
<mask> Reason: DNSRewriteRule,
<mask> Rules: rules,
<mask> DNSRewriteResult: dnsrr,
<mask> }
<mask> }
<mask> }
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove Reason: DNSRewriteRule,
</s> add Reason: RewrittenRule, </s> remove Reason: DNSRewriteRule,
</s> add Reason: RewrittenRule, </s> remove } else if res.Reason == dnsfilter.DNSRewriteRule {
</s> add } else if res.Reason == dnsfilter.RewrittenRule { </s> remove Reason: dnsfilter.ReasonRewrite,
</s> add Reason: dnsfilter.Rewritten, </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/dnsrewrite.go |
Reason: RewrittenRule, | <mask> }
<mask> }
<mask>
<mask> return Result{
<mask> Reason: DNSRewriteRule,
<mask> Rules: rules,
<mask> DNSRewriteResult: dnsrr,
<mask> }
<mask> }
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove Reason: DNSRewriteRule,
</s> add Reason: RewrittenRule, </s> remove Reason: DNSRewriteRule,
</s> add Reason: RewrittenRule, </s> remove } else if res.Reason == dnsfilter.DNSRewriteRule {
</s> add } else if res.Reason == dnsfilter.RewrittenRule { </s> remove Reason: dnsfilter.ReasonRewrite,
</s> add Reason: dnsfilter.Rewritten, </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/dnsrewrite.go |
assert.Equal(t, Rewritten, r.Reason) | <mask> r := d.processRewrites("host2.com", dns.TypeA)
<mask> assert.Equal(t, NotFilteredNotFound, r.Reason)
<mask>
<mask> r = d.processRewrites("www.host.com", dns.TypeA)
<mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.Equal(t, "host.com", r.CanonName)
<mask> assert.Equal(t, 2, len(r.IPList))
<mask> assert.True(t, r.IPList[0].Equal(net.ParseIP("1.2.3.4")))
<mask> assert.True(t, r.IPList[1].Equal(net.ParseIP("1.2.3.5")))
<mask>
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/rewrites_test.go |
assert.Equal(t, Rewritten, r.Reason) | <mask> assert.True(t, r.IPList[0].Equal(net.ParseIP("1.2.3.4")))
<mask> assert.True(t, r.IPList[1].Equal(net.ParseIP("1.2.3.5")))
<mask>
<mask> r = d.processRewrites("www.host.com", dns.TypeAAAA)
<mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.Equal(t, "host.com", r.CanonName)
<mask> assert.Equal(t, 1, len(r.IPList))
<mask> assert.True(t, r.IPList[0].Equal(net.ParseIP("1:2:3::4")))
<mask>
<mask> // wildcard
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/rewrites_test.go |
assert.Equal(t, Rewritten, r.Reason) | <mask> {"*.host.com", "1.2.3.5", 0, nil},
<mask> }
<mask> d.prepareRewrites()
<mask> r = d.processRewrites("host.com", dns.TypeA)
<mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.True(t, r.IPList[0].Equal(net.ParseIP("1.2.3.4")))
<mask>
<mask> r = d.processRewrites("www.host.com", dns.TypeA)
<mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.True(t, r.IPList[0].Equal(net.ParseIP("1.2.3.5")))
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/rewrites_test.go |
assert.Equal(t, Rewritten, r.Reason) | <mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.True(t, r.IPList[0].Equal(net.ParseIP("1.2.3.4")))
<mask>
<mask> r = d.processRewrites("www.host.com", dns.TypeA)
<mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.True(t, r.IPList[0].Equal(net.ParseIP("1.2.3.5")))
<mask>
<mask> r = d.processRewrites("www.host2.com", dns.TypeA)
<mask> assert.Equal(t, NotFilteredNotFound, r.Reason)
<mask>
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/rewrites_test.go |
assert.Equal(t, Rewritten, r.Reason) | <mask> {"*.host.com", "1.2.3.5", 0, nil},
<mask> }
<mask> d.prepareRewrites()
<mask> r = d.processRewrites("a.host.com", dns.TypeA)
<mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.True(t, len(r.IPList) == 1)
<mask> assert.True(t, r.IPList[0].Equal(net.ParseIP("1.2.3.4")))
<mask>
<mask> // wildcard + CNAME
<mask> d.Rewrites = []RewriteEntry{
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/rewrites_test.go |
assert.Equal(t, Rewritten, r.Reason) | <mask> {"*.host.com", "host.com", 0, nil},
<mask> }
<mask> d.prepareRewrites()
<mask> r = d.processRewrites("www.host.com", dns.TypeA)
<mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.Equal(t, "host.com", r.CanonName)
<mask> assert.True(t, r.IPList[0].Equal(net.ParseIP("1.2.3.4")))
<mask>
<mask> // 2 CNAMEs
<mask> d.Rewrites = []RewriteEntry{
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/rewrites_test.go |
assert.Equal(t, Rewritten, r.Reason) | <mask> {"host.com", "1.2.3.4", 0, nil},
<mask> }
<mask> d.prepareRewrites()
<mask> r = d.processRewrites("b.host.com", dns.TypeA)
<mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.Equal(t, "host.com", r.CanonName)
<mask> assert.True(t, len(r.IPList) == 1)
<mask> assert.True(t, r.IPList[0].Equal(net.ParseIP("1.2.3.4")))
<mask>
<mask> // 2 CNAMEs + wildcard
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/rewrites_test.go |
assert.Equal(t, Rewritten, r.Reason) | <mask> {"*.somehost.com", "1.2.3.4", 0, nil},
<mask> }
<mask> d.prepareRewrites()
<mask> r = d.processRewrites("b.host.com", dns.TypeA)
<mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.Equal(t, "x.somehost.com", r.CanonName)
<mask> assert.True(t, len(r.IPList) == 1)
<mask> assert.True(t, r.IPList[0].Equal(net.ParseIP("1.2.3.4")))
<mask> }
<mask>
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/rewrites_test.go |
assert.Equal(t, Rewritten, r.Reason) | <mask> d.prepareRewrites()
<mask>
<mask> // match exact
<mask> r := d.processRewrites("host.com", dns.TypeA)
<mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.Equal(t, 1, len(r.IPList))
<mask> assert.Equal(t, "1.1.1.1", r.IPList[0].String())
<mask>
<mask> // match L2
<mask> r = d.processRewrites("sub.host.com", dns.TypeA)
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/rewrites_test.go |
assert.Equal(t, Rewritten, r.Reason) | <mask> assert.Equal(t, "1.1.1.1", r.IPList[0].String())
<mask>
<mask> // match L2
<mask> r = d.processRewrites("sub.host.com", dns.TypeA)
<mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.Equal(t, 1, len(r.IPList))
<mask> assert.Equal(t, "2.2.2.2", r.IPList[0].String())
<mask>
<mask> // match L3
<mask> r = d.processRewrites("my.sub.host.com", dns.TypeA)
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/rewrites_test.go |
assert.Equal(t, Rewritten, r.Reason) | <mask> assert.Equal(t, "2.2.2.2", r.IPList[0].String())
<mask>
<mask> // match L3
<mask> r = d.processRewrites("my.sub.host.com", dns.TypeA)
<mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.Equal(t, 1, len(r.IPList))
<mask> assert.Equal(t, "3.3.3.3", r.IPList[0].String())
<mask> }
<mask>
<mask> func TestRewritesExceptionCNAME(t *testing.T) {
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/rewrites_test.go |
assert.Equal(t, Rewritten, r.Reason) | <mask> d.prepareRewrites()
<mask>
<mask> // match sub-domain
<mask> r := d.processRewrites("my.host.com", dns.TypeA)
<mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.Equal(t, 1, len(r.IPList))
<mask> assert.Equal(t, "2.2.2.2", r.IPList[0].String())
<mask>
<mask> // match sub-domain, but handle exception
<mask> r = d.processRewrites("sub.host.com", dns.TypeA)
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/rewrites_test.go |
assert.Equal(t, Rewritten, r.Reason) | <mask> d.prepareRewrites()
<mask>
<mask> // match sub-domain
<mask> r := d.processRewrites("my.host.com", dns.TypeA)
<mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.Equal(t, 1, len(r.IPList))
<mask> assert.Equal(t, "2.2.2.2", r.IPList[0].String())
<mask>
<mask> // match sub-domain, but handle exception
<mask> r = d.processRewrites("my.sub.host.com", dns.TypeA)
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/rewrites_test.go |
assert.Equal(t, Rewritten, r.Reason) | <mask> d.prepareRewrites()
<mask>
<mask> // match domain
<mask> r := d.processRewrites("host.com", dns.TypeA)
<mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.Equal(t, 1, len(r.IPList))
<mask> assert.Equal(t, "1.2.3.4", r.IPList[0].String())
<mask>
<mask> // match exception
<mask> r = d.processRewrites("host.com", dns.TypeAAAA)
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/rewrites_test.go |
assert.Equal(t, Rewritten, r.Reason) | <mask> assert.Equal(t, NotFilteredNotFound, r.Reason)
<mask>
<mask> // match domain
<mask> r = d.processRewrites("host2.com", dns.TypeAAAA)
<mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.Equal(t, 1, len(r.IPList))
<mask> assert.Equal(t, "::1", r.IPList[0].String())
<mask>
<mask> // match exception
<mask> r = d.processRewrites("host3.com", dns.TypeA)
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/rewrites_test.go |
assert.Equal(t, Rewritten, r.Reason) | <mask> assert.Equal(t, NotFilteredNotFound, r.Reason)
<mask>
<mask> // match domain
<mask> r = d.processRewrites("host3.com", dns.TypeAAAA)
<mask> assert.Equal(t, ReasonRewrite, r.Reason)
<mask> assert.Equal(t, 0, len(r.IPList))
<mask> }
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsfilter/rewrites_test.go |
case dnsfilter.Rewritten,
dnsfilter.RewrittenRule: | <mask> res := ctx.result
<mask> var err error
<mask>
<mask> switch res.Reason {
<mask> case dnsfilter.ReasonRewrite,
<mask> dnsfilter.DNSRewriteRule:
<mask>
<mask> if len(ctx.origQuestion.Name) == 0 {
<mask> // origQuestion is set in case we get only CNAME without IP from rewrites table
<mask> break
<mask> }
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove if res.Reason == DNSRewriteRule && res.CanonName == host {
</s> add if res.Reason == RewrittenRule && res.CanonName == host { </s> remove if result.Reason == ReasonRewrite {
</s> add if result.Reason == Rewritten { </s> remove } else if res.Reason == dnsfilter.RewriteAutoHosts && len(res.ReverseHosts) != 0 {
</s> add } else if res.Reason == dnsfilter.RewrittenAutoHosts && len(res.ReverseHosts) != 0 { </s> remove } else if res.Reason == dnsfilter.DNSRewriteRule {
</s> add } else if res.Reason == dnsfilter.RewrittenRule { </s> remove return res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.RewriteAutoHosts)
</s> add return res.Reason.In(
dnsfilter.Rewritten,
dnsfilter.RewrittenAutoHosts,
dnsfilter.RewrittenRule,
) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsforward/dns.go |
} else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenRule) && | <mask> return nil, fmt.Errorf("dnsfilter failed to check host %q: %w", host, err)
<mask> } else if res.IsFiltered {
<mask> log.Tracef("Host %s is filtered, reason - %q, matched rule: %q", host, res.Reason, res.Rules[0].Text)
<mask> d.Res = s.genDNSFilterMessage(d, &res)
<mask> } else if res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.DNSRewriteRule) &&
<mask> res.CanonName != "" &&
<mask> len(res.IPList) == 0 {
<mask> // Resolve the new canonical name, not the original host
<mask> // name. The original question is readded in
<mask> // processFilteringAfterResponse.
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove } else if res.Reason == dnsfilter.RewriteAutoHosts && len(res.ReverseHosts) != 0 {
</s> add } else if res.Reason == dnsfilter.RewrittenAutoHosts && len(res.ReverseHosts) != 0 { </s> remove if res.Reason == DNSRewriteRule && res.CanonName == host {
</s> add if res.Reason == RewrittenRule && res.CanonName == host { </s> remove } else if res.Reason == dnsfilter.DNSRewriteRule {
</s> add } else if res.Reason == dnsfilter.RewrittenRule { </s> remove } else if res.Reason == dnsfilter.ReasonRewrite || res.Reason == dnsfilter.RewriteAutoHosts {
</s> add } else if res.Reason == dnsfilter.Rewritten || res.Reason == dnsfilter.RewrittenAutoHosts { </s> remove res.Reason = ReasonRewrite
</s> add res.Reason = Rewritten | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsforward/filter.go |
} else if res.Reason == dnsfilter.RewrittenAutoHosts && len(res.ReverseHosts) != 0 { | <mask> // name. The original question is readded in
<mask> // processFilteringAfterResponse.
<mask> ctx.origQuestion = d.Req.Question[0]
<mask> d.Req.Question[0].Name = dns.Fqdn(res.CanonName)
<mask> } else if res.Reason == dnsfilter.RewriteAutoHosts && len(res.ReverseHosts) != 0 {
<mask> resp := s.makeResponse(req)
<mask> for _, h := range res.ReverseHosts {
<mask> hdr := dns.RR_Header{
<mask> Name: req.Question[0].Name,
<mask> Rrtype: dns.TypePTR,
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove } else if res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.DNSRewriteRule) &&
</s> add } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenRule) && </s> remove } else if res.Reason == dnsfilter.ReasonRewrite || res.Reason == dnsfilter.RewriteAutoHosts {
</s> add } else if res.Reason == dnsfilter.Rewritten || res.Reason == dnsfilter.RewrittenAutoHosts { </s> remove res.Reason = ReasonRewrite
</s> add res.Reason = Rewritten </s> remove result.Reason = RewriteAutoHosts
</s> add result.Reason = RewrittenAutoHosts </s> remove } else if res.Reason == dnsfilter.DNSRewriteRule {
</s> add } else if res.Reason == dnsfilter.RewrittenRule { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsforward/filter.go |
} else if res.Reason == dnsfilter.Rewritten || res.Reason == dnsfilter.RewrittenAutoHosts { | <mask> resp.Answer = append(resp.Answer, ptr)
<mask> }
<mask>
<mask> d.Res = resp
<mask> } else if res.Reason == dnsfilter.ReasonRewrite || res.Reason == dnsfilter.RewriteAutoHosts {
<mask> resp := s.makeResponse(req)
<mask>
<mask> name := host
<mask> if len(res.CanonName) != 0 {
<mask> resp.Answer = append(resp.Answer, s.genAnswerCNAME(req, res.CanonName))
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove } else if res.Reason == dnsfilter.RewriteAutoHosts && len(res.ReverseHosts) != 0 {
</s> add } else if res.Reason == dnsfilter.RewrittenAutoHosts && len(res.ReverseHosts) != 0 { </s> remove } else if res.Reason == dnsfilter.DNSRewriteRule {
</s> add } else if res.Reason == dnsfilter.RewrittenRule { </s> remove res.Reason = ReasonRewrite
</s> add res.Reason = Rewritten </s> remove if res.Reason == DNSRewriteRule && res.CanonName == host {
</s> add if res.Reason == RewrittenRule && res.CanonName == host { </s> remove } else if res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.DNSRewriteRule) &&
</s> add } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenRule) && | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsforward/filter.go |
} else if res.Reason == dnsfilter.RewrittenRule { | <mask> }
<mask> }
<mask>
<mask> d.Res = resp
<mask> } else if res.Reason == dnsfilter.DNSRewriteRule {
<mask> err = s.filterDNSRewrite(req, res, d)
<mask> if err != nil {
<mask> return nil, err
<mask> }
<mask> }
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove } else if res.Reason == dnsfilter.ReasonRewrite || res.Reason == dnsfilter.RewriteAutoHosts {
</s> add } else if res.Reason == dnsfilter.Rewritten || res.Reason == dnsfilter.RewrittenAutoHosts { </s> remove } else if res.Reason == dnsfilter.RewriteAutoHosts && len(res.ReverseHosts) != 0 {
</s> add } else if res.Reason == dnsfilter.RewrittenAutoHosts && len(res.ReverseHosts) != 0 { </s> remove if res.Reason == DNSRewriteRule && res.CanonName == host {
</s> add if res.Reason == RewrittenRule && res.CanonName == host { </s> remove } else if res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.DNSRewriteRule) &&
</s> add } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenRule) && </s> remove if result.Reason == ReasonRewrite {
</s> add if result.Reason == Rewritten { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/dnsforward/filter.go |
// for Rewritten: | <mask>
<mask> // for FilteredBlockedService:
<mask> SvcName string `json:"service_name"`
<mask>
<mask> // for ReasonRewrite:
<mask> CanonName string `json:"cname"` // CNAME value
<mask> IPList []net.IP `json:"ip_addrs"` // list of IP addresses
<mask> }
<mask>
<mask> func (f *Filtering) handleCheckHost(w http.ResponseWriter, r *http.Request) {
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove // It is empty unless Reason is set to ReasonRewrite.
</s> add // It is empty unless Reason is set to Rewritten or RewrittenRule. </s> remove // Reason is set to RewriteAutoHosts or ReasonRewrite.
</s> add // Reason is set to RewrittenAutoHosts or Rewritten. </s> remove ReasonRewrite: "Rewrite",
RewriteAutoHosts: "RewriteEtcHosts",
DNSRewriteRule: "DNSRewriteRule",
</s> add Rewritten: "Rewrite",
RewrittenAutoHosts: "RewriteEtcHosts",
RewrittenRule: "RewriteRule", </s> remove // empty unless Reason is set to RewriteAutoHosts.
</s> add // empty unless Reason is set to RewrittenAutoHosts. </s> remove case dnsfilter.ReasonRewrite,
dnsfilter.DNSRewriteRule:
</s> add case dnsfilter.Rewritten,
dnsfilter.RewrittenRule: | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/home/controlfiltering.go |
Reason: dnsfilter.Rewritten, | <mask> answer.A = net.ParseIP(answerStr)
<mask> a.Answer = append(a.Answer, answer)
<mask> res := dnsfilter.Result{
<mask> IsFiltered: true,
<mask> Reason: dnsfilter.ReasonRewrite,
<mask> ServiceName: "SomeService",
<mask> Rules: []*dnsfilter.ResultRule{{
<mask> FilterListID: 1,
<mask> Text: "SomeRule",
<mask> }},
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove Reason: DNSRewriteRule,
</s> add Reason: RewrittenRule, </s> remove Reason: DNSRewriteRule,
</s> add Reason: RewrittenRule, </s> remove Reason: DNSRewriteRule,
</s> add Reason: RewrittenRule, </s> remove case dnsfilter.ReasonRewrite,
dnsfilter.DNSRewriteRule:
</s> add case dnsfilter.Rewritten,
dnsfilter.RewrittenRule: </s> remove assert.Equal(t, ReasonRewrite, r.Reason)
</s> add assert.Equal(t, Rewritten, r.Reason) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/querylog/qlog_test.go |
dnsfilter.Rewritten,
dnsfilter.RewrittenAutoHosts,
dnsfilter.RewrittenRule, | <mask> case filteringStatusFiltered:
<mask> return res.IsFiltered ||
<mask> res.Reason.In(
<mask> dnsfilter.NotFilteredAllowList,
<mask> dnsfilter.ReasonRewrite,
<mask> dnsfilter.RewriteAutoHosts,
<mask> )
<mask>
<mask> case filteringStatusBlocked:
<mask> return res.IsFiltered &&
<mask> res.Reason.In(dnsfilter.FilteredBlockList, dnsfilter.FilteredBlockedService)
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove return res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.RewriteAutoHosts)
</s> add return res.Reason.In(
dnsfilter.Rewritten,
dnsfilter.RewrittenAutoHosts,
dnsfilter.RewrittenRule,
) </s> remove case dnsfilter.ReasonRewrite,
dnsfilter.DNSRewriteRule:
</s> add case dnsfilter.Rewritten,
dnsfilter.RewrittenRule: </s> remove } else if res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.DNSRewriteRule) &&
</s> add } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenRule) && </s> remove ReasonRewrite: "Rewrite",
RewriteAutoHosts: "RewriteEtcHosts",
DNSRewriteRule: "DNSRewriteRule",
</s> add Rewritten: "Rewrite",
RewrittenAutoHosts: "RewriteEtcHosts",
RewrittenRule: "RewriteRule", </s> remove - 'DNSRewriteRule'
</s> add - 'RewriteRule' | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/querylog/searchcriteria.go |
return res.Reason.In(
dnsfilter.Rewritten,
dnsfilter.RewrittenAutoHosts,
dnsfilter.RewrittenRule,
) | <mask> case filteringStatusWhitelisted:
<mask> return res.Reason == dnsfilter.NotFilteredAllowList
<mask>
<mask> case filteringStatusRewritten:
<mask> return res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.RewriteAutoHosts)
<mask>
<mask> case filteringStatusSafeSearch:
<mask> return res.IsFiltered && res.Reason == dnsfilter.FilteredSafeSearch
<mask>
<mask> case filteringStatusProcessed:
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove dnsfilter.ReasonRewrite,
dnsfilter.RewriteAutoHosts,
</s> add dnsfilter.Rewritten,
dnsfilter.RewrittenAutoHosts,
dnsfilter.RewrittenRule, </s> remove case dnsfilter.ReasonRewrite,
dnsfilter.DNSRewriteRule:
</s> add case dnsfilter.Rewritten,
dnsfilter.RewrittenRule: </s> remove if res.Reason == DNSRewriteRule && res.CanonName == host {
</s> add if res.Reason == RewrittenRule && res.CanonName == host { </s> remove } else if res.Reason == dnsfilter.DNSRewriteRule {
</s> add } else if res.Reason == dnsfilter.RewrittenRule { </s> remove } else if res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.DNSRewriteRule) &&
</s> add } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenRule) && | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | internal/querylog/searchcriteria.go |
- 'RewriteRule' | <mask> - 'FilteredSafeSearch'
<mask> - 'FilteredBlockedService'
<mask> - 'Rewrite'
<mask> - 'RewriteEtcHosts'
<mask> - 'DNSRewriteRule'
<mask> 'filter_id':
<mask> 'deprecated': true
<mask> 'description': >
<mask> In case if there's a rule applied to this DNS request, this is ID of
<mask> the filter list that the rule belongs to.
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove - 'DNSRewriteRule'
</s> add - 'RewriteRule' </s> remove // ReasonRewrite is returned when there was a rewrite by
// a legacy DNS Rewrite rule.
ReasonRewrite
// RewriteAutoHosts is returned when there was a rewrite by
// autohosts rules (/etc/hosts and so on).
RewriteAutoHosts
// DNSRewriteRule is returned when a $dnsrewrite filter rule was
// applied.
DNSRewriteRule
</s> add // Rewritten is returned when there was a rewrite by a legacy DNS
// rewrite rule.
Rewritten
// RewrittenAutoHosts is returned when there was a rewrite by autohosts
// rules (/etc/hosts and so on).
RewrittenAutoHosts
// RewrittenRule is returned when a $dnsrewrite filter rule was applied.
//
// TODO(a.garipov): Remove Rewritten and RewrittenAutoHosts by merging
// their functionality into RewrittenRule.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/2499.
RewrittenRule </s> remove if result.Reason == ReasonRewrite {
</s> add if result.Reason == Rewritten { </s> remove } else if res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.DNSRewriteRule) &&
</s> add } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenRule) && </s> remove if res.Reason == DNSRewriteRule && res.CanonName == host {
</s> add if res.Reason == RewrittenRule && res.CanonName == host { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | openapi/openapi.yaml |
- 'RewriteRule' | <mask> - 'FilteredSafeSearch'
<mask> - 'FilteredBlockedService'
<mask> - 'Rewrite'
<mask> - 'RewriteEtcHosts'
<mask> - 'DNSRewriteRule'
<mask> 'service_name':
<mask> 'type': 'string'
<mask> 'description': 'Set if reason=FilteredBlockedService'
<mask> 'status':
<mask> 'type': 'string'
</s> Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master
Closes #2491.
Squashed commit of the following:
commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 18:33:32 2020 +0300
Merge branch 'master' into 2491-dnsrewrite-log
commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <[email protected]>
Date: Mon Dec 28 18:11:01 2020 +0300
Add RewriteRule for client
commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:22:44 2020 +0300
all: imp naming, docs
commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 17:16:35 2020 +0300
all: imp naming, add todo
commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <[email protected]>
Date: Mon Dec 28 16:53:00 2020 +0300
all: improve dnsrewrite handling </s> remove - 'DNSRewriteRule'
</s> add - 'RewriteRule' </s> remove if result.Reason == ReasonRewrite {
</s> add if result.Reason == Rewritten { </s> remove } else if res.Reason.In(dnsfilter.ReasonRewrite, dnsfilter.DNSRewriteRule) &&
</s> add } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenRule) && </s> remove // ReasonRewrite is returned when there was a rewrite by
// a legacy DNS Rewrite rule.
ReasonRewrite
// RewriteAutoHosts is returned when there was a rewrite by
// autohosts rules (/etc/hosts and so on).
RewriteAutoHosts
// DNSRewriteRule is returned when a $dnsrewrite filter rule was
// applied.
DNSRewriteRule
</s> add // Rewritten is returned when there was a rewrite by a legacy DNS
// rewrite rule.
Rewritten
// RewrittenAutoHosts is returned when there was a rewrite by autohosts
// rules (/etc/hosts and so on).
RewrittenAutoHosts
// RewrittenRule is returned when a $dnsrewrite filter rule was applied.
//
// TODO(a.garipov): Remove Rewritten and RewrittenAutoHosts by merging
// their functionality into RewrittenRule.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/2499.
RewrittenRule </s> remove } else if res.Reason == dnsfilter.DNSRewriteRule {
</s> add } else if res.Reason == dnsfilter.RewrittenRule { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/338209f32bdb876da19e52c366e440ea3c457470 | openapi/openapi.yaml |
func startDNSServer() error { | <mask> }
<mask> }
<mask> return false
<mask> }
<mask> func handleStart(w http.ResponseWriter, r *http.Request) {
<mask> if isRunning() {
<mask> http.Error(w, fmt.Sprintf("Unable to start coreDNS: Already running"), 400)
<mask> return
<mask> }
<mask> err := writeCoreDNSConfig()
</s> Move starting of coredns server into separate function </s> remove http.Error(w, fmt.Sprintf("Unable to start coreDNS: Already running"), 400)
return
</s> add return fmt.Errorf("Unable to start coreDNS: Already running") </s> remove errortext := fmt.Sprintf("Unable to write coredns config: %s", err)
</s> add errortext := fmt.Errorf("Unable to write coredns config: %s", err) </s> remove http.Error(w, errortext, http.StatusInternalServerError)
return
</s> add return errortext </s> remove fmt.Fprintf(w, "OK, PID %d\n", coreDNSCommand.Process.Pid)
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/33fbccf0badee8a4c5f790d850d85e161536779f | control.go |
return fmt.Errorf("Unable to start coreDNS: Already running") | <mask> return false
<mask> }
<mask> func handleStart(w http.ResponseWriter, r *http.Request) {
<mask> if isRunning() {
<mask> http.Error(w, fmt.Sprintf("Unable to start coreDNS: Already running"), 400)
<mask> return
<mask> }
<mask> err := writeCoreDNSConfig()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Unable to write coredns config: %s", err)
<mask> log.Println(errortext)
</s> Move starting of coredns server into separate function </s> remove func handleStart(w http.ResponseWriter, r *http.Request) {
</s> add func startDNSServer() error { </s> remove errortext := fmt.Sprintf("Unable to write coredns config: %s", err)
</s> add errortext := fmt.Errorf("Unable to write coredns config: %s", err) </s> remove http.Error(w, errortext, http.StatusInternalServerError)
return
</s> add return errortext </s> remove http.Error(w, errortext, http.StatusInternalServerError)
return
</s> add return errortext | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/33fbccf0badee8a4c5f790d850d85e161536779f | control.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.