docstring_tokens
stringlengths 18
16.9k
| code_tokens
stringlengths 75
1.81M
| html_url
stringlengths 74
116
| file_name
stringlengths 3
311
|
---|---|---|---|
keep add keep keep keep keep | <mask> const mapDispatchToProps = {
<mask> getClients,
<mask> addClient,
<mask> updateClient,
<mask> deleteClient,
<mask> toggleClientModal,
</s> * client: remove /clients and /stats_top request from global requests </s> remove import { getClients } from '../actions';
</s> add import { getClients, getTopStats } from '../actions'; </s> remove import { getLogs, toggleLogStatus, downloadQueryLog, getFilteringStatus, setRules, addSuccessToast } from '../actions';
</s> add import { getLogs, toggleLogStatus, downloadQueryLog, getFilteringStatus, setRules, addSuccessToast, getClients } from '../actions'; </s> add this.props.getTopStats(); </s> remove dispatch(getClients());
dispatch(getTopStats());
</s> add </s> add getClients, </s> add this.props.getClients(); | https://github.com/AdguardTeam/AdGuardHome/commit/2520a62e2430dac1d9bf689c567b95d419a78339 | client/src/containers/Clients.js |
keep replace keep keep keep keep keep | <mask> import { connect } from 'react-redux';
<mask> import { getLogs, toggleLogStatus, downloadQueryLog, getFilteringStatus, setRules, addSuccessToast } from '../actions';
<mask> import Logs from '../components/Logs';
<mask>
<mask> const mapStateToProps = (state) => {
<mask> const { queryLogs, dashboard, filtering } = state;
<mask> const props = { queryLogs, dashboard, filtering };
</s> * client: remove /clients and /stats_top request from global requests </s> remove import { getClients } from '../actions';
</s> add import { getClients, getTopStats } from '../actions'; </s> add this.props.getTopStats(); </s> remove dispatch(getClients());
dispatch(getTopStats());
</s> add </s> add this.props.getClients(); </s> add getTopStats, </s> add getClients, | https://github.com/AdguardTeam/AdGuardHome/commit/2520a62e2430dac1d9bf689c567b95d419a78339 | client/src/containers/Logs.js |
keep keep add keep keep keep keep keep | <mask> getFilteringStatus,
<mask> setRules,
<mask> addSuccessToast,
<mask> };
<mask>
<mask> export default connect(
<mask> mapStateToProps,
<mask> mapDispatchToProps,
</s> * client: remove /clients and /stats_top request from global requests </s> remove import { getLogs, toggleLogStatus, downloadQueryLog, getFilteringStatus, setRules, addSuccessToast } from '../actions';
</s> add import { getLogs, toggleLogStatus, downloadQueryLog, getFilteringStatus, setRules, addSuccessToast, getClients } from '../actions'; </s> add getClients: PropTypes.func.isRequired, </s> add getTopStats: PropTypes.func.isRequired, </s> add getTopStats, </s> remove import { getClients } from '../actions';
</s> add import { getClients, getTopStats } from '../actions'; </s> add this.props.getTopStats(); | https://github.com/AdguardTeam/AdGuardHome/commit/2520a62e2430dac1d9bf689c567b95d419a78339 | client/src/containers/Logs.js |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> type logEntry struct {
<mask> Question []byte
<mask> Answer []byte `json:",omitempty"` // sometimes empty answers happen like binerdunt.top or rev2.globalrootservers.net
<mask> Result *dnsfilter.Result
<mask> Time time.Time
<mask> Elapsed time.Duration
<mask> IP string
<mask> Upstream string `json:",omitempty"` // if empty, means it was cached
<mask> }
</s> Pointer for dnsfilter.Result in querylog didn't make things simpler, revert that change and all related changes. </s> remove if entry.Result != nil {
if entry.Result.IsFiltered {
filtered.IncWithTime(entry.Time)
}
</s> add if entry.Result.IsFiltered {
filtered.IncWithTime(entry.Time)
} </s> remove if entry.Result != nil && entry.Result.IsFiltered {
</s> add if entry.Result.IsFiltered { </s> add if result == nil {
result = &dnsfilter.Result{}
}
</s> remove switch entry.Result.Reason {
case dnsfilter.NotFilteredWhiteList:
whitelisted.IncWithTime(entry.Time)
case dnsfilter.NotFilteredError:
errorsTotal.IncWithTime(entry.Time)
case dnsfilter.FilteredBlackList:
filteredLists.IncWithTime(entry.Time)
case dnsfilter.FilteredSafeBrowsing:
filteredSafebrowsing.IncWithTime(entry.Time)
case dnsfilter.FilteredParental:
filteredParental.IncWithTime(entry.Time)
case dnsfilter.FilteredInvalid:
// do nothing
case dnsfilter.FilteredSafeSearch:
safesearch.IncWithTime(entry.Time)
}
</s> add switch entry.Result.Reason {
case dnsfilter.NotFilteredWhiteList:
whitelisted.IncWithTime(entry.Time)
case dnsfilter.NotFilteredError:
errorsTotal.IncWithTime(entry.Time)
case dnsfilter.FilteredBlackList:
filteredLists.IncWithTime(entry.Time)
case dnsfilter.FilteredSafeBrowsing:
filteredSafebrowsing.IncWithTime(entry.Time)
case dnsfilter.FilteredParental:
filteredParental.IncWithTime(entry.Time)
case dnsfilter.FilteredInvalid:
// do nothing
case dnsfilter.FilteredSafeSearch:
safesearch.IncWithTime(entry.Time) </s> remove Result: result,
</s> add Result: *result, | https://github.com/AdguardTeam/AdGuardHome/commit/253d8a4016d66863ecee426b8f7d74841c4ed4de | dnsforward/querylog.go |
keep add keep keep keep keep | <mask> }
<mask>
<mask> now := time.Now()
<mask> entry := logEntry{
<mask> Question: q,
<mask> Answer: a,
</s> Pointer for dnsfilter.Result in querylog didn't make things simpler, revert that change and all related changes. </s> remove Result: result,
</s> add Result: *result, </s> remove switch entry.Result.Reason {
case dnsfilter.NotFilteredWhiteList:
whitelisted.IncWithTime(entry.Time)
case dnsfilter.NotFilteredError:
errorsTotal.IncWithTime(entry.Time)
case dnsfilter.FilteredBlackList:
filteredLists.IncWithTime(entry.Time)
case dnsfilter.FilteredSafeBrowsing:
filteredSafebrowsing.IncWithTime(entry.Time)
case dnsfilter.FilteredParental:
filteredParental.IncWithTime(entry.Time)
case dnsfilter.FilteredInvalid:
// do nothing
case dnsfilter.FilteredSafeSearch:
safesearch.IncWithTime(entry.Time)
}
</s> add switch entry.Result.Reason {
case dnsfilter.NotFilteredWhiteList:
whitelisted.IncWithTime(entry.Time)
case dnsfilter.NotFilteredError:
errorsTotal.IncWithTime(entry.Time)
case dnsfilter.FilteredBlackList:
filteredLists.IncWithTime(entry.Time)
case dnsfilter.FilteredSafeBrowsing:
filteredSafebrowsing.IncWithTime(entry.Time)
case dnsfilter.FilteredParental:
filteredParental.IncWithTime(entry.Time)
case dnsfilter.FilteredInvalid:
// do nothing
case dnsfilter.FilteredSafeSearch:
safesearch.IncWithTime(entry.Time) </s> remove if entry.Result != nil {
if entry.Result.IsFiltered {
filtered.IncWithTime(entry.Time)
}
</s> add if entry.Result.IsFiltered {
filtered.IncWithTime(entry.Time)
} </s> remove if entry.Result != nil && entry.Result.IsFiltered {
</s> add if entry.Result.IsFiltered { </s> remove Result *dnsfilter.Result
</s> add Result dnsfilter.Result | https://github.com/AdguardTeam/AdGuardHome/commit/253d8a4016d66863ecee426b8f7d74841c4ed4de | dnsforward/querylog.go |
keep keep keep keep replace keep keep keep keep keep | <mask> now := time.Now()
<mask> entry := logEntry{
<mask> Question: q,
<mask> Answer: a,
<mask> Result: result,
<mask> Time: now,
<mask> Elapsed: elapsed,
<mask> IP: ip,
<mask> Upstream: upstream,
<mask> }
</s> Pointer for dnsfilter.Result in querylog didn't make things simpler, revert that change and all related changes. </s> add if result == nil {
result = &dnsfilter.Result{}
}
</s> remove switch entry.Result.Reason {
case dnsfilter.NotFilteredWhiteList:
whitelisted.IncWithTime(entry.Time)
case dnsfilter.NotFilteredError:
errorsTotal.IncWithTime(entry.Time)
case dnsfilter.FilteredBlackList:
filteredLists.IncWithTime(entry.Time)
case dnsfilter.FilteredSafeBrowsing:
filteredSafebrowsing.IncWithTime(entry.Time)
case dnsfilter.FilteredParental:
filteredParental.IncWithTime(entry.Time)
case dnsfilter.FilteredInvalid:
// do nothing
case dnsfilter.FilteredSafeSearch:
safesearch.IncWithTime(entry.Time)
}
</s> add switch entry.Result.Reason {
case dnsfilter.NotFilteredWhiteList:
whitelisted.IncWithTime(entry.Time)
case dnsfilter.NotFilteredError:
errorsTotal.IncWithTime(entry.Time)
case dnsfilter.FilteredBlackList:
filteredLists.IncWithTime(entry.Time)
case dnsfilter.FilteredSafeBrowsing:
filteredSafebrowsing.IncWithTime(entry.Time)
case dnsfilter.FilteredParental:
filteredParental.IncWithTime(entry.Time)
case dnsfilter.FilteredInvalid:
// do nothing
case dnsfilter.FilteredSafeSearch:
safesearch.IncWithTime(entry.Time) </s> remove if entry.Result != nil {
if entry.Result.IsFiltered {
filtered.IncWithTime(entry.Time)
}
</s> add if entry.Result.IsFiltered {
filtered.IncWithTime(entry.Time)
} </s> remove if entry.Result != nil && entry.Result.IsFiltered {
</s> add if entry.Result.IsFiltered { </s> remove Result *dnsfilter.Result
</s> add Result dnsfilter.Result | https://github.com/AdguardTeam/AdGuardHome/commit/253d8a4016d66863ecee426b8f7d74841c4ed4de | dnsforward/querylog.go |
keep keep keep keep replace keep keep keep keep keep | <mask> log.Printf("Failed to increment value: %s", err)
<mask> return err
<mask> }
<mask>
<mask> if entry.Result != nil && entry.Result.IsFiltered {
<mask> err := runningTop.hours[hour].incrementBlocked(hostname)
<mask> if err != nil {
<mask> log.Printf("Failed to increment value: %s", err)
<mask> return err
<mask> }
</s> Pointer for dnsfilter.Result in querylog didn't make things simpler, revert that change and all related changes. </s> remove if entry.Result != nil {
if entry.Result.IsFiltered {
filtered.IncWithTime(entry.Time)
}
</s> add if entry.Result.IsFiltered {
filtered.IncWithTime(entry.Time)
} </s> add if result == nil {
result = &dnsfilter.Result{}
}
</s> remove switch entry.Result.Reason {
case dnsfilter.NotFilteredWhiteList:
whitelisted.IncWithTime(entry.Time)
case dnsfilter.NotFilteredError:
errorsTotal.IncWithTime(entry.Time)
case dnsfilter.FilteredBlackList:
filteredLists.IncWithTime(entry.Time)
case dnsfilter.FilteredSafeBrowsing:
filteredSafebrowsing.IncWithTime(entry.Time)
case dnsfilter.FilteredParental:
filteredParental.IncWithTime(entry.Time)
case dnsfilter.FilteredInvalid:
// do nothing
case dnsfilter.FilteredSafeSearch:
safesearch.IncWithTime(entry.Time)
}
</s> add switch entry.Result.Reason {
case dnsfilter.NotFilteredWhiteList:
whitelisted.IncWithTime(entry.Time)
case dnsfilter.NotFilteredError:
errorsTotal.IncWithTime(entry.Time)
case dnsfilter.FilteredBlackList:
filteredLists.IncWithTime(entry.Time)
case dnsfilter.FilteredSafeBrowsing:
filteredSafebrowsing.IncWithTime(entry.Time)
case dnsfilter.FilteredParental:
filteredParental.IncWithTime(entry.Time)
case dnsfilter.FilteredInvalid:
// do nothing
case dnsfilter.FilteredSafeSearch:
safesearch.IncWithTime(entry.Time) </s> remove Result *dnsfilter.Result
</s> add Result dnsfilter.Result </s> remove Result: result,
</s> add Result: *result, | https://github.com/AdguardTeam/AdGuardHome/commit/253d8a4016d66863ecee426b8f7d74841c4ed4de | dnsforward/querylog_top.go |
keep keep keep replace replace replace replace keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace | <mask> // -----
<mask> func incrementCounters(entry *logEntry) {
<mask> requests.IncWithTime(entry.Time)
<mask> if entry.Result != nil {
<mask> if entry.Result.IsFiltered {
<mask> filtered.IncWithTime(entry.Time)
<mask> }
<mask>
<mask> switch entry.Result.Reason {
<mask> case dnsfilter.NotFilteredWhiteList:
<mask> whitelisted.IncWithTime(entry.Time)
<mask> case dnsfilter.NotFilteredError:
<mask> errorsTotal.IncWithTime(entry.Time)
<mask> case dnsfilter.FilteredBlackList:
<mask> filteredLists.IncWithTime(entry.Time)
<mask> case dnsfilter.FilteredSafeBrowsing:
<mask> filteredSafebrowsing.IncWithTime(entry.Time)
<mask> case dnsfilter.FilteredParental:
<mask> filteredParental.IncWithTime(entry.Time)
<mask> case dnsfilter.FilteredInvalid:
<mask> // do nothing
<mask> case dnsfilter.FilteredSafeSearch:
<mask> safesearch.IncWithTime(entry.Time)
<mask> }
</s> Pointer for dnsfilter.Result in querylog didn't make things simpler, revert that change and all related changes. </s> remove if entry.Result != nil && entry.Result.IsFiltered {
</s> add if entry.Result.IsFiltered { </s> add if result == nil {
result = &dnsfilter.Result{}
}
</s> remove Result *dnsfilter.Result
</s> add Result dnsfilter.Result </s> remove Result: result,
</s> add Result: *result, | https://github.com/AdguardTeam/AdGuardHome/commit/253d8a4016d66863ecee426b8f7d74841c4ed4de | dnsforward/stats.go |
keep keep keep add keep keep keep keep keep | <mask> import (
<mask> "context"
<mask> "encoding/json"
<mask> "fmt"
<mask> "net"
<mask> "net/http"
<mask> "os"
<mask> "os/exec"
<mask> "path/filepath"
</s> - install: fix DNS nameserver issue after we disable DNSStubListener on Ubuntu </s> add "os" </s> add "path/filepath" </s> remove cmd = exec.Command("systemctl", "reload-or-restart", "systemd-resolved")
</s> add cmd := exec.Command("systemctl", "reload-or-restart", "systemd-resolved") </s> remove if cmd.ProcessState.ExitCode() != 0 {
return fmt.Errorf("process %s exited with an error: %d",
cmd.Path, cmd.ProcessState.ExitCode())
</s> add err = ioutil.WriteFile(resolvedConfPath, []byte(resolvedConfData), 0644)
if err != nil {
return fmt.Errorf("ioutil.WriteFile: %s: %s", resolvedConfPath, err)
}
_ = os.Rename(resolvConfPath, resolvConfPath+".backup")
err = os.Symlink("/run/systemd/resolve/resolv.conf", resolvConfPath)
if err != nil {
_ = os.Remove(resolvedConfPath) // remove the file we've just created
return fmt.Errorf("os.Symlink: %s: %s", resolvConfPath, err) </s> remove return err
</s> add return fmt.Errorf("os.MkdirAll: %s: %s", dir, err) </s> remove cmd := exec.Command("sed", "-r", "-i.orig", "s/#?DNSStubListener=yes/DNSStubListener=no/g", "/etc/systemd/resolved.conf")
log.Tracef("executing %s %v", cmd.Path, cmd.Args)
_, err := cmd.Output()
</s> add dir := filepath.Dir(resolvedConfPath)
err := os.MkdirAll(dir, 0755) | https://github.com/AdguardTeam/AdGuardHome/commit/254cab3a2310e5f6af2994527fccdac3ea74143c | home/control_install.go |
keep keep keep add keep keep keep keep | <mask> "fmt"
<mask> "io/ioutil"
<mask> "net"
<mask> "net/http"
<mask> "os/exec"
<mask> "path/filepath"
<mask> "runtime"
<mask> "strconv"
</s> - install: fix DNS nameserver issue after we disable DNSStubListener on Ubuntu </s> add "io/ioutil" </s> add "path/filepath" </s> remove cmd = exec.Command("systemctl", "reload-or-restart", "systemd-resolved")
</s> add cmd := exec.Command("systemctl", "reload-or-restart", "systemd-resolved") </s> remove if cmd.ProcessState.ExitCode() != 0 {
return fmt.Errorf("process %s exited with an error: %d",
cmd.Path, cmd.ProcessState.ExitCode())
</s> add err = ioutil.WriteFile(resolvedConfPath, []byte(resolvedConfData), 0644)
if err != nil {
return fmt.Errorf("ioutil.WriteFile: %s: %s", resolvedConfPath, err)
}
_ = os.Rename(resolvConfPath, resolvConfPath+".backup")
err = os.Symlink("/run/systemd/resolve/resolv.conf", resolvConfPath)
if err != nil {
_ = os.Remove(resolvedConfPath) // remove the file we've just created
return fmt.Errorf("os.Symlink: %s: %s", resolvConfPath, err) </s> remove return err
</s> add return fmt.Errorf("os.MkdirAll: %s: %s", dir, err) </s> remove cmd := exec.Command("sed", "-r", "-i.orig", "s/#?DNSStubListener=yes/DNSStubListener=no/g", "/etc/systemd/resolved.conf")
log.Tracef("executing %s %v", cmd.Path, cmd.Args)
_, err := cmd.Output()
</s> add dir := filepath.Dir(resolvedConfPath)
err := os.MkdirAll(dir, 0755) | https://github.com/AdguardTeam/AdGuardHome/commit/254cab3a2310e5f6af2994527fccdac3ea74143c | home/control_install.go |
keep add keep keep keep keep keep keep | <mask> "os"
<mask> "os/exec"
<mask> "runtime"
<mask> "strconv"
<mask>
<mask> "github.com/AdguardTeam/golibs/log"
<mask> )
<mask>
</s> - install: fix DNS nameserver issue after we disable DNSStubListener on Ubuntu </s> add "os" </s> add "io/ioutil" </s> remove cmd = exec.Command("systemctl", "reload-or-restart", "systemd-resolved")
</s> add cmd := exec.Command("systemctl", "reload-or-restart", "systemd-resolved") </s> remove if cmd.ProcessState.ExitCode() != 0 {
return fmt.Errorf("process %s exited with an error: %d",
cmd.Path, cmd.ProcessState.ExitCode())
</s> add err = ioutil.WriteFile(resolvedConfPath, []byte(resolvedConfData), 0644)
if err != nil {
return fmt.Errorf("ioutil.WriteFile: %s: %s", resolvedConfPath, err)
}
_ = os.Rename(resolvConfPath, resolvConfPath+".backup")
err = os.Symlink("/run/systemd/resolve/resolv.conf", resolvConfPath)
if err != nil {
_ = os.Remove(resolvedConfPath) // remove the file we've just created
return fmt.Errorf("os.Symlink: %s: %s", resolvConfPath, err) </s> remove return err
</s> add return fmt.Errorf("os.MkdirAll: %s: %s", dir, err) </s> remove cmd := exec.Command("sed", "-r", "-i.orig", "s/#?DNSStubListener=yes/DNSStubListener=no/g", "/etc/systemd/resolved.conf")
log.Tracef("executing %s %v", cmd.Path, cmd.Args)
_, err := cmd.Output()
</s> add dir := filepath.Dir(resolvedConfPath)
err := os.MkdirAll(dir, 0755) | https://github.com/AdguardTeam/AdGuardHome/commit/254cab3a2310e5f6af2994527fccdac3ea74143c | home/control_install.go |
keep add keep keep keep keep keep | <mask> }
<mask>
<mask> // Deactivate DNSStubListener
<mask> func disableDNSStubListener() error {
<mask> dir := filepath.Dir(resolvedConfPath)
<mask> err := os.MkdirAll(dir, 0755)
<mask> if err != nil {
</s> - install: fix DNS nameserver issue after we disable DNSStubListener on Ubuntu </s> remove cmd := exec.Command("sed", "-r", "-i.orig", "s/#?DNSStubListener=yes/DNSStubListener=no/g", "/etc/systemd/resolved.conf")
log.Tracef("executing %s %v", cmd.Path, cmd.Args)
_, err := cmd.Output()
</s> add dir := filepath.Dir(resolvedConfPath)
err := os.MkdirAll(dir, 0755) </s> remove if cmd.ProcessState.ExitCode() != 0 {
return fmt.Errorf("process %s exited with an error: %d",
cmd.Path, cmd.ProcessState.ExitCode())
</s> add err = ioutil.WriteFile(resolvedConfPath, []byte(resolvedConfData), 0644)
if err != nil {
return fmt.Errorf("ioutil.WriteFile: %s: %s", resolvedConfPath, err)
}
_ = os.Rename(resolvConfPath, resolvConfPath+".backup")
err = os.Symlink("/run/systemd/resolve/resolv.conf", resolvConfPath)
if err != nil {
_ = os.Remove(resolvedConfPath) // remove the file we've just created
return fmt.Errorf("os.Symlink: %s: %s", resolvConfPath, err) </s> remove return err
</s> add return fmt.Errorf("os.MkdirAll: %s: %s", dir, err) </s> remove cmd = exec.Command("systemctl", "reload-or-restart", "systemd-resolved")
</s> add cmd := exec.Command("systemctl", "reload-or-restart", "systemd-resolved") </s> add "path/filepath" </s> add "os" | https://github.com/AdguardTeam/AdGuardHome/commit/254cab3a2310e5f6af2994527fccdac3ea74143c | home/control_install.go |
keep keep keep replace replace replace keep replace | <mask>
<mask> // Deactivate DNSStubListener
<mask> func disableDNSStubListener() error {
<mask> cmd := exec.Command("sed", "-r", "-i.orig", "s/#?DNSStubListener=yes/DNSStubListener=no/g", "/etc/systemd/resolved.conf")
<mask> log.Tracef("executing %s %v", cmd.Path, cmd.Args)
<mask> _, err := cmd.Output()
<mask> if err != nil {
<mask> return err
</s> - install: fix DNS nameserver issue after we disable DNSStubListener on Ubuntu </s> add const resolvedConfPath = "/etc/systemd/resolved.conf.d/adguardhome.conf"
const resolvedConfData = `[Resolve]
DNS=127.0.0.1
DNSStubListener=no
`
const resolvConfPath = "/etc/resolv.conf"
</s> remove if cmd.ProcessState.ExitCode() != 0 {
return fmt.Errorf("process %s exited with an error: %d",
cmd.Path, cmd.ProcessState.ExitCode())
</s> add err = ioutil.WriteFile(resolvedConfPath, []byte(resolvedConfData), 0644)
if err != nil {
return fmt.Errorf("ioutil.WriteFile: %s: %s", resolvedConfPath, err)
}
_ = os.Rename(resolvConfPath, resolvConfPath+".backup")
err = os.Symlink("/run/systemd/resolve/resolv.conf", resolvConfPath)
if err != nil {
_ = os.Remove(resolvedConfPath) // remove the file we've just created
return fmt.Errorf("os.Symlink: %s: %s", resolvConfPath, err) </s> remove cmd = exec.Command("systemctl", "reload-or-restart", "systemd-resolved")
</s> add cmd := exec.Command("systemctl", "reload-or-restart", "systemd-resolved") </s> add "path/filepath" </s> add "os" | https://github.com/AdguardTeam/AdGuardHome/commit/254cab3a2310e5f6af2994527fccdac3ea74143c | home/control_install.go |
keep keep keep keep replace replace replace keep keep replace keep keep keep | <mask> _, err := cmd.Output()
<mask> if err != nil {
<mask> return err
<mask> }
<mask> if cmd.ProcessState.ExitCode() != 0 {
<mask> return fmt.Errorf("process %s exited with an error: %d",
<mask> cmd.Path, cmd.ProcessState.ExitCode())
<mask> }
<mask>
<mask> cmd = exec.Command("systemctl", "reload-or-restart", "systemd-resolved")
<mask> log.Tracef("executing %s %v", cmd.Path, cmd.Args)
<mask> _, err = cmd.Output()
<mask> if err != nil {
</s> - install: fix DNS nameserver issue after we disable DNSStubListener on Ubuntu </s> remove return err
</s> add return fmt.Errorf("os.MkdirAll: %s: %s", dir, err) </s> add const resolvedConfPath = "/etc/systemd/resolved.conf.d/adguardhome.conf"
const resolvedConfData = `[Resolve]
DNS=127.0.0.1
DNSStubListener=no
`
const resolvConfPath = "/etc/resolv.conf"
</s> remove cmd := exec.Command("sed", "-r", "-i.orig", "s/#?DNSStubListener=yes/DNSStubListener=no/g", "/etc/systemd/resolved.conf")
log.Tracef("executing %s %v", cmd.Path, cmd.Args)
_, err := cmd.Output()
</s> add dir := filepath.Dir(resolvedConfPath)
err := os.MkdirAll(dir, 0755) </s> add "path/filepath" </s> add "os" | https://github.com/AdguardTeam/AdGuardHome/commit/254cab3a2310e5f6af2994527fccdac3ea74143c | home/control_install.go |
keep keep keep keep replace keep keep replace replace replace replace keep | <mask> if ip = net.ParseIP(fields[0]); ip == nil {
<mask> return nil, nil
<mask> }
<mask>
<mask> loop:
<mask> for _, f := range fields[1:] {
<mask> switch hashIdx := strings.IndexByte(f, '#'); hashIdx {
<mask> case 0:
<mask> // The rest of the fields are a part of the comment so skip
<mask> // immediately.
<mask> break loop
<mask> case -1:
</s> Pull request: all: get rid of labels
Merge in DNS/adguard-home from rm-labels to master
Squashed commit of the following:
commit 5e3688ed92b0f76a47078a55bc22c401422c914c
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:46:50 2021 +0300
all: imp code, docs
commit 123d1ec52d0037315e8de94ab5a26b48cf0bf984
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:14:05 2021 +0300
all: get rid of labels </s> add continue
case 0:
// Go on. </s> add // The rest of the fields are a part of the comment so skip
// immediately.
break </s> remove
break loop
</s> add </s> add // intIn returns true if nums contains n.
func intIn(n int, nums []int) (ok bool) {
for _, nn := range nums {
if n == nn {
return true
}
}
return false
}
</s> remove if aerr != nil || cur < 0 {
</s> add if aerr != nil || cur < 0 || intIn(cur, ignore) { | https://github.com/AdguardTeam/AdGuardHome/commit/25fd34c51459d9b3b9d5fde4060902228a5569ec | internal/aghnet/hostscontainer.go |
keep keep keep add keep keep keep keep keep | <mask> for _, f := range fields[1:] {
<mask> switch hashIdx := strings.IndexByte(f, '#'); hashIdx {
<mask> case -1:
<mask> hosts = append(hosts, f)
<mask> default:
<mask> // Only a part of the field is a comment.
<mask> hosts = append(hosts, f[:hashIdx])
<mask> }
<mask>
</s> Pull request: all: get rid of labels
Merge in DNS/adguard-home from rm-labels to master
Squashed commit of the following:
commit 5e3688ed92b0f76a47078a55bc22c401422c914c
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:46:50 2021 +0300
all: imp code, docs
commit 123d1ec52d0037315e8de94ab5a26b48cf0bf984
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:14:05 2021 +0300
all: get rid of labels </s> remove case 0:
// The rest of the fields are a part of the comment so skip
// immediately.
break loop
</s> add </s> remove
break loop
</s> add </s> remove loop:
</s> add </s> add // The rest of the fields are a part of the comment so skip
// immediately.
break </s> remove for _, pid := range ignore {
if cur == pid {
continue ScanLoop
}
}
</s> add </s> add // intIn returns true if nums contains n.
func intIn(n int, nums []int) (ok bool) {
for _, nn := range nums {
if n == nn {
return true
}
}
return false
}
| https://github.com/AdguardTeam/AdGuardHome/commit/25fd34c51459d9b3b9d5fde4060902228a5569ec | internal/aghnet/hostscontainer.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> hosts = append(hosts, f)
<mask> default:
<mask> // Only a part of the field is a comment.
<mask> hosts = append(hosts, f[:hashIdx])
<mask>
<mask> break loop
<mask> }
<mask> }
<mask>
<mask> return ip, hosts
<mask> }
</s> Pull request: all: get rid of labels
Merge in DNS/adguard-home from rm-labels to master
Squashed commit of the following:
commit 5e3688ed92b0f76a47078a55bc22c401422c914c
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:46:50 2021 +0300
all: imp code, docs
commit 123d1ec52d0037315e8de94ab5a26b48cf0bf984
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:14:05 2021 +0300
all: get rid of labels </s> add // The rest of the fields are a part of the comment so skip
// immediately.
break </s> remove case 0:
// The rest of the fields are a part of the comment so skip
// immediately.
break loop
</s> add </s> add continue
case 0:
// Go on. </s> remove loop:
</s> add </s> add // intIn returns true if nums contains n.
func intIn(n int, nums []int) (ok bool) {
for _, nn := range nums {
if n == nn {
return true
}
}
return false
}
</s> remove pid, instNum, err = parsePSOutput(stdout, command, except...)
</s> add pid, instNum, err = parsePSOutput(stdout, command, except) | https://github.com/AdguardTeam/AdGuardHome/commit/25fd34c51459d9b3b9d5fde4060902228a5569ec | internal/aghnet/hostscontainer.go |
keep keep keep add keep keep keep keep keep keep | <mask> default:
<mask> // Only a part of the field is a comment.
<mask> hosts = append(hosts, f[:hashIdx])
<mask> }
<mask> }
<mask>
<mask> return ip, hosts
<mask> }
<mask>
<mask> // Simple types of hosts in hosts database. Zero value isn't used to be able
</s> Pull request: all: get rid of labels
Merge in DNS/adguard-home from rm-labels to master
Squashed commit of the following:
commit 5e3688ed92b0f76a47078a55bc22c401422c914c
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:46:50 2021 +0300
all: imp code, docs
commit 123d1ec52d0037315e8de94ab5a26b48cf0bf984
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:14:05 2021 +0300
all: get rid of labels </s> remove
break loop
</s> add </s> add continue
case 0:
// Go on. </s> remove case 0:
// The rest of the fields are a part of the comment so skip
// immediately.
break loop
</s> add </s> remove loop:
</s> add </s> add // intIn returns true if nums contains n.
func intIn(n int, nums []int) (ok bool) {
for _, nn := range nums {
if n == nn {
return true
}
}
return false
}
</s> remove pid, instNum, err = parsePSOutput(stdout, command, except...)
</s> add pid, instNum, err = parsePSOutput(stdout, command, except) | https://github.com/AdguardTeam/AdGuardHome/commit/25fd34c51459d9b3b9d5fde4060902228a5569ec | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask> return 0, fmt.Errorf("start command executing: %w", err)
<mask> }
<mask>
<mask> var instNum int
<mask> pid, instNum, err = parsePSOutput(stdout, command, except...)
<mask> if err != nil {
<mask> return 0, err
<mask> }
<mask>
<mask> if err = cmd.Wait(); err != nil {
</s> Pull request: all: get rid of labels
Merge in DNS/adguard-home from rm-labels to master
Squashed commit of the following:
commit 5e3688ed92b0f76a47078a55bc22c401422c914c
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:46:50 2021 +0300
all: imp code, docs
commit 123d1ec52d0037315e8de94ab5a26b48cf0bf984
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:14:05 2021 +0300
all: get rid of labels </s> remove _, _, err = parsePSOutput(lr, "")
</s> add _, _, err = parsePSOutput(lr, "", nil) </s> remove pid, instNum, err := parsePSOutput(r, comm)
</s> add pid, instNum, err := parsePSOutput(r, comm, nil) </s> add // intIn returns true if nums contains n.
func intIn(n int, nums []int) (ok bool) {
for _, nn := range nums {
if n == nn {
return true
}
}
return false
}
</s> remove ScanLoop:
</s> add </s> remove for _, pid := range ignore {
if cur == pid {
continue ScanLoop
}
}
</s> add </s> remove func parsePSOutput(r io.Reader, cmdName string, ignore ...int) (largest, instNum int, err error) {
</s> add func parsePSOutput(r io.Reader, cmdName string, ignore []int) (largest, instNum int, err error) { | https://github.com/AdguardTeam/AdGuardHome/commit/25fd34c51459d9b3b9d5fde4060902228a5569ec | internal/aghos/os.go |
keep replace keep replace keep keep keep keep | <mask> //
<mask> func parsePSOutput(r io.Reader, cmdName string, ignore ...int) (largest, instNum int, err error) {
<mask> s := bufio.NewScanner(r)
<mask> ScanLoop:
<mask> for s.Scan() {
<mask> fields := strings.Fields(s.Text())
<mask> if len(fields) != 2 || path.Base(fields[1]) != cmdName {
<mask> continue
</s> Pull request: all: get rid of labels
Merge in DNS/adguard-home from rm-labels to master
Squashed commit of the following:
commit 5e3688ed92b0f76a47078a55bc22c401422c914c
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:46:50 2021 +0300
all: imp code, docs
commit 123d1ec52d0037315e8de94ab5a26b48cf0bf984
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:14:05 2021 +0300
all: get rid of labels </s> remove if aerr != nil || cur < 0 {
</s> add if aerr != nil || cur < 0 || intIn(cur, ignore) { </s> remove for _, pid := range ignore {
if cur == pid {
continue ScanLoop
}
}
</s> add </s> add // intIn returns true if nums contains n.
func intIn(n int, nums []int) (ok bool) {
for _, nn := range nums {
if n == nn {
return true
}
}
return false
}
</s> remove pid, instNum, err = parsePSOutput(stdout, command, except...)
</s> add pid, instNum, err = parsePSOutput(stdout, command, except) </s> add continue
case 0:
// Go on. | https://github.com/AdguardTeam/AdGuardHome/commit/25fd34c51459d9b3b9d5fde4060902228a5569ec | internal/aghos/os.go |
keep keep replace keep keep keep replace replace replace replace replace replace keep keep | <mask>
<mask> cur, aerr := strconv.Atoi(fields[0])
<mask> if aerr != nil || cur < 0 {
<mask> continue
<mask> }
<mask>
<mask> for _, pid := range ignore {
<mask> if cur == pid {
<mask> continue ScanLoop
<mask> }
<mask> }
<mask>
<mask> instNum++
<mask> if cur > largest {
</s> Pull request: all: get rid of labels
Merge in DNS/adguard-home from rm-labels to master
Squashed commit of the following:
commit 5e3688ed92b0f76a47078a55bc22c401422c914c
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:46:50 2021 +0300
all: imp code, docs
commit 123d1ec52d0037315e8de94ab5a26b48cf0bf984
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:14:05 2021 +0300
all: get rid of labels </s> remove ScanLoop:
</s> add </s> add // intIn returns true if nums contains n.
func intIn(n int, nums []int) (ok bool) {
for _, nn := range nums {
if n == nn {
return true
}
}
return false
}
</s> remove loop:
</s> add </s> add continue
case 0:
// Go on. </s> remove func parsePSOutput(r io.Reader, cmdName string, ignore ...int) (largest, instNum int, err error) {
</s> add func parsePSOutput(r io.Reader, cmdName string, ignore []int) (largest, instNum int, err error) { | https://github.com/AdguardTeam/AdGuardHome/commit/25fd34c51459d9b3b9d5fde4060902228a5569ec | internal/aghos/os.go |
keep keep keep add keep keep keep keep | <mask>
<mask> return largest, instNum, nil
<mask> }
<mask>
<mask> // IsOpenWrt returns true if host OS is OpenWrt.
<mask> func IsOpenWrt() (ok bool) {
<mask> return isOpenWrt()
<mask> }
</s> Pull request: all: get rid of labels
Merge in DNS/adguard-home from rm-labels to master
Squashed commit of the following:
commit 5e3688ed92b0f76a47078a55bc22c401422c914c
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:46:50 2021 +0300
all: imp code, docs
commit 123d1ec52d0037315e8de94ab5a26b48cf0bf984
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:14:05 2021 +0300
all: get rid of labels </s> remove pid, instNum, err = parsePSOutput(stdout, command, except...)
</s> add pid, instNum, err = parsePSOutput(stdout, command, except) </s> remove
break loop
</s> add </s> remove loop:
</s> add </s> add // The rest of the fields are a part of the comment so skip
// immediately.
break </s> remove ScanLoop:
</s> add </s> remove func parsePSOutput(r io.Reader, cmdName string, ignore ...int) (largest, instNum int, err error) {
</s> add func parsePSOutput(r io.Reader, cmdName string, ignore []int) (largest, instNum int, err error) { | https://github.com/AdguardTeam/AdGuardHome/commit/25fd34c51459d9b3b9d5fde4060902228a5569ec | internal/aghos/os.go |
keep keep keep keep replace keep keep keep keep keep | <mask> for _, tc := range testCases {
<mask> r := bytes.NewReader(tc.data)
<mask>
<mask> t.Run(tc.name, func(t *testing.T) {
<mask> pid, instNum, err := parsePSOutput(r, comm)
<mask> require.NoError(t, err)
<mask>
<mask> assert.Equal(t, tc.wantPID, pid)
<mask> assert.Equal(t, tc.wantInstNum, instNum)
<mask> })
</s> Pull request: all: get rid of labels
Merge in DNS/adguard-home from rm-labels to master
Squashed commit of the following:
commit 5e3688ed92b0f76a47078a55bc22c401422c914c
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:46:50 2021 +0300
all: imp code, docs
commit 123d1ec52d0037315e8de94ab5a26b48cf0bf984
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:14:05 2021 +0300
all: get rid of labels </s> remove pid, instances, err := parsePSOutput(r, comm, 1, 3)
</s> add pid, instances, err := parsePSOutput(r, comm, []int{1, 3}) </s> remove _, _, err = parsePSOutput(lr, "")
</s> add _, _, err = parsePSOutput(lr, "", nil) </s> remove pid, instNum, err = parsePSOutput(stdout, command, except...)
</s> add pid, instNum, err = parsePSOutput(stdout, command, except) </s> add // intIn returns true if nums contains n.
func intIn(n int, nums []int) (ok bool) {
for _, nn := range nums {
if n == nn {
return true
}
}
return false
}
</s> remove if aerr != nil || cur < 0 {
</s> add if aerr != nil || cur < 0 || intIn(cur, ignore) { </s> remove ScanLoop:
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/25fd34c51459d9b3b9d5fde4060902228a5569ec | internal/aghos/os_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> lr, err := aghio.LimitReader(bytes.NewReader([]byte{1, 2, 3}), 0)
<mask> require.NoError(t, err)
<mask>
<mask> target := &aghio.LimitReachedError{}
<mask> _, _, err = parsePSOutput(lr, "")
<mask> require.ErrorAs(t, err, &target)
<mask>
<mask> assert.EqualValues(t, 0, target.Limit)
<mask> })
<mask>
</s> Pull request: all: get rid of labels
Merge in DNS/adguard-home from rm-labels to master
Squashed commit of the following:
commit 5e3688ed92b0f76a47078a55bc22c401422c914c
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:46:50 2021 +0300
all: imp code, docs
commit 123d1ec52d0037315e8de94ab5a26b48cf0bf984
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:14:05 2021 +0300
all: get rid of labels </s> remove pid, instances, err := parsePSOutput(r, comm, 1, 3)
</s> add pid, instances, err := parsePSOutput(r, comm, []int{1, 3}) </s> remove pid, instNum, err := parsePSOutput(r, comm)
</s> add pid, instNum, err := parsePSOutput(r, comm, nil) </s> remove pid, instNum, err = parsePSOutput(stdout, command, except...)
</s> add pid, instNum, err = parsePSOutput(stdout, command, except) </s> add continue
case 0:
// Go on. </s> remove loop:
</s> add </s> remove case 0:
// The rest of the fields are a part of the comment so skip
// immediately.
break loop
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/25fd34c51459d9b3b9d5fde4060902228a5569ec | internal/aghos/os_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> `2 ` + comm + nl +
<mask> `3` + comm + nl,
<mask> ))
<mask>
<mask> pid, instances, err := parsePSOutput(r, comm, 1, 3)
<mask> require.NoError(t, err)
<mask>
<mask> assert.Equal(t, 2, pid)
<mask> assert.Equal(t, 1, instances)
<mask> })
</s> Pull request: all: get rid of labels
Merge in DNS/adguard-home from rm-labels to master
Squashed commit of the following:
commit 5e3688ed92b0f76a47078a55bc22c401422c914c
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:46:50 2021 +0300
all: imp code, docs
commit 123d1ec52d0037315e8de94ab5a26b48cf0bf984
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 9 17:14:05 2021 +0300
all: get rid of labels </s> remove pid, instNum, err := parsePSOutput(r, comm)
</s> add pid, instNum, err := parsePSOutput(r, comm, nil) </s> remove _, _, err = parsePSOutput(lr, "")
</s> add _, _, err = parsePSOutput(lr, "", nil) </s> remove pid, instNum, err = parsePSOutput(stdout, command, except...)
</s> add pid, instNum, err = parsePSOutput(stdout, command, except) </s> remove ScanLoop:
</s> add </s> remove func parsePSOutput(r io.Reader, cmdName string, ignore ...int) (largest, instNum int, err error) {
</s> add func parsePSOutput(r io.Reader, cmdName string, ignore []int) (largest, instNum int, err error) { </s> remove if aerr != nil || cur < 0 {
</s> add if aerr != nil || cur < 0 || intIn(cur, ignore) { | https://github.com/AdguardTeam/AdGuardHome/commit/25fd34c51459d9b3b9d5fde4060902228a5569ec | internal/aghos/os_test.go |
keep keep keep keep replace replace keep | <mask> }
<mask>
<mask> // registerBlockedServicesHandlers - register HTTP handlers
<mask> func (d *DNSFilter) registerBlockedServicesHandlers() {
<mask> d.Config.HTTPRegister("GET", "/control/blocked_services/list", d.handleBlockedServicesList)
<mask> d.Config.HTTPRegister("POST", "/control/blocked_services/set", d.handleBlockedServicesSet)
<mask> }
</s> Pull request: all: use http method constants
Merge in DNS/adguard-home from method-const to master
Squashed commit of the following:
commit ae6d6699a25ca04ba92aa53258d46e50233a9e00
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 22:03:59 2021 +0300
all: use http method constants </s> remove d.Config.HTTPRegister("GET", "/control/rewrite/list", d.handleRewriteList)
d.Config.HTTPRegister("POST", "/control/rewrite/add", d.handleRewriteAdd)
d.Config.HTTPRegister("POST", "/control/rewrite/delete", d.handleRewriteDelete)
</s> add d.Config.HTTPRegister(http.MethodGet, "/control/rewrite/list", d.handleRewriteList)
d.Config.HTTPRegister(http.MethodPost, "/control/rewrite/add", d.handleRewriteAdd)
d.Config.HTTPRegister(http.MethodPost, "/control/rewrite/delete", d.handleRewriteDelete) </s> remove d.Config.HTTPRegister("POST", "/control/safebrowsing/enable", d.handleSafeBrowsingEnable)
d.Config.HTTPRegister("POST", "/control/safebrowsing/disable", d.handleSafeBrowsingDisable)
d.Config.HTTPRegister("GET", "/control/safebrowsing/status", d.handleSafeBrowsingStatus)
</s> add d.Config.HTTPRegister(http.MethodPost, "/control/safebrowsing/enable", d.handleSafeBrowsingEnable)
d.Config.HTTPRegister(http.MethodPost, "/control/safebrowsing/disable", d.handleSafeBrowsingDisable)
d.Config.HTTPRegister(http.MethodGet, "/control/safebrowsing/status", d.handleSafeBrowsingStatus) </s> remove httpRegister("GET", "/control/filtering/status", f.handleFilteringStatus)
httpRegister("POST", "/control/filtering/config", f.handleFilteringConfig)
httpRegister("POST", "/control/filtering/add_url", f.handleFilteringAddURL)
httpRegister("POST", "/control/filtering/remove_url", f.handleFilteringRemoveURL)
httpRegister("POST", "/control/filtering/set_url", f.handleFilteringSetURL)
httpRegister("POST", "/control/filtering/refresh", f.handleFilteringRefresh)
httpRegister("POST", "/control/filtering/set_rules", f.handleFilteringSetRules)
httpRegister("GET", "/control/filtering/check_host", f.handleCheckHost)
</s> add httpRegister(http.MethodGet, "/control/filtering/status", f.handleFilteringStatus)
httpRegister(http.MethodPost, "/control/filtering/config", f.handleFilteringConfig)
httpRegister(http.MethodPost, "/control/filtering/add_url", f.handleFilteringAddURL)
httpRegister(http.MethodPost, "/control/filtering/remove_url", f.handleFilteringRemoveURL)
httpRegister(http.MethodPost, "/control/filtering/set_url", f.handleFilteringSetURL)
httpRegister(http.MethodPost, "/control/filtering/refresh", f.handleFilteringRefresh)
httpRegister(http.MethodPost, "/control/filtering/set_rules", f.handleFilteringSetRules)
httpRegister(http.MethodGet, "/control/filtering/check_host", f.handleCheckHost) </s> remove httpRegister("GET", "/control/tls/status", t.handleTLSStatus)
httpRegister("POST", "/control/tls/configure", t.handleTLSConfigure)
httpRegister("POST", "/control/tls/validate", t.handleTLSValidate)
</s> add httpRegister(http.MethodGet, "/control/tls/status", t.handleTLSStatus)
httpRegister(http.MethodPost, "/control/tls/configure", t.handleTLSConfigure)
httpRegister(http.MethodPost, "/control/tls/validate", t.handleTLSValidate) </s> remove httpRegister("GET", "/control/clients", clients.handleGetClients)
httpRegister("POST", "/control/clients/add", clients.handleAddClient)
httpRegister("POST", "/control/clients/delete", clients.handleDelClient)
httpRegister("POST", "/control/clients/update", clients.handleUpdateClient)
httpRegister("GET", "/control/clients/find", clients.handleFindClient)
</s> add httpRegister(http.MethodGet, "/control/clients", clients.handleGetClients)
httpRegister(http.MethodPost, "/control/clients/add", clients.handleAddClient)
httpRegister(http.MethodPost, "/control/clients/delete", clients.handleDelClient)
httpRegister(http.MethodPost, "/control/clients/update", clients.handleUpdateClient)
httpRegister(http.MethodGet, "/control/clients/find", clients.handleFindClient) </s> remove l.conf.HTTPRegister("GET", "/control/querylog", l.handleQueryLog)
l.conf.HTTPRegister("GET", "/control/querylog_info", l.handleQueryLogInfo)
l.conf.HTTPRegister("POST", "/control/querylog_clear", l.handleQueryLogClear)
l.conf.HTTPRegister("POST", "/control/querylog_config", l.handleQueryLogConfig)
</s> add l.conf.HTTPRegister(http.MethodGet, "/control/querylog", l.handleQueryLog)
l.conf.HTTPRegister(http.MethodGet, "/control/querylog_info", l.handleQueryLogInfo)
l.conf.HTTPRegister(http.MethodPost, "/control/querylog_clear", l.handleQueryLogClear)
l.conf.HTTPRegister(http.MethodPost, "/control/querylog_config", l.handleQueryLogConfig) | https://github.com/AdguardTeam/AdGuardHome/commit/2638e271fed1937ceafaefeefe8086cb249eaf72 | internal/dnsfilter/blocked.go |
keep keep keep keep replace replace replace keep | <mask> d.Config.ConfigModified()
<mask> }
<mask>
<mask> func (d *DNSFilter) registerRewritesHandlers() {
<mask> d.Config.HTTPRegister("GET", "/control/rewrite/list", d.handleRewriteList)
<mask> d.Config.HTTPRegister("POST", "/control/rewrite/add", d.handleRewriteAdd)
<mask> d.Config.HTTPRegister("POST", "/control/rewrite/delete", d.handleRewriteDelete)
<mask> }
</s> Pull request: all: use http method constants
Merge in DNS/adguard-home from method-const to master
Squashed commit of the following:
commit ae6d6699a25ca04ba92aa53258d46e50233a9e00
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 22:03:59 2021 +0300
all: use http method constants </s> remove d.Config.HTTPRegister("GET", "/control/blocked_services/list", d.handleBlockedServicesList)
d.Config.HTTPRegister("POST", "/control/blocked_services/set", d.handleBlockedServicesSet)
</s> add d.Config.HTTPRegister(http.MethodGet, "/control/blocked_services/list", d.handleBlockedServicesList)
d.Config.HTTPRegister(http.MethodPost, "/control/blocked_services/set", d.handleBlockedServicesSet) </s> remove d.Config.HTTPRegister("POST", "/control/safebrowsing/enable", d.handleSafeBrowsingEnable)
d.Config.HTTPRegister("POST", "/control/safebrowsing/disable", d.handleSafeBrowsingDisable)
d.Config.HTTPRegister("GET", "/control/safebrowsing/status", d.handleSafeBrowsingStatus)
</s> add d.Config.HTTPRegister(http.MethodPost, "/control/safebrowsing/enable", d.handleSafeBrowsingEnable)
d.Config.HTTPRegister(http.MethodPost, "/control/safebrowsing/disable", d.handleSafeBrowsingDisable)
d.Config.HTTPRegister(http.MethodGet, "/control/safebrowsing/status", d.handleSafeBrowsingStatus) </s> remove l.conf.HTTPRegister("GET", "/control/querylog", l.handleQueryLog)
l.conf.HTTPRegister("GET", "/control/querylog_info", l.handleQueryLogInfo)
l.conf.HTTPRegister("POST", "/control/querylog_clear", l.handleQueryLogClear)
l.conf.HTTPRegister("POST", "/control/querylog_config", l.handleQueryLogConfig)
</s> add l.conf.HTTPRegister(http.MethodGet, "/control/querylog", l.handleQueryLog)
l.conf.HTTPRegister(http.MethodGet, "/control/querylog_info", l.handleQueryLogInfo)
l.conf.HTTPRegister(http.MethodPost, "/control/querylog_clear", l.handleQueryLogClear)
l.conf.HTTPRegister(http.MethodPost, "/control/querylog_config", l.handleQueryLogConfig) </s> remove httpRegister("GET", "/control/tls/status", t.handleTLSStatus)
httpRegister("POST", "/control/tls/configure", t.handleTLSConfigure)
httpRegister("POST", "/control/tls/validate", t.handleTLSValidate)
</s> add httpRegister(http.MethodGet, "/control/tls/status", t.handleTLSStatus)
httpRegister(http.MethodPost, "/control/tls/configure", t.handleTLSConfigure)
httpRegister(http.MethodPost, "/control/tls/validate", t.handleTLSValidate) </s> remove httpRegister("GET", "/control/clients", clients.handleGetClients)
httpRegister("POST", "/control/clients/add", clients.handleAddClient)
httpRegister("POST", "/control/clients/delete", clients.handleDelClient)
httpRegister("POST", "/control/clients/update", clients.handleUpdateClient)
httpRegister("GET", "/control/clients/find", clients.handleFindClient)
</s> add httpRegister(http.MethodGet, "/control/clients", clients.handleGetClients)
httpRegister(http.MethodPost, "/control/clients/add", clients.handleAddClient)
httpRegister(http.MethodPost, "/control/clients/delete", clients.handleDelClient)
httpRegister(http.MethodPost, "/control/clients/update", clients.handleUpdateClient)
httpRegister(http.MethodGet, "/control/clients/find", clients.handleFindClient) </s> remove httpRegister("GET", "/control/filtering/status", f.handleFilteringStatus)
httpRegister("POST", "/control/filtering/config", f.handleFilteringConfig)
httpRegister("POST", "/control/filtering/add_url", f.handleFilteringAddURL)
httpRegister("POST", "/control/filtering/remove_url", f.handleFilteringRemoveURL)
httpRegister("POST", "/control/filtering/set_url", f.handleFilteringSetURL)
httpRegister("POST", "/control/filtering/refresh", f.handleFilteringRefresh)
httpRegister("POST", "/control/filtering/set_rules", f.handleFilteringSetRules)
httpRegister("GET", "/control/filtering/check_host", f.handleCheckHost)
</s> add httpRegister(http.MethodGet, "/control/filtering/status", f.handleFilteringStatus)
httpRegister(http.MethodPost, "/control/filtering/config", f.handleFilteringConfig)
httpRegister(http.MethodPost, "/control/filtering/add_url", f.handleFilteringAddURL)
httpRegister(http.MethodPost, "/control/filtering/remove_url", f.handleFilteringRemoveURL)
httpRegister(http.MethodPost, "/control/filtering/set_url", f.handleFilteringSetURL)
httpRegister(http.MethodPost, "/control/filtering/refresh", f.handleFilteringRefresh)
httpRegister(http.MethodPost, "/control/filtering/set_rules", f.handleFilteringSetRules)
httpRegister(http.MethodGet, "/control/filtering/check_host", f.handleCheckHost) | https://github.com/AdguardTeam/AdGuardHome/commit/2638e271fed1937ceafaefeefe8086cb249eaf72 | internal/dnsfilter/rewrites.go |
keep replace replace replace keep replace replace replace keep keep keep | <mask> func (d *DNSFilter) registerSecurityHandlers() {
<mask> d.Config.HTTPRegister("POST", "/control/safebrowsing/enable", d.handleSafeBrowsingEnable)
<mask> d.Config.HTTPRegister("POST", "/control/safebrowsing/disable", d.handleSafeBrowsingDisable)
<mask> d.Config.HTTPRegister("GET", "/control/safebrowsing/status", d.handleSafeBrowsingStatus)
<mask>
<mask> d.Config.HTTPRegister("POST", "/control/parental/enable", d.handleParentalEnable)
<mask> d.Config.HTTPRegister("POST", "/control/parental/disable", d.handleParentalDisable)
<mask> d.Config.HTTPRegister("GET", "/control/parental/status", d.handleParentalStatus)
<mask>
<mask> d.Config.HTTPRegister("POST", "/control/safesearch/enable", d.handleSafeSearchEnable)
<mask> d.Config.HTTPRegister("POST", "/control/safesearch/disable", d.handleSafeSearchDisable)
</s> Pull request: all: use http method constants
Merge in DNS/adguard-home from method-const to master
Squashed commit of the following:
commit ae6d6699a25ca04ba92aa53258d46e50233a9e00
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 22:03:59 2021 +0300
all: use http method constants </s> remove d.Config.HTTPRegister("POST", "/control/safesearch/enable", d.handleSafeSearchEnable)
d.Config.HTTPRegister("POST", "/control/safesearch/disable", d.handleSafeSearchDisable)
d.Config.HTTPRegister("GET", "/control/safesearch/status", d.handleSafeSearchStatus)
</s> add d.Config.HTTPRegister(http.MethodPost, "/control/safesearch/enable", d.handleSafeSearchEnable)
d.Config.HTTPRegister(http.MethodPost, "/control/safesearch/disable", d.handleSafeSearchDisable)
d.Config.HTTPRegister(http.MethodGet, "/control/safesearch/status", d.handleSafeSearchStatus) </s> remove d.Config.HTTPRegister("GET", "/control/blocked_services/list", d.handleBlockedServicesList)
d.Config.HTTPRegister("POST", "/control/blocked_services/set", d.handleBlockedServicesSet)
</s> add d.Config.HTTPRegister(http.MethodGet, "/control/blocked_services/list", d.handleBlockedServicesList)
d.Config.HTTPRegister(http.MethodPost, "/control/blocked_services/set", d.handleBlockedServicesSet) </s> remove d.Config.HTTPRegister("GET", "/control/rewrite/list", d.handleRewriteList)
d.Config.HTTPRegister("POST", "/control/rewrite/add", d.handleRewriteAdd)
d.Config.HTTPRegister("POST", "/control/rewrite/delete", d.handleRewriteDelete)
</s> add d.Config.HTTPRegister(http.MethodGet, "/control/rewrite/list", d.handleRewriteList)
d.Config.HTTPRegister(http.MethodPost, "/control/rewrite/add", d.handleRewriteAdd)
d.Config.HTTPRegister(http.MethodPost, "/control/rewrite/delete", d.handleRewriteDelete) </s> remove l.conf.HTTPRegister("GET", "/control/querylog", l.handleQueryLog)
l.conf.HTTPRegister("GET", "/control/querylog_info", l.handleQueryLogInfo)
l.conf.HTTPRegister("POST", "/control/querylog_clear", l.handleQueryLogClear)
l.conf.HTTPRegister("POST", "/control/querylog_config", l.handleQueryLogConfig)
</s> add l.conf.HTTPRegister(http.MethodGet, "/control/querylog", l.handleQueryLog)
l.conf.HTTPRegister(http.MethodGet, "/control/querylog_info", l.handleQueryLogInfo)
l.conf.HTTPRegister(http.MethodPost, "/control/querylog_clear", l.handleQueryLogClear)
l.conf.HTTPRegister(http.MethodPost, "/control/querylog_config", l.handleQueryLogConfig) </s> remove httpRegister("GET", "/control/tls/status", t.handleTLSStatus)
httpRegister("POST", "/control/tls/configure", t.handleTLSConfigure)
httpRegister("POST", "/control/tls/validate", t.handleTLSValidate)
</s> add httpRegister(http.MethodGet, "/control/tls/status", t.handleTLSStatus)
httpRegister(http.MethodPost, "/control/tls/configure", t.handleTLSConfigure)
httpRegister(http.MethodPost, "/control/tls/validate", t.handleTLSValidate) | https://github.com/AdguardTeam/AdGuardHome/commit/2638e271fed1937ceafaefeefe8086cb249eaf72 | internal/dnsfilter/safebrowsing.go |
keep keep keep keep replace replace replace keep | <mask> d.Config.HTTPRegister("POST", "/control/parental/enable", d.handleParentalEnable)
<mask> d.Config.HTTPRegister("POST", "/control/parental/disable", d.handleParentalDisable)
<mask> d.Config.HTTPRegister("GET", "/control/parental/status", d.handleParentalStatus)
<mask>
<mask> d.Config.HTTPRegister("POST", "/control/safesearch/enable", d.handleSafeSearchEnable)
<mask> d.Config.HTTPRegister("POST", "/control/safesearch/disable", d.handleSafeSearchDisable)
<mask> d.Config.HTTPRegister("GET", "/control/safesearch/status", d.handleSafeSearchStatus)
<mask> }
</s> Pull request: all: use http method constants
Merge in DNS/adguard-home from method-const to master
Squashed commit of the following:
commit ae6d6699a25ca04ba92aa53258d46e50233a9e00
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 22:03:59 2021 +0300
all: use http method constants </s> remove d.Config.HTTPRegister("POST", "/control/parental/enable", d.handleParentalEnable)
d.Config.HTTPRegister("POST", "/control/parental/disable", d.handleParentalDisable)
d.Config.HTTPRegister("GET", "/control/parental/status", d.handleParentalStatus)
</s> add d.Config.HTTPRegister(http.MethodPost, "/control/parental/enable", d.handleParentalEnable)
d.Config.HTTPRegister(http.MethodPost, "/control/parental/disable", d.handleParentalDisable)
d.Config.HTTPRegister(http.MethodGet, "/control/parental/status", d.handleParentalStatus) </s> remove d.Config.HTTPRegister("POST", "/control/safebrowsing/enable", d.handleSafeBrowsingEnable)
d.Config.HTTPRegister("POST", "/control/safebrowsing/disable", d.handleSafeBrowsingDisable)
d.Config.HTTPRegister("GET", "/control/safebrowsing/status", d.handleSafeBrowsingStatus)
</s> add d.Config.HTTPRegister(http.MethodPost, "/control/safebrowsing/enable", d.handleSafeBrowsingEnable)
d.Config.HTTPRegister(http.MethodPost, "/control/safebrowsing/disable", d.handleSafeBrowsingDisable)
d.Config.HTTPRegister(http.MethodGet, "/control/safebrowsing/status", d.handleSafeBrowsingStatus) </s> remove d.Config.HTTPRegister("GET", "/control/blocked_services/list", d.handleBlockedServicesList)
d.Config.HTTPRegister("POST", "/control/blocked_services/set", d.handleBlockedServicesSet)
</s> add d.Config.HTTPRegister(http.MethodGet, "/control/blocked_services/list", d.handleBlockedServicesList)
d.Config.HTTPRegister(http.MethodPost, "/control/blocked_services/set", d.handleBlockedServicesSet) </s> remove d.Config.HTTPRegister("GET", "/control/rewrite/list", d.handleRewriteList)
d.Config.HTTPRegister("POST", "/control/rewrite/add", d.handleRewriteAdd)
d.Config.HTTPRegister("POST", "/control/rewrite/delete", d.handleRewriteDelete)
</s> add d.Config.HTTPRegister(http.MethodGet, "/control/rewrite/list", d.handleRewriteList)
d.Config.HTTPRegister(http.MethodPost, "/control/rewrite/add", d.handleRewriteAdd)
d.Config.HTTPRegister(http.MethodPost, "/control/rewrite/delete", d.handleRewriteDelete) </s> remove s.conf.HTTPRegister("GET", "/control/stats", s.handleStats)
s.conf.HTTPRegister("POST", "/control/stats_reset", s.handleStatsReset)
s.conf.HTTPRegister("POST", "/control/stats_config", s.handleStatsConfig)
s.conf.HTTPRegister("GET", "/control/stats_info", s.handleStatsInfo)
</s> add s.conf.HTTPRegister(http.MethodGet, "/control/stats", s.handleStats)
s.conf.HTTPRegister(http.MethodPost, "/control/stats_reset", s.handleStatsReset)
s.conf.HTTPRegister(http.MethodPost, "/control/stats_config", s.handleStatsConfig)
s.conf.HTTPRegister(http.MethodGet, "/control/stats_info", s.handleStatsInfo) </s> remove httpRegister("GET", "/control/tls/status", t.handleTLSStatus)
httpRegister("POST", "/control/tls/configure", t.handleTLSConfigure)
httpRegister("POST", "/control/tls/validate", t.handleTLSValidate)
</s> add httpRegister(http.MethodGet, "/control/tls/status", t.handleTLSStatus)
httpRegister(http.MethodPost, "/control/tls/configure", t.handleTLSConfigure)
httpRegister(http.MethodPost, "/control/tls/validate", t.handleTLSValidate) | https://github.com/AdguardTeam/AdGuardHome/commit/2638e271fed1937ceafaefeefe8086cb249eaf72 | internal/dnsfilter/safebrowsing.go |
keep keep keep keep replace replace replace replace replace keep | <mask> }
<mask>
<mask> // RegisterClientsHandlers registers HTTP handlers
<mask> func (clients *clientsContainer) registerWebHandlers() {
<mask> httpRegister("GET", "/control/clients", clients.handleGetClients)
<mask> httpRegister("POST", "/control/clients/add", clients.handleAddClient)
<mask> httpRegister("POST", "/control/clients/delete", clients.handleDelClient)
<mask> httpRegister("POST", "/control/clients/update", clients.handleUpdateClient)
<mask> httpRegister("GET", "/control/clients/find", clients.handleFindClient)
<mask> }
</s> Pull request: all: use http method constants
Merge in DNS/adguard-home from method-const to master
Squashed commit of the following:
commit ae6d6699a25ca04ba92aa53258d46e50233a9e00
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 22:03:59 2021 +0300
all: use http method constants </s> remove httpRegister("GET", "/control/tls/status", t.handleTLSStatus)
httpRegister("POST", "/control/tls/configure", t.handleTLSConfigure)
httpRegister("POST", "/control/tls/validate", t.handleTLSValidate)
</s> add httpRegister(http.MethodGet, "/control/tls/status", t.handleTLSStatus)
httpRegister(http.MethodPost, "/control/tls/configure", t.handleTLSConfigure)
httpRegister(http.MethodPost, "/control/tls/validate", t.handleTLSValidate) </s> remove httpRegister("GET", "/control/filtering/status", f.handleFilteringStatus)
httpRegister("POST", "/control/filtering/config", f.handleFilteringConfig)
httpRegister("POST", "/control/filtering/add_url", f.handleFilteringAddURL)
httpRegister("POST", "/control/filtering/remove_url", f.handleFilteringRemoveURL)
httpRegister("POST", "/control/filtering/set_url", f.handleFilteringSetURL)
httpRegister("POST", "/control/filtering/refresh", f.handleFilteringRefresh)
httpRegister("POST", "/control/filtering/set_rules", f.handleFilteringSetRules)
httpRegister("GET", "/control/filtering/check_host", f.handleCheckHost)
</s> add httpRegister(http.MethodGet, "/control/filtering/status", f.handleFilteringStatus)
httpRegister(http.MethodPost, "/control/filtering/config", f.handleFilteringConfig)
httpRegister(http.MethodPost, "/control/filtering/add_url", f.handleFilteringAddURL)
httpRegister(http.MethodPost, "/control/filtering/remove_url", f.handleFilteringRemoveURL)
httpRegister(http.MethodPost, "/control/filtering/set_url", f.handleFilteringSetURL)
httpRegister(http.MethodPost, "/control/filtering/refresh", f.handleFilteringRefresh)
httpRegister(http.MethodPost, "/control/filtering/set_rules", f.handleFilteringSetRules)
httpRegister(http.MethodGet, "/control/filtering/check_host", f.handleCheckHost) </s> remove d.Config.HTTPRegister("GET", "/control/blocked_services/list", d.handleBlockedServicesList)
d.Config.HTTPRegister("POST", "/control/blocked_services/set", d.handleBlockedServicesSet)
</s> add d.Config.HTTPRegister(http.MethodGet, "/control/blocked_services/list", d.handleBlockedServicesList)
d.Config.HTTPRegister(http.MethodPost, "/control/blocked_services/set", d.handleBlockedServicesSet) </s> remove d.Config.HTTPRegister("GET", "/control/rewrite/list", d.handleRewriteList)
d.Config.HTTPRegister("POST", "/control/rewrite/add", d.handleRewriteAdd)
d.Config.HTTPRegister("POST", "/control/rewrite/delete", d.handleRewriteDelete)
</s> add d.Config.HTTPRegister(http.MethodGet, "/control/rewrite/list", d.handleRewriteList)
d.Config.HTTPRegister(http.MethodPost, "/control/rewrite/add", d.handleRewriteAdd)
d.Config.HTTPRegister(http.MethodPost, "/control/rewrite/delete", d.handleRewriteDelete) </s> remove l.conf.HTTPRegister("GET", "/control/querylog", l.handleQueryLog)
l.conf.HTTPRegister("GET", "/control/querylog_info", l.handleQueryLogInfo)
l.conf.HTTPRegister("POST", "/control/querylog_clear", l.handleQueryLogClear)
l.conf.HTTPRegister("POST", "/control/querylog_config", l.handleQueryLogConfig)
</s> add l.conf.HTTPRegister(http.MethodGet, "/control/querylog", l.handleQueryLog)
l.conf.HTTPRegister(http.MethodGet, "/control/querylog_info", l.handleQueryLogInfo)
l.conf.HTTPRegister(http.MethodPost, "/control/querylog_clear", l.handleQueryLogClear)
l.conf.HTTPRegister(http.MethodPost, "/control/querylog_config", l.handleQueryLogConfig) </s> remove d.Config.HTTPRegister("POST", "/control/safebrowsing/enable", d.handleSafeBrowsingEnable)
d.Config.HTTPRegister("POST", "/control/safebrowsing/disable", d.handleSafeBrowsingDisable)
d.Config.HTTPRegister("GET", "/control/safebrowsing/status", d.handleSafeBrowsingStatus)
</s> add d.Config.HTTPRegister(http.MethodPost, "/control/safebrowsing/enable", d.handleSafeBrowsingEnable)
d.Config.HTTPRegister(http.MethodPost, "/control/safebrowsing/disable", d.handleSafeBrowsingDisable)
d.Config.HTTPRegister(http.MethodGet, "/control/safebrowsing/status", d.handleSafeBrowsingStatus) | https://github.com/AdguardTeam/AdGuardHome/commit/2638e271fed1937ceafaefeefe8086cb249eaf72 | internal/home/clientshttp.go |
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep | <mask> }
<mask>
<mask> // RegisterFilteringHandlers - register handlers
<mask> func (f *Filtering) RegisterFilteringHandlers() {
<mask> httpRegister("GET", "/control/filtering/status", f.handleFilteringStatus)
<mask> httpRegister("POST", "/control/filtering/config", f.handleFilteringConfig)
<mask> httpRegister("POST", "/control/filtering/add_url", f.handleFilteringAddURL)
<mask> httpRegister("POST", "/control/filtering/remove_url", f.handleFilteringRemoveURL)
<mask> httpRegister("POST", "/control/filtering/set_url", f.handleFilteringSetURL)
<mask> httpRegister("POST", "/control/filtering/refresh", f.handleFilteringRefresh)
<mask> httpRegister("POST", "/control/filtering/set_rules", f.handleFilteringSetRules)
<mask> httpRegister("GET", "/control/filtering/check_host", f.handleCheckHost)
<mask> }
<mask>
<mask> func checkFiltersUpdateIntervalHours(i uint32) bool {
<mask> return i == 0 || i == 1 || i == 12 || i == 1*24 || i == 3*24 || i == 7*24
<mask> }
</s> Pull request: all: use http method constants
Merge in DNS/adguard-home from method-const to master
Squashed commit of the following:
commit ae6d6699a25ca04ba92aa53258d46e50233a9e00
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 22:03:59 2021 +0300
all: use http method constants </s> remove httpRegister("GET", "/control/clients", clients.handleGetClients)
httpRegister("POST", "/control/clients/add", clients.handleAddClient)
httpRegister("POST", "/control/clients/delete", clients.handleDelClient)
httpRegister("POST", "/control/clients/update", clients.handleUpdateClient)
httpRegister("GET", "/control/clients/find", clients.handleFindClient)
</s> add httpRegister(http.MethodGet, "/control/clients", clients.handleGetClients)
httpRegister(http.MethodPost, "/control/clients/add", clients.handleAddClient)
httpRegister(http.MethodPost, "/control/clients/delete", clients.handleDelClient)
httpRegister(http.MethodPost, "/control/clients/update", clients.handleUpdateClient)
httpRegister(http.MethodGet, "/control/clients/find", clients.handleFindClient) </s> remove s.conf.HTTPRegister("GET", "/control/stats", s.handleStats)
s.conf.HTTPRegister("POST", "/control/stats_reset", s.handleStatsReset)
s.conf.HTTPRegister("POST", "/control/stats_config", s.handleStatsConfig)
s.conf.HTTPRegister("GET", "/control/stats_info", s.handleStatsInfo)
</s> add s.conf.HTTPRegister(http.MethodGet, "/control/stats", s.handleStats)
s.conf.HTTPRegister(http.MethodPost, "/control/stats_reset", s.handleStatsReset)
s.conf.HTTPRegister(http.MethodPost, "/control/stats_config", s.handleStatsConfig)
s.conf.HTTPRegister(http.MethodGet, "/control/stats_info", s.handleStatsInfo) </s> remove httpRegister("GET", "/control/tls/status", t.handleTLSStatus)
httpRegister("POST", "/control/tls/configure", t.handleTLSConfigure)
httpRegister("POST", "/control/tls/validate", t.handleTLSValidate)
</s> add httpRegister(http.MethodGet, "/control/tls/status", t.handleTLSStatus)
httpRegister(http.MethodPost, "/control/tls/configure", t.handleTLSConfigure)
httpRegister(http.MethodPost, "/control/tls/validate", t.handleTLSValidate) </s> remove d.Config.HTTPRegister("GET", "/control/blocked_services/list", d.handleBlockedServicesList)
d.Config.HTTPRegister("POST", "/control/blocked_services/set", d.handleBlockedServicesSet)
</s> add d.Config.HTTPRegister(http.MethodGet, "/control/blocked_services/list", d.handleBlockedServicesList)
d.Config.HTTPRegister(http.MethodPost, "/control/blocked_services/set", d.handleBlockedServicesSet) </s> remove d.Config.HTTPRegister("GET", "/control/rewrite/list", d.handleRewriteList)
d.Config.HTTPRegister("POST", "/control/rewrite/add", d.handleRewriteAdd)
d.Config.HTTPRegister("POST", "/control/rewrite/delete", d.handleRewriteDelete)
</s> add d.Config.HTTPRegister(http.MethodGet, "/control/rewrite/list", d.handleRewriteList)
d.Config.HTTPRegister(http.MethodPost, "/control/rewrite/add", d.handleRewriteAdd)
d.Config.HTTPRegister(http.MethodPost, "/control/rewrite/delete", d.handleRewriteDelete) </s> remove l.conf.HTTPRegister("GET", "/control/querylog", l.handleQueryLog)
l.conf.HTTPRegister("GET", "/control/querylog_info", l.handleQueryLogInfo)
l.conf.HTTPRegister("POST", "/control/querylog_clear", l.handleQueryLogClear)
l.conf.HTTPRegister("POST", "/control/querylog_config", l.handleQueryLogConfig)
</s> add l.conf.HTTPRegister(http.MethodGet, "/control/querylog", l.handleQueryLog)
l.conf.HTTPRegister(http.MethodGet, "/control/querylog_info", l.handleQueryLogInfo)
l.conf.HTTPRegister(http.MethodPost, "/control/querylog_clear", l.handleQueryLogClear)
l.conf.HTTPRegister(http.MethodPost, "/control/querylog_config", l.handleQueryLogConfig) | https://github.com/AdguardTeam/AdGuardHome/commit/2638e271fed1937ceafaefeefe8086cb249eaf72 | internal/home/controlfiltering.go |
keep keep keep keep replace replace replace keep | <mask> }
<mask>
<mask> // registerWebHandlers registers HTTP handlers for TLS configuration
<mask> func (t *TLSMod) registerWebHandlers() {
<mask> httpRegister("GET", "/control/tls/status", t.handleTLSStatus)
<mask> httpRegister("POST", "/control/tls/configure", t.handleTLSConfigure)
<mask> httpRegister("POST", "/control/tls/validate", t.handleTLSValidate)
<mask> }
</s> Pull request: all: use http method constants
Merge in DNS/adguard-home from method-const to master
Squashed commit of the following:
commit ae6d6699a25ca04ba92aa53258d46e50233a9e00
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 22:03:59 2021 +0300
all: use http method constants </s> remove httpRegister("GET", "/control/clients", clients.handleGetClients)
httpRegister("POST", "/control/clients/add", clients.handleAddClient)
httpRegister("POST", "/control/clients/delete", clients.handleDelClient)
httpRegister("POST", "/control/clients/update", clients.handleUpdateClient)
httpRegister("GET", "/control/clients/find", clients.handleFindClient)
</s> add httpRegister(http.MethodGet, "/control/clients", clients.handleGetClients)
httpRegister(http.MethodPost, "/control/clients/add", clients.handleAddClient)
httpRegister(http.MethodPost, "/control/clients/delete", clients.handleDelClient)
httpRegister(http.MethodPost, "/control/clients/update", clients.handleUpdateClient)
httpRegister(http.MethodGet, "/control/clients/find", clients.handleFindClient) </s> remove httpRegister("GET", "/control/filtering/status", f.handleFilteringStatus)
httpRegister("POST", "/control/filtering/config", f.handleFilteringConfig)
httpRegister("POST", "/control/filtering/add_url", f.handleFilteringAddURL)
httpRegister("POST", "/control/filtering/remove_url", f.handleFilteringRemoveURL)
httpRegister("POST", "/control/filtering/set_url", f.handleFilteringSetURL)
httpRegister("POST", "/control/filtering/refresh", f.handleFilteringRefresh)
httpRegister("POST", "/control/filtering/set_rules", f.handleFilteringSetRules)
httpRegister("GET", "/control/filtering/check_host", f.handleCheckHost)
</s> add httpRegister(http.MethodGet, "/control/filtering/status", f.handleFilteringStatus)
httpRegister(http.MethodPost, "/control/filtering/config", f.handleFilteringConfig)
httpRegister(http.MethodPost, "/control/filtering/add_url", f.handleFilteringAddURL)
httpRegister(http.MethodPost, "/control/filtering/remove_url", f.handleFilteringRemoveURL)
httpRegister(http.MethodPost, "/control/filtering/set_url", f.handleFilteringSetURL)
httpRegister(http.MethodPost, "/control/filtering/refresh", f.handleFilteringRefresh)
httpRegister(http.MethodPost, "/control/filtering/set_rules", f.handleFilteringSetRules)
httpRegister(http.MethodGet, "/control/filtering/check_host", f.handleCheckHost) </s> remove d.Config.HTTPRegister("GET", "/control/blocked_services/list", d.handleBlockedServicesList)
d.Config.HTTPRegister("POST", "/control/blocked_services/set", d.handleBlockedServicesSet)
</s> add d.Config.HTTPRegister(http.MethodGet, "/control/blocked_services/list", d.handleBlockedServicesList)
d.Config.HTTPRegister(http.MethodPost, "/control/blocked_services/set", d.handleBlockedServicesSet) </s> remove d.Config.HTTPRegister("GET", "/control/rewrite/list", d.handleRewriteList)
d.Config.HTTPRegister("POST", "/control/rewrite/add", d.handleRewriteAdd)
d.Config.HTTPRegister("POST", "/control/rewrite/delete", d.handleRewriteDelete)
</s> add d.Config.HTTPRegister(http.MethodGet, "/control/rewrite/list", d.handleRewriteList)
d.Config.HTTPRegister(http.MethodPost, "/control/rewrite/add", d.handleRewriteAdd)
d.Config.HTTPRegister(http.MethodPost, "/control/rewrite/delete", d.handleRewriteDelete) </s> remove l.conf.HTTPRegister("GET", "/control/querylog", l.handleQueryLog)
l.conf.HTTPRegister("GET", "/control/querylog_info", l.handleQueryLogInfo)
l.conf.HTTPRegister("POST", "/control/querylog_clear", l.handleQueryLogClear)
l.conf.HTTPRegister("POST", "/control/querylog_config", l.handleQueryLogConfig)
</s> add l.conf.HTTPRegister(http.MethodGet, "/control/querylog", l.handleQueryLog)
l.conf.HTTPRegister(http.MethodGet, "/control/querylog_info", l.handleQueryLogInfo)
l.conf.HTTPRegister(http.MethodPost, "/control/querylog_clear", l.handleQueryLogClear)
l.conf.HTTPRegister(http.MethodPost, "/control/querylog_config", l.handleQueryLogConfig) </s> remove d.Config.HTTPRegister("POST", "/control/safebrowsing/enable", d.handleSafeBrowsingEnable)
d.Config.HTTPRegister("POST", "/control/safebrowsing/disable", d.handleSafeBrowsingDisable)
d.Config.HTTPRegister("GET", "/control/safebrowsing/status", d.handleSafeBrowsingStatus)
</s> add d.Config.HTTPRegister(http.MethodPost, "/control/safebrowsing/enable", d.handleSafeBrowsingEnable)
d.Config.HTTPRegister(http.MethodPost, "/control/safebrowsing/disable", d.handleSafeBrowsingDisable)
d.Config.HTTPRegister(http.MethodGet, "/control/safebrowsing/status", d.handleSafeBrowsingStatus) | https://github.com/AdguardTeam/AdGuardHome/commit/2638e271fed1937ceafaefeefe8086cb249eaf72 | internal/home/tls.go |
keep keep keep keep replace replace replace replace keep keep keep keep keep | <mask> }
<mask>
<mask> // Register web handlers
<mask> func (l *queryLog) initWeb() {
<mask> l.conf.HTTPRegister("GET", "/control/querylog", l.handleQueryLog)
<mask> l.conf.HTTPRegister("GET", "/control/querylog_info", l.handleQueryLogInfo)
<mask> l.conf.HTTPRegister("POST", "/control/querylog_clear", l.handleQueryLogClear)
<mask> l.conf.HTTPRegister("POST", "/control/querylog_config", l.handleQueryLogConfig)
<mask> }
<mask>
<mask> func httpError(r *http.Request, w http.ResponseWriter, code int, format string, args ...interface{}) {
<mask> text := fmt.Sprintf(format, args...)
<mask>
</s> Pull request: all: use http method constants
Merge in DNS/adguard-home from method-const to master
Squashed commit of the following:
commit ae6d6699a25ca04ba92aa53258d46e50233a9e00
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 22:03:59 2021 +0300
all: use http method constants </s> remove d.Config.HTTPRegister("GET", "/control/blocked_services/list", d.handleBlockedServicesList)
d.Config.HTTPRegister("POST", "/control/blocked_services/set", d.handleBlockedServicesSet)
</s> add d.Config.HTTPRegister(http.MethodGet, "/control/blocked_services/list", d.handleBlockedServicesList)
d.Config.HTTPRegister(http.MethodPost, "/control/blocked_services/set", d.handleBlockedServicesSet) </s> remove d.Config.HTTPRegister("GET", "/control/rewrite/list", d.handleRewriteList)
d.Config.HTTPRegister("POST", "/control/rewrite/add", d.handleRewriteAdd)
d.Config.HTTPRegister("POST", "/control/rewrite/delete", d.handleRewriteDelete)
</s> add d.Config.HTTPRegister(http.MethodGet, "/control/rewrite/list", d.handleRewriteList)
d.Config.HTTPRegister(http.MethodPost, "/control/rewrite/add", d.handleRewriteAdd)
d.Config.HTTPRegister(http.MethodPost, "/control/rewrite/delete", d.handleRewriteDelete) </s> remove httpRegister("GET", "/control/tls/status", t.handleTLSStatus)
httpRegister("POST", "/control/tls/configure", t.handleTLSConfigure)
httpRegister("POST", "/control/tls/validate", t.handleTLSValidate)
</s> add httpRegister(http.MethodGet, "/control/tls/status", t.handleTLSStatus)
httpRegister(http.MethodPost, "/control/tls/configure", t.handleTLSConfigure)
httpRegister(http.MethodPost, "/control/tls/validate", t.handleTLSValidate) </s> remove d.Config.HTTPRegister("POST", "/control/safebrowsing/enable", d.handleSafeBrowsingEnable)
d.Config.HTTPRegister("POST", "/control/safebrowsing/disable", d.handleSafeBrowsingDisable)
d.Config.HTTPRegister("GET", "/control/safebrowsing/status", d.handleSafeBrowsingStatus)
</s> add d.Config.HTTPRegister(http.MethodPost, "/control/safebrowsing/enable", d.handleSafeBrowsingEnable)
d.Config.HTTPRegister(http.MethodPost, "/control/safebrowsing/disable", d.handleSafeBrowsingDisable)
d.Config.HTTPRegister(http.MethodGet, "/control/safebrowsing/status", d.handleSafeBrowsingStatus) </s> remove httpRegister("GET", "/control/clients", clients.handleGetClients)
httpRegister("POST", "/control/clients/add", clients.handleAddClient)
httpRegister("POST", "/control/clients/delete", clients.handleDelClient)
httpRegister("POST", "/control/clients/update", clients.handleUpdateClient)
httpRegister("GET", "/control/clients/find", clients.handleFindClient)
</s> add httpRegister(http.MethodGet, "/control/clients", clients.handleGetClients)
httpRegister(http.MethodPost, "/control/clients/add", clients.handleAddClient)
httpRegister(http.MethodPost, "/control/clients/delete", clients.handleDelClient)
httpRegister(http.MethodPost, "/control/clients/update", clients.handleUpdateClient)
httpRegister(http.MethodGet, "/control/clients/find", clients.handleFindClient) </s> remove httpRegister("GET", "/control/filtering/status", f.handleFilteringStatus)
httpRegister("POST", "/control/filtering/config", f.handleFilteringConfig)
httpRegister("POST", "/control/filtering/add_url", f.handleFilteringAddURL)
httpRegister("POST", "/control/filtering/remove_url", f.handleFilteringRemoveURL)
httpRegister("POST", "/control/filtering/set_url", f.handleFilteringSetURL)
httpRegister("POST", "/control/filtering/refresh", f.handleFilteringRefresh)
httpRegister("POST", "/control/filtering/set_rules", f.handleFilteringSetRules)
httpRegister("GET", "/control/filtering/check_host", f.handleCheckHost)
</s> add httpRegister(http.MethodGet, "/control/filtering/status", f.handleFilteringStatus)
httpRegister(http.MethodPost, "/control/filtering/config", f.handleFilteringConfig)
httpRegister(http.MethodPost, "/control/filtering/add_url", f.handleFilteringAddURL)
httpRegister(http.MethodPost, "/control/filtering/remove_url", f.handleFilteringRemoveURL)
httpRegister(http.MethodPost, "/control/filtering/set_url", f.handleFilteringSetURL)
httpRegister(http.MethodPost, "/control/filtering/refresh", f.handleFilteringRefresh)
httpRegister(http.MethodPost, "/control/filtering/set_rules", f.handleFilteringSetRules)
httpRegister(http.MethodGet, "/control/filtering/check_host", f.handleCheckHost) | https://github.com/AdguardTeam/AdGuardHome/commit/2638e271fed1937ceafaefeefe8086cb249eaf72 | internal/querylog/http.go |
keep keep keep keep replace replace replace replace keep | <mask> if s.conf.HTTPRegister == nil {
<mask> return
<mask> }
<mask>
<mask> s.conf.HTTPRegister("GET", "/control/stats", s.handleStats)
<mask> s.conf.HTTPRegister("POST", "/control/stats_reset", s.handleStatsReset)
<mask> s.conf.HTTPRegister("POST", "/control/stats_config", s.handleStatsConfig)
<mask> s.conf.HTTPRegister("GET", "/control/stats_info", s.handleStatsInfo)
<mask> }
</s> Pull request: all: use http method constants
Merge in DNS/adguard-home from method-const to master
Squashed commit of the following:
commit ae6d6699a25ca04ba92aa53258d46e50233a9e00
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 22:03:59 2021 +0300
all: use http method constants </s> remove httpRegister("GET", "/control/filtering/status", f.handleFilteringStatus)
httpRegister("POST", "/control/filtering/config", f.handleFilteringConfig)
httpRegister("POST", "/control/filtering/add_url", f.handleFilteringAddURL)
httpRegister("POST", "/control/filtering/remove_url", f.handleFilteringRemoveURL)
httpRegister("POST", "/control/filtering/set_url", f.handleFilteringSetURL)
httpRegister("POST", "/control/filtering/refresh", f.handleFilteringRefresh)
httpRegister("POST", "/control/filtering/set_rules", f.handleFilteringSetRules)
httpRegister("GET", "/control/filtering/check_host", f.handleCheckHost)
</s> add httpRegister(http.MethodGet, "/control/filtering/status", f.handleFilteringStatus)
httpRegister(http.MethodPost, "/control/filtering/config", f.handleFilteringConfig)
httpRegister(http.MethodPost, "/control/filtering/add_url", f.handleFilteringAddURL)
httpRegister(http.MethodPost, "/control/filtering/remove_url", f.handleFilteringRemoveURL)
httpRegister(http.MethodPost, "/control/filtering/set_url", f.handleFilteringSetURL)
httpRegister(http.MethodPost, "/control/filtering/refresh", f.handleFilteringRefresh)
httpRegister(http.MethodPost, "/control/filtering/set_rules", f.handleFilteringSetRules)
httpRegister(http.MethodGet, "/control/filtering/check_host", f.handleCheckHost) </s> remove d.Config.HTTPRegister("GET", "/control/blocked_services/list", d.handleBlockedServicesList)
d.Config.HTTPRegister("POST", "/control/blocked_services/set", d.handleBlockedServicesSet)
</s> add d.Config.HTTPRegister(http.MethodGet, "/control/blocked_services/list", d.handleBlockedServicesList)
d.Config.HTTPRegister(http.MethodPost, "/control/blocked_services/set", d.handleBlockedServicesSet) </s> remove d.Config.HTTPRegister("GET", "/control/rewrite/list", d.handleRewriteList)
d.Config.HTTPRegister("POST", "/control/rewrite/add", d.handleRewriteAdd)
d.Config.HTTPRegister("POST", "/control/rewrite/delete", d.handleRewriteDelete)
</s> add d.Config.HTTPRegister(http.MethodGet, "/control/rewrite/list", d.handleRewriteList)
d.Config.HTTPRegister(http.MethodPost, "/control/rewrite/add", d.handleRewriteAdd)
d.Config.HTTPRegister(http.MethodPost, "/control/rewrite/delete", d.handleRewriteDelete) </s> remove httpRegister("GET", "/control/tls/status", t.handleTLSStatus)
httpRegister("POST", "/control/tls/configure", t.handleTLSConfigure)
httpRegister("POST", "/control/tls/validate", t.handleTLSValidate)
</s> add httpRegister(http.MethodGet, "/control/tls/status", t.handleTLSStatus)
httpRegister(http.MethodPost, "/control/tls/configure", t.handleTLSConfigure)
httpRegister(http.MethodPost, "/control/tls/validate", t.handleTLSValidate) </s> remove d.Config.HTTPRegister("POST", "/control/safebrowsing/enable", d.handleSafeBrowsingEnable)
d.Config.HTTPRegister("POST", "/control/safebrowsing/disable", d.handleSafeBrowsingDisable)
d.Config.HTTPRegister("GET", "/control/safebrowsing/status", d.handleSafeBrowsingStatus)
</s> add d.Config.HTTPRegister(http.MethodPost, "/control/safebrowsing/enable", d.handleSafeBrowsingEnable)
d.Config.HTTPRegister(http.MethodPost, "/control/safebrowsing/disable", d.handleSafeBrowsingDisable)
d.Config.HTTPRegister(http.MethodGet, "/control/safebrowsing/status", d.handleSafeBrowsingStatus) </s> remove l.conf.HTTPRegister("GET", "/control/querylog", l.handleQueryLog)
l.conf.HTTPRegister("GET", "/control/querylog_info", l.handleQueryLogInfo)
l.conf.HTTPRegister("POST", "/control/querylog_clear", l.handleQueryLogClear)
l.conf.HTTPRegister("POST", "/control/querylog_config", l.handleQueryLogConfig)
</s> add l.conf.HTTPRegister(http.MethodGet, "/control/querylog", l.handleQueryLog)
l.conf.HTTPRegister(http.MethodGet, "/control/querylog_info", l.handleQueryLogInfo)
l.conf.HTTPRegister(http.MethodPost, "/control/querylog_clear", l.handleQueryLogClear)
l.conf.HTTPRegister(http.MethodPost, "/control/querylog_config", l.handleQueryLogConfig) | https://github.com/AdguardTeam/AdGuardHome/commit/2638e271fed1937ceafaefeefe8086cb249eaf72 | internal/stats/http.go |
keep keep keep keep replace keep keep keep keep keep | <mask> ProtectionEnabled bool `yaml:"protection_enabled"` // whether or not use any of dnsfilter features
<mask>
<mask> BlockingMode string `yaml:"blocking_mode"` // mode how to answer filtered requests
<mask> BlockedResponseTTL uint32 `yaml:"blocked_response_ttl"` // if 0, then default is used (3600)
<mask> Ratelimit int `yaml:"ratelimit"` // max number of requests per second from a given IP (0 to disable)
<mask> RatelimitWhitelist []string `yaml:"ratelimit_whitelist"` // a list of whitelisted client IP addresses
<mask> RefuseAny bool `yaml:"refuse_any"` // if true, refuse ANY requests
<mask> BootstrapDNS []string `yaml:"bootstrap_dns"` // a list of bootstrap DNS for DoH and DoT (plain DNS only)
<mask> AllServers bool `yaml:"all_servers"` // if true, parallel queries to all configured upstream servers are enabled
<mask>
</s> + DNS: Get/Set DNS general settings
GET /control/dns_info
POST /control/dns_config </s> remove Ratelimit: s.conf.Ratelimit,
</s> add Ratelimit: int(s.conf.Ratelimit), </s> add s.conf.HTTPRegister("GET", "/control/dns_info", s.handleGetConfig)
s.conf.HTTPRegister("POST", "/control/dns_config", s.handleSetConfig) | https://github.com/AdguardTeam/AdGuardHome/commit/26ccee47b5045261907d65129fa1dea250efaf02 | dnsforward/dnsforward.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> proxyConfig := proxy.Config{
<mask> UDPListenAddr: s.conf.UDPListenAddr,
<mask> TCPListenAddr: s.conf.TCPListenAddr,
<mask> Ratelimit: s.conf.Ratelimit,
<mask> RatelimitWhitelist: s.conf.RatelimitWhitelist,
<mask> RefuseAny: s.conf.RefuseAny,
<mask> CacheEnabled: true,
<mask> CacheSizeBytes: int(s.conf.CacheSize),
<mask> Upstreams: s.conf.Upstreams,
</s> + DNS: Get/Set DNS general settings
GET /control/dns_info
POST /control/dns_config </s> remove Ratelimit int `yaml:"ratelimit"` // max number of requests per second from a given IP (0 to disable)
</s> add Ratelimit uint32 `yaml:"ratelimit"` // max number of requests per second from a given IP (0 to disable) </s> add s.conf.HTTPRegister("GET", "/control/dns_info", s.handleGetConfig)
s.conf.HTTPRegister("POST", "/control/dns_config", s.handleSetConfig) | https://github.com/AdguardTeam/AdGuardHome/commit/26ccee47b5045261907d65129fa1dea250efaf02 | dnsforward/dnsforward.go |
keep add keep keep keep keep keep keep | <mask>
<mask> func (s *Server) registerHandlers() {
<mask> s.conf.HTTPRegister("POST", "/control/enable_protection", s.handleProtectionEnable)
<mask> s.conf.HTTPRegister("POST", "/control/disable_protection", s.handleProtectionDisable)
<mask> s.conf.HTTPRegister("POST", "/control/set_upstreams_config", s.handleSetUpstreamConfig)
<mask> s.conf.HTTPRegister("POST", "/control/test_upstream_dns", s.handleTestUpstreamDNS)
<mask>
<mask> s.conf.HTTPRegister("GET", "/control/access/list", s.handleAccessList)
</s> + DNS: Get/Set DNS general settings
GET /control/dns_info
POST /control/dns_config </s> remove Ratelimit: s.conf.Ratelimit,
</s> add Ratelimit: int(s.conf.Ratelimit), </s> remove Ratelimit int `yaml:"ratelimit"` // max number of requests per second from a given IP (0 to disable)
</s> add Ratelimit uint32 `yaml:"ratelimit"` // max number of requests per second from a given IP (0 to disable) | https://github.com/AdguardTeam/AdGuardHome/commit/26ccee47b5045261907d65129fa1dea250efaf02 | dnsforward/dnsforward_http.go |
keep keep keep keep replace replace keep replace keep | <mask> //
<mask> // Algorithm:
<mask> // . Get the list of filters to be updated
<mask> // . For each filter run the download and checksum check operation
<mask> // . If filter data hasn't changed, set new update time
<mask> // . If filter data has changed, parse it, save it on disk, set new update time
<mask> // . Apply changes to the current configuration
<mask> // . Restart server
<mask> func refreshFiltersIfNecessary(force bool) int {
</s> - filters: windows: fix update procedure
We couldn't write filter files on Windows due to
"file is being used" error. </s> add var updateFlags []bool // 'true' if filter data has changed </s> add uf.LastUpdated = time.Now()
updateFlags = append(updateFlags, updated)
}
isRunning := isRunning()
_ = dnsServer.Stop()
for i := range updateFilters {
uf := &updateFilters[i]
updated := updateFlags[i] </s> remove err = uf.save()
</s> add err := uf.save() </s> remove if updateCount > 0 && isRunning() {
</s> add if updateCount > 0 && isRunning { </s> remove uf.LastUpdated = mtime
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/27006f58c506b3dd365a1dea3a9e42f41d5c2a6e | home/filter.go |
keep keep add keep keep keep keep keep keep | <mask> // . Start server
<mask> func refreshFiltersIfNecessary(force bool) int {
<mask> var updateFilters []filter
<mask>
<mask> if config.firstRun {
<mask> return 0
<mask> }
<mask>
<mask> config.RLock()
</s> - filters: windows: fix update procedure
We couldn't write filter files on Windows due to
"file is being used" error. </s> remove // . Restart server
</s> add // . Start server </s> remove // . If filter data hasn't changed, set new update time
// . If filter data has changed, parse it, save it on disk, set new update time
</s> add // . Stop server
// . For each filter:
// . If filter data hasn't changed, just set new update time on file
// . If filter data has changed, save it on disk </s> remove if updateCount > 0 && isRunning() {
</s> add if updateCount > 0 && isRunning { </s> remove err = uf.save()
</s> add err := uf.save() </s> add uf.LastUpdated = time.Now()
updateFlags = append(updateFlags, updated)
}
isRunning := isRunning()
_ = dnsServer.Stop()
for i := range updateFilters {
uf := &updateFilters[i]
updated := updateFlags[i] </s> remove mtime := time.Now()
e := os.Chtimes(uf.Path(), mtime, mtime)
</s> add e := os.Chtimes(uf.Path(), uf.LastUpdated, uf.LastUpdated) | https://github.com/AdguardTeam/AdGuardHome/commit/27006f58c506b3dd365a1dea3a9e42f41d5c2a6e | home/filter.go |
keep keep add keep keep keep keep keep keep | <mask> log.Printf("Failed to update filter %s: %s\n", uf.URL, err)
<mask> continue
<mask> }
<mask> if updated {
<mask> // Saving it to the filters dir now
<mask> err := uf.save()
<mask> if err != nil {
<mask> log.Printf("Failed to save the updated filter %d: %s", uf.ID, err)
<mask> continue
</s> - filters: windows: fix update procedure
We couldn't write filter files on Windows due to
"file is being used" error. </s> remove err = uf.save()
</s> add err := uf.save() </s> remove if updateCount > 0 && isRunning() {
</s> add if updateCount > 0 && isRunning { </s> remove mtime := time.Now()
e := os.Chtimes(uf.Path(), mtime, mtime)
</s> add e := os.Chtimes(uf.Path(), uf.LastUpdated, uf.LastUpdated) </s> remove // . If filter data hasn't changed, set new update time
// . If filter data has changed, parse it, save it on disk, set new update time
</s> add // . Stop server
// . For each filter:
// . If filter data hasn't changed, just set new update time on file
// . If filter data has changed, save it on disk </s> remove // . Restart server
</s> add // . Start server </s> add var updateFlags []bool // 'true' if filter data has changed | https://github.com/AdguardTeam/AdGuardHome/commit/27006f58c506b3dd365a1dea3a9e42f41d5c2a6e | home/filter.go |
keep keep keep keep replace keep keep keep keep keep | <mask> continue
<mask> }
<mask> if updated {
<mask> // Saving it to the filters dir now
<mask> err = uf.save()
<mask> if err != nil {
<mask> log.Printf("Failed to save the updated filter %d: %s", uf.ID, err)
<mask> continue
<mask> }
<mask>
</s> - filters: windows: fix update procedure
We couldn't write filter files on Windows due to
"file is being used" error. </s> add uf.LastUpdated = time.Now()
updateFlags = append(updateFlags, updated)
}
isRunning := isRunning()
_ = dnsServer.Stop()
for i := range updateFilters {
uf := &updateFilters[i]
updated := updateFlags[i] </s> remove if updateCount > 0 && isRunning() {
</s> add if updateCount > 0 && isRunning { </s> remove mtime := time.Now()
e := os.Chtimes(uf.Path(), mtime, mtime)
</s> add e := os.Chtimes(uf.Path(), uf.LastUpdated, uf.LastUpdated) </s> add var updateFlags []bool // 'true' if filter data has changed </s> remove uf.LastUpdated = mtime
</s> add </s> remove // . If filter data hasn't changed, set new update time
// . If filter data has changed, parse it, save it on disk, set new update time
</s> add // . Stop server
// . For each filter:
// . If filter data hasn't changed, just set new update time on file
// . If filter data has changed, save it on disk | https://github.com/AdguardTeam/AdGuardHome/commit/27006f58c506b3dd365a1dea3a9e42f41d5c2a6e | home/filter.go |
keep keep keep replace replace keep keep keep replace | <mask> }
<mask>
<mask> } else {
<mask> mtime := time.Now()
<mask> e := os.Chtimes(uf.Path(), mtime, mtime)
<mask> if e != nil {
<mask> log.Error("os.Chtimes(): %v", e)
<mask> }
<mask> uf.LastUpdated = mtime
</s> - filters: windows: fix update procedure
We couldn't write filter files on Windows due to
"file is being used" error. </s> add uf.LastUpdated = time.Now()
updateFlags = append(updateFlags, updated)
}
isRunning := isRunning()
_ = dnsServer.Stop()
for i := range updateFilters {
uf := &updateFilters[i]
updated := updateFlags[i] </s> remove if updateCount > 0 && isRunning() {
</s> add if updateCount > 0 && isRunning { </s> remove err = uf.save()
</s> add err := uf.save() </s> add var updateFlags []bool // 'true' if filter data has changed </s> remove // . Restart server
</s> add // . Start server | https://github.com/AdguardTeam/AdGuardHome/commit/27006f58c506b3dd365a1dea3a9e42f41d5c2a6e | home/filter.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask> config.Unlock()
<mask> }
<mask>
<mask> if updateCount > 0 && isRunning() {
<mask> err := reconfigureDNSServer()
<mask> if err != nil {
<mask> msg := fmt.Sprintf("SHOULD NOT HAPPEN: cannot reconfigure DNS server with the new filters: %s", err)
<mask> panic(msg)
<mask> }
</s> - filters: windows: fix update procedure
We couldn't write filter files on Windows due to
"file is being used" error. </s> add uf.LastUpdated = time.Now()
updateFlags = append(updateFlags, updated)
}
isRunning := isRunning()
_ = dnsServer.Stop()
for i := range updateFilters {
uf := &updateFilters[i]
updated := updateFlags[i] </s> remove err = uf.save()
</s> add err := uf.save() </s> remove mtime := time.Now()
e := os.Chtimes(uf.Path(), mtime, mtime)
</s> add e := os.Chtimes(uf.Path(), uf.LastUpdated, uf.LastUpdated) </s> remove uf.LastUpdated = mtime
</s> add </s> add var updateFlags []bool // 'true' if filter data has changed </s> remove // . Restart server
</s> add // . Start server | https://github.com/AdguardTeam/AdGuardHome/commit/27006f58c506b3dd365a1dea3a9e42f41d5c2a6e | home/filter.go |
keep replace keep keep keep keep replace keep | <mask> .stats__table .popover__body {
<mask> left: 0;
<mask> transform: none;
<mask> }
<mask>
<mask> .stats__table .popover__body:after {
<mask> left: 13px;
<mask> }
</s> - client: fix popover in the dashboard tables </s> add .logs__text--domain {
max-width: 285px;
}
</s> remove <div className="logs__text" title={value}>
</s> add <div className="logs__text logs__text--domain" title={value}> | https://github.com/AdguardTeam/AdGuardHome/commit/271ff4fe8358eed5de3bbeb76ab9ec7a6a369b89 | client/src/components/Dashboard/Dashboard.css |
keep keep keep keep replace keep keep keep keep keep | <mask> const trackerData = getTrackerData(value);
<mask>
<mask> return (
<mask> <div className="logs__row">
<mask> <div className="logs__text" title={value}>
<mask> {value}
<mask> </div>
<mask> {trackerData && <Popover data={trackerData} />}
<mask> </div>
<mask> );
</s> - client: fix popover in the dashboard tables </s> add .logs__text--domain {
max-width: 285px;
}
</s> remove left: 13px;
</s> add left: 23px; </s> remove left: 0;
</s> add left: -10px;
min-width: 270px; | https://github.com/AdguardTeam/AdGuardHome/commit/271ff4fe8358eed5de3bbeb76ab9ec7a6a369b89 | client/src/components/Dashboard/DomainCell.js |
keep keep add keep keep keep keep keep keep | <mask> width: 100%;
<mask> }
<mask>
<mask> .logs__text--wrap,
<mask> .logs__text--whois {
<mask> line-height: 1.4;
<mask> white-space: normal;
<mask> }
<mask>
</s> - client: fix popover in the dashboard tables </s> remove left: 13px;
</s> add left: 23px; </s> remove left: 0;
</s> add left: -10px;
min-width: 270px; </s> remove <div className="logs__text" title={value}>
</s> add <div className="logs__text logs__text--domain" title={value}> | https://github.com/AdguardTeam/AdGuardHome/commit/271ff4fe8358eed5de3bbeb76ab9ec7a6a369b89 | client/src/components/Logs/Logs.css |
keep add keep keep keep keep keep keep | <mask> }
<mask>
<mask> // configuration is loaded from YAML
<mask> // field ordering is important -- yaml fields will mirror ordering from here
<mask> type configuration struct {
<mask> // Raw file data to avoid re-reading of configuration file
<mask> // It's reset after config is parsed
<mask> fileData []byte
</s> * move "httpsServer" to "config" </s> remove httpsServer.cond.Wait()
</s> add config.httpsServer.cond.Wait() </s> add httpsServer HTTPSServer
</s> remove for !httpsServer.shutdown {
</s> add for !config.httpsServer.shutdown { </s> remove var httpsServer struct {
server *http.Server
cond *sync.Cond // reacts to config.TLS.Enabled, PortHTTPS, CertificateChain and PrivateKey
sync.Mutex // protects config.TLS
shutdown bool // if TRUE, don't restart the server
}
</s> add </s> remove for !httpsServer.shutdown {
httpsServer.cond.L.Lock()
</s> add for !config.httpsServer.shutdown {
config.httpsServer.cond.L.Lock() </s> remove if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && httpsServer.server != nil {
</s> add if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && config.httpsServer.server != nil { | https://github.com/AdguardTeam/AdGuardHome/commit/2780ace63e6950f7d685a499a20d36216416963b | home/config.go |
keep keep add keep keep keep keep keep | <mask> versionCheckJSON []byte
<mask> versionCheckLastTime time.Time
<mask>
<mask> BindHost string `yaml:"bind_host"` // BindHost is the IP address of the HTTP server to bind to
<mask> BindPort int `yaml:"bind_port"` // BindPort is the port the HTTP server
<mask> AuthName string `yaml:"auth_name"` // AuthName is the basic auth username
<mask> AuthPass string `yaml:"auth_pass"` // AuthPass is the basic auth password
<mask> Language string `yaml:"language"` // two-letter ISO 639-1 language code
</s> * move "httpsServer" to "config" </s> add type HTTPSServer struct {
server *http.Server
cond *sync.Cond // reacts to config.TLS.Enabled, PortHTTPS, CertificateChain and PrivateKey
sync.Mutex // protects config.TLS
shutdown bool // if TRUE, don't restart the server
}
</s> remove for !httpsServer.shutdown {
</s> add for !config.httpsServer.shutdown { </s> remove var httpsServer struct {
server *http.Server
cond *sync.Cond // reacts to config.TLS.Enabled, PortHTTPS, CertificateChain and PrivateKey
sync.Mutex // protects config.TLS
shutdown bool // if TRUE, don't restart the server
}
</s> add </s> remove httpsServer.shutdown = true
if httpsServer.server != nil {
httpsServer.server.Shutdown(context.TODO())
</s> add config.httpsServer.shutdown = true
if config.httpsServer.server != nil {
config.httpsServer.server.Shutdown(context.TODO()) </s> remove httpsServer.cond.L.Lock()
httpsServer.cond.Broadcast()
if httpsServer.server != nil {
httpsServer.server.Shutdown(context.TODO())
</s> add config.httpsServer.cond.L.Lock()
config.httpsServer.cond.Broadcast()
if config.httpsServer.server != nil {
config.httpsServer.server.Shutdown(context.TODO()) </s> remove httpsServer.cond = sync.NewCond(&httpsServer.Mutex)
</s> add config.httpsServer.cond = sync.NewCond(&config.httpsServer.Mutex) | https://github.com/AdguardTeam/AdGuardHome/commit/2780ace63e6950f7d685a499a20d36216416963b | home/config.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> // check if port is available
<mask> // BUT: if we are already using this port, no need
<mask> alreadyRunning := false
<mask> if httpsServer.server != nil {
<mask> alreadyRunning = true
<mask> }
<mask> if !alreadyRunning {
<mask> err = checkPortAvailable(config.BindHost, data.PortHTTPS)
<mask> if err != nil {
</s> * move "httpsServer" to "config" </s> remove if httpsServer.server != nil {
</s> add if config.httpsServer.server != nil { </s> remove if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && httpsServer.server != nil {
</s> add if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && config.httpsServer.server != nil { </s> remove httpsServer.shutdown = true
if httpsServer.server != nil {
httpsServer.server.Shutdown(context.TODO())
</s> add config.httpsServer.shutdown = true
if config.httpsServer.server != nil {
config.httpsServer.server.Shutdown(context.TODO()) </s> remove httpsServer.cond.L.Unlock()
</s> add config.httpsServer.cond.L.Unlock() </s> remove err = httpsServer.server.ListenAndServeTLS("", "")
</s> add err = config.httpsServer.server.ListenAndServeTLS("", "") </s> remove httpsServer.cond.L.Lock()
httpsServer.cond.Broadcast()
if httpsServer.server != nil {
httpsServer.server.Shutdown(context.TODO())
</s> add config.httpsServer.cond.L.Lock()
config.httpsServer.cond.Broadcast()
if config.httpsServer.server != nil {
config.httpsServer.server.Shutdown(context.TODO()) | https://github.com/AdguardTeam/AdGuardHome/commit/2780ace63e6950f7d685a499a20d36216416963b | home/control_tls.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> // check if port is available
<mask> // BUT: if we are already using this port, no need
<mask> alreadyRunning := false
<mask> if httpsServer.server != nil {
<mask> alreadyRunning = true
<mask> }
<mask> if !alreadyRunning {
<mask> err = checkPortAvailable(config.BindHost, data.PortHTTPS)
<mask> if err != nil {
</s> * move "httpsServer" to "config" | https://github.com/AdguardTeam/AdGuardHome/commit/2780ace63e6950f7d685a499a20d36216416963b | home/control_tls.go |
keep keep keep replace replace replace replace keep replace keep | <mask> if restartHTTPS {
<mask> go func() {
<mask> time.Sleep(time.Second) // TODO: could not find a way to reliably know that data was fully sent to client by https server, so we wait a bit to let response through before closing the server
<mask> httpsServer.cond.L.Lock()
<mask> httpsServer.cond.Broadcast()
<mask> if httpsServer.server != nil {
<mask> httpsServer.server.Shutdown(context.TODO())
<mask> }
<mask> httpsServer.cond.L.Unlock()
<mask> }()
</s> * move "httpsServer" to "config" </s> remove httpsServer.shutdown = true
if httpsServer.server != nil {
httpsServer.server.Shutdown(context.TODO())
</s> add config.httpsServer.shutdown = true
if config.httpsServer.server != nil {
config.httpsServer.server.Shutdown(context.TODO()) </s> remove for !httpsServer.shutdown {
</s> add for !config.httpsServer.shutdown { </s> remove for !httpsServer.shutdown {
httpsServer.cond.L.Lock()
</s> add for !config.httpsServer.shutdown {
config.httpsServer.cond.L.Lock() </s> remove var httpsServer struct {
server *http.Server
cond *sync.Cond // reacts to config.TLS.Enabled, PortHTTPS, CertificateChain and PrivateKey
sync.Mutex // protects config.TLS
shutdown bool // if TRUE, don't restart the server
}
</s> add </s> remove httpsServer.cond = sync.NewCond(&httpsServer.Mutex)
</s> add config.httpsServer.cond = sync.NewCond(&config.httpsServer.Mutex) | https://github.com/AdguardTeam/AdGuardHome/commit/2780ace63e6950f7d685a499a20d36216416963b | home/control_tls.go |
keep keep keep keep replace keep keep keep keep keep | <mask> http.Redirect(w, r, "/install.html", http.StatusSeeOther) // should not be cacheable
<mask> return
<mask> }
<mask> // enforce https?
<mask> if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && httpsServer.server != nil {
<mask> // yes, and we want host from host:port
<mask> host, _, err := net.SplitHostPort(r.Host)
<mask> if err != nil {
<mask> // no port in host
<mask> host = r.Host
</s> * move "httpsServer" to "config" </s> remove httpsServer.cond.Wait()
</s> add config.httpsServer.cond.Wait() </s> remove if httpsServer.server != nil {
</s> add if config.httpsServer.server != nil { </s> remove if httpsServer.server != nil {
</s> add if config.httpsServer.server != nil { </s> remove for !httpsServer.shutdown {
</s> add for !config.httpsServer.shutdown { </s> remove for !httpsServer.shutdown {
httpsServer.cond.L.Lock()
</s> add for !config.httpsServer.shutdown {
config.httpsServer.cond.L.Lock() </s> remove var httpsServer struct {
server *http.Server
cond *sync.Cond // reacts to config.TLS.Enabled, PortHTTPS, CertificateChain and PrivateKey
sync.Mutex // protects config.TLS
shutdown bool // if TRUE, don't restart the server
}
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/2780ace63e6950f7d685a499a20d36216416963b | home/helpers.go |
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep | <mask> "github.com/gobuffalo/packr"
<mask> )
<mask>
<mask> var httpServer *http.Server
<mask> var httpsServer struct {
<mask> server *http.Server
<mask> cond *sync.Cond // reacts to config.TLS.Enabled, PortHTTPS, CertificateChain and PrivateKey
<mask> sync.Mutex // protects config.TLS
<mask> shutdown bool // if TRUE, don't restart the server
<mask> }
<mask>
<mask> const (
<mask> // Used in config to indicate that syslog or eventlog (win) should be used for logger output
<mask> configSyslog = "syslog"
<mask> )
</s> * move "httpsServer" to "config" </s> add type HTTPSServer struct {
server *http.Server
cond *sync.Cond // reacts to config.TLS.Enabled, PortHTTPS, CertificateChain and PrivateKey
sync.Mutex // protects config.TLS
shutdown bool // if TRUE, don't restart the server
}
</s> remove if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && httpsServer.server != nil {
</s> add if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && config.httpsServer.server != nil { </s> remove for !httpsServer.shutdown {
</s> add for !config.httpsServer.shutdown { </s> add httpsServer HTTPSServer
</s> remove httpsServer.cond.L.Lock()
httpsServer.cond.Broadcast()
if httpsServer.server != nil {
httpsServer.server.Shutdown(context.TODO())
</s> add config.httpsServer.cond.L.Lock()
config.httpsServer.cond.Broadcast()
if config.httpsServer.server != nil {
config.httpsServer.server.Shutdown(context.TODO()) </s> remove httpsServer.shutdown = true
if httpsServer.server != nil {
httpsServer.server.Shutdown(context.TODO())
</s> add config.httpsServer.shutdown = true
if config.httpsServer.server != nil {
config.httpsServer.server.Shutdown(context.TODO()) | https://github.com/AdguardTeam/AdGuardHome/commit/2780ace63e6950f7d685a499a20d36216416963b | home/home.go |
keep keep keep keep replace keep keep keep keep keep | <mask> http.Handle("/install.html", preInstallHandler(http.FileServer(box)))
<mask> registerInstallHandlers()
<mask> }
<mask>
<mask> httpsServer.cond = sync.NewCond(&httpsServer.Mutex)
<mask>
<mask> // for https, we have a separate goroutine loop
<mask> go httpServerLoop()
<mask>
<mask> // this loop is used as an ability to change listening host and/or port
</s> * move "httpsServer" to "config" </s> remove for !httpsServer.shutdown {
</s> add for !config.httpsServer.shutdown { </s> remove httpsServer.cond.L.Lock()
httpsServer.cond.Broadcast()
if httpsServer.server != nil {
httpsServer.server.Shutdown(context.TODO())
</s> add config.httpsServer.cond.L.Lock()
config.httpsServer.cond.Broadcast()
if config.httpsServer.server != nil {
config.httpsServer.server.Shutdown(context.TODO()) </s> remove for !httpsServer.shutdown {
httpsServer.cond.L.Lock()
</s> add for !config.httpsServer.shutdown {
config.httpsServer.cond.L.Lock() </s> remove if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && httpsServer.server != nil {
</s> add if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && config.httpsServer.server != nil { </s> remove if httpsServer.server != nil {
</s> add if config.httpsServer.server != nil { </s> remove if httpsServer.server != nil {
</s> add if config.httpsServer.server != nil { | https://github.com/AdguardTeam/AdGuardHome/commit/2780ace63e6950f7d685a499a20d36216416963b | home/home.go |
keep keep keep keep replace keep keep keep keep keep | <mask> // for https, we have a separate goroutine loop
<mask> go httpServerLoop()
<mask>
<mask> // this loop is used as an ability to change listening host and/or port
<mask> for !httpsServer.shutdown {
<mask> printHTTPAddresses("http")
<mask>
<mask> // we need to have new instance, because after Shutdown() the Server is not usable
<mask> address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
<mask> httpServer = &http.Server{
</s> * move "httpsServer" to "config" </s> remove httpsServer.cond = sync.NewCond(&httpsServer.Mutex)
</s> add config.httpsServer.cond = sync.NewCond(&config.httpsServer.Mutex) </s> remove httpsServer.cond.Wait()
</s> add config.httpsServer.cond.Wait() </s> remove for !httpsServer.shutdown {
httpsServer.cond.L.Lock()
</s> add for !config.httpsServer.shutdown {
config.httpsServer.cond.L.Lock() </s> remove if httpsServer.server != nil {
</s> add if config.httpsServer.server != nil { </s> remove if httpsServer.server != nil {
</s> add if config.httpsServer.server != nil { </s> remove httpsServer.cond.L.Lock()
httpsServer.cond.Broadcast()
if httpsServer.server != nil {
httpsServer.server.Shutdown(context.TODO())
</s> add config.httpsServer.cond.L.Lock()
config.httpsServer.cond.Broadcast()
if config.httpsServer.server != nil {
config.httpsServer.server.Shutdown(context.TODO()) | https://github.com/AdguardTeam/AdGuardHome/commit/2780ace63e6950f7d685a499a20d36216416963b | home/home.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> select {}
<mask> }
<mask>
<mask> func httpServerLoop() {
<mask> for !httpsServer.shutdown {
<mask> httpsServer.cond.L.Lock()
<mask> // this mechanism doesn't let us through until all conditions are met
<mask> for config.TLS.Enabled == false ||
<mask> config.TLS.PortHTTPS == 0 ||
<mask> config.TLS.PrivateKey == "" ||
<mask> config.TLS.CertificateChain == "" { // sleep until necessary data is supplied
</s> * move "httpsServer" to "config" </s> remove httpsServer.cond.Wait()
</s> add config.httpsServer.cond.Wait() </s> remove if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && httpsServer.server != nil {
</s> add if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && config.httpsServer.server != nil { </s> remove httpsServer.cond.L.Lock()
httpsServer.cond.Broadcast()
if httpsServer.server != nil {
httpsServer.server.Shutdown(context.TODO())
</s> add config.httpsServer.cond.L.Lock()
config.httpsServer.cond.Broadcast()
if config.httpsServer.server != nil {
config.httpsServer.server.Shutdown(context.TODO()) </s> remove for !httpsServer.shutdown {
</s> add for !config.httpsServer.shutdown { </s> remove httpsServer.shutdown = true
if httpsServer.server != nil {
httpsServer.server.Shutdown(context.TODO())
</s> add config.httpsServer.shutdown = true
if config.httpsServer.server != nil {
config.httpsServer.server.Shutdown(context.TODO()) </s> remove if httpsServer.server != nil {
</s> add if config.httpsServer.server != nil { | https://github.com/AdguardTeam/AdGuardHome/commit/2780ace63e6950f7d685a499a20d36216416963b | home/home.go |
keep keep keep keep replace keep keep keep keep keep | <mask> for config.TLS.Enabled == false ||
<mask> config.TLS.PortHTTPS == 0 ||
<mask> config.TLS.PrivateKey == "" ||
<mask> config.TLS.CertificateChain == "" { // sleep until necessary data is supplied
<mask> httpsServer.cond.Wait()
<mask> }
<mask> address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.TLS.PortHTTPS))
<mask> // validate current TLS config and update warnings (it could have been loaded from file)
<mask> data := validateCertificates(config.TLS.CertificateChain, config.TLS.PrivateKey, config.TLS.ServerName)
<mask> if !data.ValidPair {
</s> * move "httpsServer" to "config" </s> remove for !httpsServer.shutdown {
httpsServer.cond.L.Lock()
</s> add for !config.httpsServer.shutdown {
config.httpsServer.cond.L.Lock() </s> remove if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && httpsServer.server != nil {
</s> add if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && config.httpsServer.server != nil { </s> add type HTTPSServer struct {
server *http.Server
cond *sync.Cond // reacts to config.TLS.Enabled, PortHTTPS, CertificateChain and PrivateKey
sync.Mutex // protects config.TLS
shutdown bool // if TRUE, don't restart the server
}
</s> remove for !httpsServer.shutdown {
</s> add for !config.httpsServer.shutdown { </s> remove httpsServer.cond.L.Lock()
httpsServer.cond.Broadcast()
if httpsServer.server != nil {
httpsServer.server.Shutdown(context.TODO())
</s> add config.httpsServer.cond.L.Lock()
config.httpsServer.cond.Broadcast()
if config.httpsServer.server != nil {
config.httpsServer.server.Shutdown(context.TODO()) </s> remove if httpsServer.server != nil {
</s> add if config.httpsServer.server != nil { | https://github.com/AdguardTeam/AdGuardHome/commit/2780ace63e6950f7d685a499a20d36216416963b | home/home.go |
keep replace keep keep replace keep keep | <mask> }
<mask> httpsServer.cond.L.Unlock()
<mask>
<mask> // prepare HTTPS server
<mask> httpsServer.server = &http.Server{
<mask> Addr: address,
<mask> TLSConfig: &tls.Config{
</s> * move "httpsServer" to "config" </s> remove for !httpsServer.shutdown {
</s> add for !config.httpsServer.shutdown { </s> remove httpsServer.cond.L.Lock()
httpsServer.cond.Broadcast()
if httpsServer.server != nil {
httpsServer.server.Shutdown(context.TODO())
</s> add config.httpsServer.cond.L.Lock()
config.httpsServer.cond.Broadcast()
if config.httpsServer.server != nil {
config.httpsServer.server.Shutdown(context.TODO()) </s> remove var httpsServer struct {
server *http.Server
cond *sync.Cond // reacts to config.TLS.Enabled, PortHTTPS, CertificateChain and PrivateKey
sync.Mutex // protects config.TLS
shutdown bool // if TRUE, don't restart the server
}
</s> add </s> remove httpsServer.cond.L.Unlock()
</s> add config.httpsServer.cond.L.Unlock() </s> remove httpsServer.shutdown = true
if httpsServer.server != nil {
httpsServer.server.Shutdown(context.TODO())
</s> add config.httpsServer.shutdown = true
if config.httpsServer.server != nil {
config.httpsServer.server.Shutdown(context.TODO()) | https://github.com/AdguardTeam/AdGuardHome/commit/2780ace63e6950f7d685a499a20d36216416963b | home/home.go |
keep keep keep keep replace keep keep keep keep keep | <mask> },
<mask> }
<mask>
<mask> printHTTPAddresses("https")
<mask> err = httpsServer.server.ListenAndServeTLS("", "")
<mask> if err != http.ErrServerClosed {
<mask> cleanupAlways()
<mask> log.Fatal(err)
<mask> }
<mask> }
</s> * move "httpsServer" to "config" </s> remove httpsServer.cond.L.Unlock()
</s> add config.httpsServer.cond.L.Unlock() </s> remove if httpsServer.server != nil {
</s> add if config.httpsServer.server != nil { </s> remove if httpsServer.server != nil {
</s> add if config.httpsServer.server != nil { </s> remove httpsServer.server = &http.Server{
</s> add config.httpsServer.server = &http.Server{ </s> remove if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && httpsServer.server != nil {
</s> add if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && config.httpsServer.server != nil { </s> remove httpsServer.shutdown = true
if httpsServer.server != nil {
httpsServer.server.Shutdown(context.TODO())
</s> add config.httpsServer.shutdown = true
if config.httpsServer.server != nil {
config.httpsServer.server.Shutdown(context.TODO()) | https://github.com/AdguardTeam/AdGuardHome/commit/2780ace63e6950f7d685a499a20d36216416963b | home/home.go |
keep keep keep keep replace replace replace keep keep keep keep keep | <mask> }
<mask>
<mask> // Stop HTTP server, possibly waiting for all active connections to be closed
<mask> func stopHTTPServer() {
<mask> httpsServer.shutdown = true
<mask> if httpsServer.server != nil {
<mask> httpsServer.server.Shutdown(context.TODO())
<mask> }
<mask> httpServer.Shutdown(context.TODO())
<mask> }
<mask>
<mask> // This function is called before application exits
</s> * move "httpsServer" to "config" </s> remove httpsServer.cond.L.Lock()
httpsServer.cond.Broadcast()
if httpsServer.server != nil {
httpsServer.server.Shutdown(context.TODO())
</s> add config.httpsServer.cond.L.Lock()
config.httpsServer.cond.Broadcast()
if config.httpsServer.server != nil {
config.httpsServer.server.Shutdown(context.TODO()) </s> remove httpsServer.cond.L.Unlock()
</s> add config.httpsServer.cond.L.Unlock() </s> remove if httpsServer.server != nil {
</s> add if config.httpsServer.server != nil { </s> remove if httpsServer.server != nil {
</s> add if config.httpsServer.server != nil { </s> remove for !httpsServer.shutdown {
httpsServer.cond.L.Lock()
</s> add for !config.httpsServer.shutdown {
config.httpsServer.cond.L.Lock() </s> remove if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && httpsServer.server != nil {
</s> add if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && config.httpsServer.server != nil { | https://github.com/AdguardTeam/AdGuardHome/commit/2780ace63e6950f7d685a499a20d36216416963b | home/home.go |
keep keep keep keep replace keep keep keep keep keep | <mask> return aghos.HaveAdminRights()
<mask> }
<mask>
<mask> func ifaceHasStaticIP(ifaceName string) (ok bool, err error) {
<mask> const filename = "/etc/rc.conf"
<mask>
<mask> return aghos.FileWalker(interfaceName(ifaceName).rcConfStaticConfig).Walk(filename)
<mask> }
<mask>
<mask> // rcConfStaticConfig checks if the interface is configured by /etc/rc.conf to
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove return aghos.FileWalker(interfaceName(ifaceName).rcConfStaticConfig).Walk(filename)
</s> add walker := aghos.FileWalker(interfaceName(ifaceName).rcConfStaticConfig)
return walker.Walk(aghos.RootDirFS(), rcConfFilename) </s> remove filename := fmt.Sprintf("/etc/hostname.%s", ifaceName)
</s> add filename := fmt.Sprintf("etc/hostname.%s", ifaceName) </s> remove return aghos.FileWalker(hostnameIfStaticConfig).Walk(filename)
</s> add return aghos.FileWalker(hostnameIfStaticConfig).Walk(aghos.RootDirFS(), filename) </s> remove // Walk starts walking the files defined by initPattern. It only returns true
// if c signed to stop walking.
func (c FileWalker) Walk(initPattern string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked
// since srcSet.Values() returns strings in undefined order.
</s> add // Walk starts walking the files in fsys defined by patterns from initial.
// It only returns true if fw signed to stop walking.
func (fw FileWalker) Walk(fsys fs.FS, initial ...string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked since
// srcSet.Values() returns strings in undefined order. </s> add const etcReleasePattern = "etc/*release*"
</s> remove // testFSDir maps entries' names to entries which should either be a testFSDir
// or byte slice.
type testFSDir map[string]interface{}
// testFSGen is used to generate a temporary filesystem consisting of
// directories and plain text files from itself.
type testFSGen testFSDir
// gen returns the name of top directory of the generated filesystem.
func (g testFSGen) gen(t *testing.T) (dirName string) {
t.Helper()
dirName = t.TempDir()
g.rangeThrough(t, dirName)
return dirName
}
func (g testFSGen) rangeThrough(t *testing.T, dirName string) {
const perm fs.FileMode = 0o777
for k, e := range g {
switch e := e.(type) {
case []byte:
require.NoError(t, os.WriteFile(filepath.Join(dirName, k), e, perm))
case testFSDir:
newDir := filepath.Join(dirName, k)
require.NoError(t, os.Mkdir(newDir, perm))
testFSGen(e).rangeThrough(t, newDir)
default:
t.Fatalf("unexpected entry type %T", e)
}
}
}
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghnet/net_freebsd.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> func ifaceHasStaticIP(ifaceName string) (ok bool, err error) {
<mask> const filename = "/etc/rc.conf"
<mask>
<mask> return aghos.FileWalker(interfaceName(ifaceName).rcConfStaticConfig).Walk(filename)
<mask> }
<mask>
<mask> // rcConfStaticConfig checks if the interface is configured by /etc/rc.conf to
<mask> // have a static IP.
<mask> func (n interfaceName) rcConfStaticConfig(r io.Reader) (_ []string, cont bool, err error) {
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove return aghos.FileWalker(hostnameIfStaticConfig).Walk(filename)
</s> add return aghos.FileWalker(hostnameIfStaticConfig).Walk(aghos.RootDirFS(), filename) </s> remove const filename = "/etc/rc.conf"
</s> add const rcConfFilename = "etc/rc.conf" </s> remove filename := fmt.Sprintf("/etc/hostname.%s", ifaceName)
</s> add filename := fmt.Sprintf("etc/hostname.%s", ifaceName) </s> add const etcReleasePattern = "etc/*release*"
</s> remove dir := testFSGen{
"bad_filename.txt": []byte("[]"),
}.gen(t)
fw := FileWalker(func(r io.Reader) (patterns []string, cont bool, err error) {
</s> add const filename = "bad_filename.txt"
f := fstest.MapFS{
filename: &fstest.MapFile{Data: []byte("[]")},
}
ok, err := FileWalker(func(r io.Reader) (patterns []string, cont bool, err error) { </s> remove makeFileWalker := func(dirName string) (fw FileWalker) {
</s> add makeFileWalker := func(_ string) (fw FileWalker) { | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghnet/net_freebsd.go |
keep keep replace keep keep keep keep replace keep | <mask> iface := interfaceName(ifaceName)
<mask>
<mask> for _, pair := range []struct {
<mask> aghos.FileWalker
<mask> filename string
<mask> }{{
<mask> FileWalker: iface.dhcpcdStaticConfig,
<mask> filename: "/etc/dhcpcd.conf",
<mask> }, {
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove filename: "/etc/network/interfaces",
</s> add filename: "etc/network/interfaces", </s> remove want bool
</s> add name string </s> remove const nl = "\n"
</s> add </s> remove name string
testFS testFSGen
</s> add testFS fstest.MapFS
want assert.BoolAssertionFunc </s> remove has, err = pair.Walk(pair.filename)
</s> add has, err = pair.Walk(aghos.RootDirFS(), pair.filename) | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghnet/net_linux.go |
keep keep replace keep replace keep keep keep keep | <mask> }, {
<mask> FileWalker: iface.ifacesStaticConfig,
<mask> filename: "/etc/network/interfaces",
<mask> }} {
<mask> has, err = pair.Walk(pair.filename)
<mask> if err != nil {
<mask> return false, err
<mask> }
<mask>
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove filename: "/etc/dhcpcd.conf",
</s> add filename: "etc/dhcpcd.conf", </s> remove if !clients.testing {
clients.updateFromDHCP(true)
if clients.dhcpServer != nil {
clients.dhcpServer.SetOnLeaseChanged(clients.onDHCPLeaseChanged)
}
if clients.etcHosts != nil {
clients.etcHosts.SetOnChanged(clients.onHostsChanged)
</s> add if clients.testing {
return
}
clients.updateFromDHCP(true)
if clients.dhcpServer != nil {
clients.dhcpServer.SetOnLeaseChanged(clients.onDHCPLeaseChanged)
}
go clients.handleHostsUpdates()
}
func (clients *clientsContainer) handleHostsUpdates() {
if clients.etcHosts != nil {
for upd := range clients.etcHosts.Upd() {
clients.addFromHostsFile(upd) </s> remove Context.etcHosts.Close()
</s> add if Context.etcHosts != nil {
if err = Context.etcHosts.Close(); err != nil {
log.Error("stopping hosts container: %s", err)
}
} </s> remove subsrc, err = handlePatterns(srcSet, patterns...)
</s> add subsrc, err = handlePatterns(fsys, srcSet, patterns...) </s> remove patterns, cont, err = checkFile(c, src[i])
</s> add patterns, cont, err = checkFile(fsys, fw, src[i]) | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghnet/net_linux.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
<mask> const nl = "\n"
<mask>
<mask> func TestDHCPCDStaticConfig(t *testing.T) {
<mask> const iface interfaceName = `wlan0`
<mask>
<mask> testCases := []struct {
<mask> name string
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove name string
testFS testFSGen
</s> add testFS fstest.MapFS
want assert.BoolAssertionFunc </s> remove want bool
</s> add name string </s> add func TestMain(m *testing.M) {
aghtest.DiscardLogOutput(m)
}
</s> remove // testFSDir maps entries' names to entries which should either be a testFSDir
// or byte slice.
type testFSDir map[string]interface{}
// testFSGen is used to generate a temporary filesystem consisting of
// directories and plain text files from itself.
type testFSGen testFSDir
// gen returns the name of top directory of the generated filesystem.
func (g testFSGen) gen(t *testing.T) (dirName string) {
t.Helper()
dirName = t.TempDir()
g.rangeThrough(t, dirName)
return dirName
}
func (g testFSGen) rangeThrough(t *testing.T, dirName string) {
const perm fs.FileMode = 0o777
for k, e := range g {
switch e := e.(type) {
case []byte:
require.NoError(t, os.WriteFile(filepath.Join(dirName, k), e, perm))
case testFSDir:
newDir := filepath.Join(dirName, k)
require.NoError(t, os.Mkdir(newDir, perm))
testFSGen(e).rangeThrough(t, newDir)
default:
t.Fatalf("unexpected entry type %T", e)
}
}
}
</s> add </s> remove for _, pair := range []struct {
</s> add for _, pair := range [...]struct { </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest" | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghnet/net_linux_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> return aghos.HaveAdminRights()
<mask> }
<mask>
<mask> func ifaceHasStaticIP(ifaceName string) (ok bool, err error) {
<mask> filename := fmt.Sprintf("/etc/hostname.%s", ifaceName)
<mask>
<mask> return aghos.FileWalker(hostnameIfStaticConfig).Walk(filename)
<mask> }
<mask>
<mask> // hostnameIfStaticConfig checks if the interface is configured by
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove return aghos.FileWalker(hostnameIfStaticConfig).Walk(filename)
</s> add return aghos.FileWalker(hostnameIfStaticConfig).Walk(aghos.RootDirFS(), filename) </s> remove const filename = "/etc/rc.conf"
</s> add const rcConfFilename = "etc/rc.conf" </s> remove return aghos.FileWalker(interfaceName(ifaceName).rcConfStaticConfig).Walk(filename)
</s> add walker := aghos.FileWalker(interfaceName(ifaceName).rcConfStaticConfig)
return walker.Walk(aghos.RootDirFS(), rcConfFilename) </s> remove // Walk starts walking the files defined by initPattern. It only returns true
// if c signed to stop walking.
func (c FileWalker) Walk(initPattern string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked
// since srcSet.Values() returns strings in undefined order.
</s> add // Walk starts walking the files in fsys defined by patterns from initial.
// It only returns true if fw signed to stop walking.
func (fw FileWalker) Walk(fsys fs.FS, initial ...string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked since
// srcSet.Values() returns strings in undefined order. </s> remove func (clients *clientsContainer) onHostsChanged() {
clients.addFromHostsFile()
}
</s> add </s> add type errFS struct {
fs.GlobFS
}
const errErrFSOpen errors.Error = "this error is always returned"
func (efs *errFS) Open(name string) (fs.File, error) {
return nil, errErrFSOpen
}
| https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghnet/net_openbsd.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> func ifaceHasStaticIP(ifaceName string) (ok bool, err error) {
<mask> filename := fmt.Sprintf("/etc/hostname.%s", ifaceName)
<mask>
<mask> return aghos.FileWalker(hostnameIfStaticConfig).Walk(filename)
<mask> }
<mask>
<mask> // hostnameIfStaticConfig checks if the interface is configured by
<mask> // /etc/hostname.* to have a static IP.
<mask> func hostnameIfStaticConfig(r io.Reader) (_ []string, ok bool, err error) {
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove filename := fmt.Sprintf("/etc/hostname.%s", ifaceName)
</s> add filename := fmt.Sprintf("etc/hostname.%s", ifaceName) </s> remove return aghos.FileWalker(interfaceName(ifaceName).rcConfStaticConfig).Walk(filename)
</s> add walker := aghos.FileWalker(interfaceName(ifaceName).rcConfStaticConfig)
return walker.Walk(aghos.RootDirFS(), rcConfFilename) </s> remove const filename = "/etc/rc.conf"
</s> add const rcConfFilename = "etc/rc.conf" </s> add const etcReleasePattern = "etc/*release*"
</s> remove makeFileWalker := func(dirName string) (fw FileWalker) {
</s> add makeFileWalker := func(_ string) (fw FileWalker) { </s> remove dir := testFSGen{
"bad_filename.txt": []byte("[]"),
}.gen(t)
fw := FileWalker(func(r io.Reader) (patterns []string, cont bool, err error) {
</s> add const filename = "bad_filename.txt"
f := fstest.MapFS{
filename: &fstest.MapFile{Data: []byte("[]")},
}
ok, err := FileWalker(func(r io.Reader) (patterns []string, cont bool, err error) { | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghnet/net_openbsd.go |
keep keep add keep keep keep keep | <mask> "net"
<mask> "testing"
<mask>
<mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> add "testing/fstest" </s> remove "os"
"path/filepath"
</s> add "path" </s> remove const nl = "\n"
</s> add </s> add "sync/atomic" </s> add "testing/fstest" </s> remove "os"
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghnet/net_test.go |
keep keep keep add keep keep keep keep keep | <mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
<mask> func TestGetValidNetInterfacesForWeb(t *testing.T) {
<mask> ifaces, err := GetValidNetInterfacesForWeb()
<mask> require.NoErrorf(t, err, "cannot get net interfaces: %s", err)
<mask> require.NotEmpty(t, ifaces, "no net interfaces found")
<mask> for _, iface := range ifaces {
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove const nl = "\n"
</s> add </s> remove for _, pair := range []struct {
</s> add for _, pair := range [...]struct { </s> remove testDir := tc.testFS.gen(t)
fw := makeFileWalker(testDir)
</s> add fw := makeFileWalker("") </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest" </s> add "testing/fstest" </s> remove assert.ErrorIs(t, err, rerr)
</s> add assert.False(t, ok) | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghnet/net_test.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask>
<mask> import (
<mask> "fmt"
<mask> "io"
<mask> "os"
<mask> "path/filepath"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghio"
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/golibs/stringutil"
<mask> )
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove "os"
"path/filepath"
</s> add "path" </s> add "io/fs"
"os" </s> remove "os"
</s> add </s> add "testing/fstest" </s> add "sync/atomic" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest" | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker.go |
keep keep keep keep replace replace keep replace | <mask>
<mask> // FileWalker is the signature of a function called for files in the file tree.
<mask> // As opposed to filepath.Walk it only walk the files (not directories) matching
<mask> // the provided pattern and those returned by function itself. All patterns
<mask> // should be valid for filepath.Glob. If cont is false, the walking terminates.
<mask> // Each opened file is also limited for reading to MaxWalkedFileSize.
<mask> //
<mask> // TODO(e.burkov): Consider moving to the separate package like pathutil.
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove // checkFile tries to open and process a single file located on sourcePath.
func checkFile(c FileWalker, sourcePath string) (patterns []string, cont bool, err error) {
var f *os.File
f, err = os.Open(sourcePath)
</s> add // checkFile tries to open and process a single file located on sourcePath in
// the specified fsys. The path is skipped if it's a directory.
func checkFile(
fsys fs.FS,
c FileWalker,
sourcePath string,
) (patterns []string, cont bool, err error) {
var f fs.File
f, err = fsys.Open(sourcePath) </s> remove // Walk starts walking the files defined by initPattern. It only returns true
// if c signed to stop walking.
func (c FileWalker) Walk(initPattern string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked
// since srcSet.Values() returns strings in undefined order.
</s> add // Walk starts walking the files in fsys defined by patterns from initial.
// It only returns true if fw signed to stop walking.
func (fw FileWalker) Walk(fsys fs.FS, initial ...string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked since
// srcSet.Values() returns strings in undefined order. </s> remove // A rewrite of a host to itself. Go on and try
// matching other things.
</s> add // A rewrite of a host to itself. Go on and try matching other
// things. </s> remove d.engineLock.RLock()
// Keep in mind that this lock must be held no just when calling Match()
// but also while using the rules returned by it.
defer d.engineLock.RUnlock()
</s> add </s> remove if errors.Is(err, os.ErrNotExist) {
// Ignore non-existing files since this may only happen
// when the file was removed after filepath.Glob matched
// it.
</s> add if errors.Is(err, fs.ErrNotExist) {
// Ignore non-existing files since this may only happen when the
// file was removed after filepath.Glob matched it. | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker.go |
keep keep keep keep replace replace replace replace keep replace replace replace replace | <mask> // MaxWalkedFileSize is the maximum length of the file that FileWalker can
<mask> // check.
<mask> const MaxWalkedFileSize = 1024 * 1024
<mask>
<mask> // checkFile tries to open and process a single file located on sourcePath.
<mask> func checkFile(c FileWalker, sourcePath string) (patterns []string, cont bool, err error) {
<mask> var f *os.File
<mask> f, err = os.Open(sourcePath)
<mask> if err != nil {
<mask> if errors.Is(err, os.ErrNotExist) {
<mask> // Ignore non-existing files since this may only happen
<mask> // when the file was removed after filepath.Glob matched
<mask> // it.
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove // TODO(e.burkov): Consider moving to the separate package like pathutil.
</s> add // TODO(e.burkov, a.garipov): Move into another package like aghfs. </s> remove // should be valid for filepath.Glob. If cont is false, the walking terminates.
// Each opened file is also limited for reading to MaxWalkedFileSize.
</s> add // should be valid for fs.Glob. If cont is false, the walking terminates. Each
// opened file is also limited for reading to MaxWalkedFileSize. </s> remove // Walk starts walking the files defined by initPattern. It only returns true
// if c signed to stop walking.
func (c FileWalker) Walk(initPattern string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked
// since srcSet.Values() returns strings in undefined order.
</s> add // Walk starts walking the files in fsys defined by patterns from initial.
// It only returns true if fw signed to stop walking.
func (fw FileWalker) Walk(fsys fs.FS, initial ...string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked since
// srcSet.Values() returns strings in undefined order. </s> remove return aghos.FileWalker(interfaceName(ifaceName).rcConfStaticConfig).Walk(filename)
</s> add walker := aghos.FileWalker(interfaceName(ifaceName).rcConfStaticConfig)
return walker.Walk(aghos.RootDirFS(), rcConfFilename) </s> remove // testFSDir maps entries' names to entries which should either be a testFSDir
// or byte slice.
type testFSDir map[string]interface{}
// testFSGen is used to generate a temporary filesystem consisting of
// directories and plain text files from itself.
type testFSGen testFSDir
// gen returns the name of top directory of the generated filesystem.
func (g testFSGen) gen(t *testing.T) (dirName string) {
t.Helper()
dirName = t.TempDir()
g.rangeThrough(t, dirName)
return dirName
}
func (g testFSGen) rangeThrough(t *testing.T, dirName string) {
const perm fs.FileMode = 0o777
for k, e := range g {
switch e := e.(type) {
case []byte:
require.NoError(t, os.WriteFile(filepath.Join(dirName, k), e, perm))
case testFSDir:
newDir := filepath.Join(dirName, k)
require.NoError(t, os.Mkdir(newDir, perm))
testFSGen(e).rangeThrough(t, newDir)
default:
t.Fatalf("unexpected entry type %T", e)
}
}
}
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker.go |
keep add keep keep keep keep keep keep | <mask> defer func() { err = errors.WithDeferred(err, f.Close()) }()
<mask>
<mask> var r io.Reader
<mask> // Ignore the error since LimitReader function returns error only if passed
<mask> // limit value is less than zero, but the constant used.
<mask> //
<mask> // TODO(e.burkov): Make variable.
<mask> r, _ = aghio.LimitReader(f, MaxWalkedFileSize)
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove // Ignore the error since LimitReader function returns error only if
// passed limit value is less than zero, but the constant used.
</s> add // Ignore the error since LimitReader function returns error only if passed
// limit value is less than zero, but the constant used. </s> remove if errors.Is(err, os.ErrNotExist) {
// Ignore non-existing files since this may only happen
// when the file was removed after filepath.Glob matched
// it.
</s> add if errors.Is(err, fs.ErrNotExist) {
// Ignore non-existing files since this may only happen when the
// file was removed after filepath.Glob matched it. </s> remove d.engineLock.Lock()
d.reset()
d.rulesStorage = rulesStorage
d.filteringEngine = filteringEngine
d.rulesStorageAllow = rulesStorageAllow
d.filteringEngineAllow = filteringEngineAllow
d.engineLock.Unlock()
</s> add func() {
d.engineLock.Lock()
defer d.engineLock.Unlock()
d.reset()
d.rulesStorage = rulesStorage
d.filteringEngine = filteringEngine
d.rulesStorageAllow = rulesStorageAllow
d.filteringEngineAllow = filteringEngineAllow
}() </s> remove const badPath = "\x00"
_, ok, err := checkFile(nil, badPath)
require.Error(t, err)
</s> add _, ok, err := checkFile(&errFS{}, nil, "")
require.ErrorIs(t, err, errErrFSOpen) </s> remove // Walk starts walking the files defined by initPattern. It only returns true
// if c signed to stop walking.
func (c FileWalker) Walk(initPattern string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked
// since srcSet.Values() returns strings in undefined order.
</s> add // Walk starts walking the files in fsys defined by patterns from initial.
// It only returns true if fw signed to stop walking.
func (fw FileWalker) Walk(fsys fs.FS, initial ...string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked since
// srcSet.Values() returns strings in undefined order. </s> add d.engineLock.RLock()
// Keep in mind that this lock must be held no just when calling Match() but
// also while using the rules returned by it.
//
// TODO(e.burkov): Inspect if the above is true.
defer d.engineLock.RUnlock()
| https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> }
<mask> defer func() { err = errors.WithDeferred(err, f.Close()) }()
<mask>
<mask> var r io.Reader
<mask> // Ignore the error since LimitReader function returns error only if
<mask> // passed limit value is less than zero, but the constant used.
<mask> //
<mask> // TODO(e.burkov): Make variable.
<mask> r, _ = aghio.LimitReader(f, MaxWalkedFileSize)
<mask>
<mask> return c(r)
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> add var fi fs.FileInfo
if fi, err = f.Stat(); err != nil {
return nil, true, err
}
if fi.IsDir() {
// Skip the directories.
return nil, true, nil
}
</s> remove if errors.Is(err, os.ErrNotExist) {
// Ignore non-existing files since this may only happen
// when the file was removed after filepath.Glob matched
// it.
</s> add if errors.Is(err, fs.ErrNotExist) {
// Ignore non-existing files since this may only happen when the
// file was removed after filepath.Glob matched it. </s> remove d.engineLock.Lock()
d.reset()
d.rulesStorage = rulesStorage
d.filteringEngine = filteringEngine
d.rulesStorageAllow = rulesStorageAllow
d.filteringEngineAllow = filteringEngineAllow
d.engineLock.Unlock()
</s> add func() {
d.engineLock.Lock()
defer d.engineLock.Unlock()
d.reset()
d.rulesStorage = rulesStorage
d.filteringEngine = filteringEngine
d.rulesStorageAllow = rulesStorageAllow
d.filteringEngineAllow = filteringEngineAllow
}() </s> remove // Walk starts walking the files defined by initPattern. It only returns true
// if c signed to stop walking.
func (c FileWalker) Walk(initPattern string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked
// since srcSet.Values() returns strings in undefined order.
</s> add // Walk starts walking the files in fsys defined by patterns from initial.
// It only returns true if fw signed to stop walking.
func (fw FileWalker) Walk(fsys fs.FS, initial ...string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked since
// srcSet.Values() returns strings in undefined order. </s> add d.engineLock.RLock()
// Keep in mind that this lock must be held no just when calling Match() but
// also while using the rules returned by it.
//
// TODO(e.burkov): Inspect if the above is true.
defer d.engineLock.RUnlock()
</s> remove const badPath = "\x00"
_, ok, err := checkFile(nil, badPath)
require.Error(t, err)
</s> add _, ok, err := checkFile(&errFS{}, nil, "")
require.ErrorIs(t, err, errErrFSOpen) | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker.go |
keep keep replace replace replace keep keep keep replace keep | <mask> }
<mask>
<mask> // handlePatterns parses the patterns and ignores duplicates using srcSet.
<mask> // srcSet must be non-nil.
<mask> func handlePatterns(srcSet *stringutil.Set, patterns ...string) (sub []string, err error) {
<mask> sub = make([]string, 0, len(patterns))
<mask> for _, p := range patterns {
<mask> var matches []string
<mask> matches, err = filepath.Glob(p)
<mask> if err != nil {
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove patterns, cont, err = checkFile(c, src[i])
</s> add patterns, cont, err = checkFile(fsys, fw, src[i]) </s> remove patterns = append(patterns, filepath.Join(dirName, line))
</s> add patterns = append(patterns, path.Join(".", line)) </s> remove // Walk starts walking the files defined by initPattern. It only returns true
// if c signed to stop walking.
func (c FileWalker) Walk(initPattern string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked
// since srcSet.Values() returns strings in undefined order.
</s> add // Walk starts walking the files in fsys defined by patterns from initial.
// It only returns true if fw signed to stop walking.
func (fw FileWalker) Walk(fsys fs.FS, initial ...string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked since
// srcSet.Values() returns strings in undefined order. </s> remove revHosts := d.Config.EtcHosts.ProcessReverse(host, qtype)
if len(revHosts) != 0 {
res = Result{
Reason: RewrittenAutoHosts,
}
</s> add var ips []net.IP
var revHosts []string </s> remove dir := testFSGen{
"bad_filename.txt": []byte("[]"),
}.gen(t)
fw := FileWalker(func(r io.Reader) (patterns []string, cont bool, err error) {
</s> add const filename = "bad_filename.txt"
f := fstest.MapFS{
filename: &fstest.MapFile{Data: []byte("[]")},
}
ok, err := FileWalker(func(r io.Reader) (patterns []string, cont bool, err error) { | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker.go |
keep replace replace replace replace replace keep keep replace keep keep keep keep | <mask>
<mask> // Walk starts walking the files defined by initPattern. It only returns true
<mask> // if c signed to stop walking.
<mask> func (c FileWalker) Walk(initPattern string) (ok bool, err error) {
<mask> // The slice of sources keeps the order in which the files are walked
<mask> // since srcSet.Values() returns strings in undefined order.
<mask> srcSet := stringutil.NewSet()
<mask> var src []string
<mask> src, err = handlePatterns(srcSet, initPattern)
<mask> if err != nil {
<mask> return false, err
<mask> }
<mask>
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove // AddHost adds a new IP-hostname pairing. The priorities of the sources is
</s> add // AddHost adds a new IP-hostname pairing. The priorities of the sources are </s> remove if errors.Is(err, os.ErrNotExist) {
// Ignore non-existing files since this may only happen
// when the file was removed after filepath.Glob matched
// it.
</s> add if errors.Is(err, fs.ErrNotExist) {
// Ignore non-existing files since this may only happen when the
// file was removed after filepath.Glob matched it. </s> remove // checkFile tries to open and process a single file located on sourcePath.
func checkFile(c FileWalker, sourcePath string) (patterns []string, cont bool, err error) {
var f *os.File
f, err = os.Open(sourcePath)
</s> add // checkFile tries to open and process a single file located on sourcePath in
// the specified fsys. The path is skipped if it's a directory.
func checkFile(
fsys fs.FS,
c FileWalker,
sourcePath string,
) (patterns []string, cont bool, err error) {
var f fs.File
f, err = fsys.Open(sourcePath) </s> remove // should be valid for filepath.Glob. If cont is false, the walking terminates.
// Each opened file is also limited for reading to MaxWalkedFileSize.
</s> add // should be valid for fs.Glob. If cont is false, the walking terminates. Each
// opened file is also limited for reading to MaxWalkedFileSize. </s> remove // processDNSRewrites processes DNS rewrite rules in dnsr. It returns
// an empty result if dnsr is empty. Otherwise, the result will have
// either CanonName or DNSRewriteResult set.
</s> add // processDNSRewrites processes DNS rewrite rules in dnsr. It returns an empty
// result if dnsr is empty. Otherwise, the result will have either CanonName or
// DNSRewriteResult set. | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker.go |
keep keep keep keep replace keep keep keep keep keep | <mask> for i := 0; i < len(src); i++ {
<mask> var patterns []string
<mask> var cont bool
<mask> filename = src[i]
<mask> patterns, cont, err = checkFile(c, src[i])
<mask> if err != nil {
<mask> return false, err
<mask> }
<mask>
<mask> if !cont {
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove revHosts := d.Config.EtcHosts.ProcessReverse(host, qtype)
if len(revHosts) != 0 {
res = Result{
Reason: RewrittenAutoHosts,
}
</s> add var ips []net.IP
var revHosts []string </s> remove patterns = append(patterns, filepath.Join(dirName, line))
</s> add patterns = append(patterns, path.Join(".", line)) </s> remove subsrc, err = handlePatterns(srcSet, patterns...)
</s> add subsrc, err = handlePatterns(fsys, srcSet, patterns...) </s> remove matches, err = filepath.Glob(p)
</s> add matches, err = fs.Glob(fsys, p) </s> remove src, err = handlePatterns(srcSet, initPattern)
</s> add src, err = handlePatterns(fsys, srcSet, initial...) </s> remove // TODO(a.garipov): Optimize this with a buffer.
res.ReverseHosts = make([]string, len(revHosts))
for i := range revHosts {
res.ReverseHosts[i] = revHosts[i] + "."
</s> add for _, nr := range dnsr {
dr := nr.DNSRewrite
if dr == nil {
continue | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker.go |
keep keep keep keep replace keep keep keep keep keep | <mask> return true, nil
<mask> }
<mask>
<mask> var subsrc []string
<mask> subsrc, err = handlePatterns(srcSet, patterns...)
<mask> if err != nil {
<mask> return false, err
<mask> }
<mask>
<mask> src = append(src, subsrc...)
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove src, err = handlePatterns(srcSet, initPattern)
</s> add src, err = handlePatterns(fsys, srcSet, initial...) </s> remove patterns, cont, err = checkFile(c, src[i])
</s> add patterns, cont, err = checkFile(fsys, fw, src[i]) </s> remove patterns = append(patterns, filepath.Join(dirName, line))
</s> add patterns = append(patterns, path.Join(".", line)) </s> remove revHosts := d.Config.EtcHosts.ProcessReverse(host, qtype)
if len(revHosts) != 0 {
res = Result{
Reason: RewrittenAutoHosts,
}
</s> add var ips []net.IP
var revHosts []string </s> add var fi fs.FileInfo
if fi, err = f.Stat(); err != nil {
return nil, true, err
}
if fi.IsDir() {
// Skip the directories.
return nil, true, nil
}
</s> remove // Walk starts walking the files defined by initPattern. It only returns true
// if c signed to stop walking.
func (c FileWalker) Walk(initPattern string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked
// since srcSet.Values() returns strings in undefined order.
</s> add // Walk starts walking the files in fsys defined by patterns from initial.
// It only returns true if fw signed to stop walking.
func (fw FileWalker) Walk(fsys fs.FS, initial ...string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked since
// srcSet.Values() returns strings in undefined order. | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> import (
<mask> "bufio"
<mask> "io"
<mask> "io/fs"
<mask> "os"
<mask> "path/filepath"
<mask> "testing"
<mask>
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove "os"
"path/filepath"
</s> add "io/fs" </s> add "testing/fstest" </s> add "io/fs"
"os" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest" </s> remove "os"
</s> add </s> remove const nl = "\n"
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep add keep keep keep keep keep | <mask> "path"
<mask> "testing"
<mask>
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove "os"
"path/filepath"
</s> add "path" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest" </s> remove const nl = "\n"
</s> add </s> remove "os"
"path/filepath"
</s> add "io/fs" </s> add func TestMain(m *testing.M) {
aghtest.DiscardLogOutput(m)
}
</s> add "io/fs"
"os" | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep | <mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
<mask> // testFSDir maps entries' names to entries which should either be a testFSDir
<mask> // or byte slice.
<mask> type testFSDir map[string]interface{}
<mask>
<mask> // testFSGen is used to generate a temporary filesystem consisting of
<mask> // directories and plain text files from itself.
<mask> type testFSGen testFSDir
<mask>
<mask> // gen returns the name of top directory of the generated filesystem.
<mask> func (g testFSGen) gen(t *testing.T) (dirName string) {
<mask> t.Helper()
<mask>
<mask> dirName = t.TempDir()
<mask> g.rangeThrough(t, dirName)
<mask>
<mask> return dirName
<mask> }
<mask>
<mask> func (g testFSGen) rangeThrough(t *testing.T, dirName string) {
<mask> const perm fs.FileMode = 0o777
<mask>
<mask> for k, e := range g {
<mask> switch e := e.(type) {
<mask> case []byte:
<mask> require.NoError(t, os.WriteFile(filepath.Join(dirName, k), e, perm))
<mask>
<mask> case testFSDir:
<mask> newDir := filepath.Join(dirName, k)
<mask> require.NoError(t, os.Mkdir(newDir, perm))
<mask>
<mask> testFSGen(e).rangeThrough(t, newDir)
<mask> default:
<mask> t.Fatalf("unexpected entry type %T", e)
<mask> }
<mask> }
<mask> }
<mask>
<mask> func TestFileWalker_Walk(t *testing.T) {
<mask> const attribute = `000`
<mask>
<mask> makeFileWalker := func(dirName string) (fw FileWalker) {
<mask> return func(r io.Reader) (patterns []string, cont bool, err error) {
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove makeFileWalker := func(dirName string) (fw FileWalker) {
</s> add makeFileWalker := func(_ string) (fw FileWalker) { </s> add type errFS struct {
fs.GlobFS
}
const errErrFSOpen errors.Error = "this error is always returned"
func (efs *errFS) Open(name string) (fs.File, error) {
return nil, errErrFSOpen
}
</s> remove return aghos.FileWalker(interfaceName(ifaceName).rcConfStaticConfig).Walk(filename)
</s> add walker := aghos.FileWalker(interfaceName(ifaceName).rcConfStaticConfig)
return walker.Walk(aghos.RootDirFS(), rcConfFilename) </s> remove // Walk starts walking the files defined by initPattern. It only returns true
// if c signed to stop walking.
func (c FileWalker) Walk(initPattern string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked
// since srcSet.Values() returns strings in undefined order.
</s> add // Walk starts walking the files in fsys defined by patterns from initial.
// It only returns true if fw signed to stop walking.
func (fw FileWalker) Walk(fsys fs.FS, initial ...string) (ok bool, err error) {
// The slice of sources keeps the order in which the files are walked since
// srcSet.Values() returns strings in undefined order. </s> remove return aghos.FileWalker(hostnameIfStaticConfig).Walk(filename)
</s> add return aghos.FileWalker(hostnameIfStaticConfig).Walk(aghos.RootDirFS(), filename) </s> remove // checkFile tries to open and process a single file located on sourcePath.
func checkFile(c FileWalker, sourcePath string) (patterns []string, cont bool, err error) {
var f *os.File
f, err = os.Open(sourcePath)
</s> add // checkFile tries to open and process a single file located on sourcePath in
// the specified fsys. The path is skipped if it's a directory.
func checkFile(
fsys fs.FS,
c FileWalker,
sourcePath string,
) (patterns []string, cont bool, err error) {
var f fs.File
f, err = fsys.Open(sourcePath) | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> func TestFileWalker_Walk(t *testing.T) {
<mask> const attribute = `000`
<mask>
<mask> makeFileWalker := func(dirName string) (fw FileWalker) {
<mask> return func(r io.Reader) (patterns []string, cont bool, err error) {
<mask> s := bufio.NewScanner(r)
<mask> for s.Scan() {
<mask> line := s.Text()
<mask> if line == attribute {
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove dir := testFSGen{
"bad_filename.txt": []byte("[]"),
}.gen(t)
fw := FileWalker(func(r io.Reader) (patterns []string, cont bool, err error) {
</s> add const filename = "bad_filename.txt"
f := fstest.MapFS{
filename: &fstest.MapFile{Data: []byte("[]")},
}
ok, err := FileWalker(func(r io.Reader) (patterns []string, cont bool, err error) { </s> remove // testFSDir maps entries' names to entries which should either be a testFSDir
// or byte slice.
type testFSDir map[string]interface{}
// testFSGen is used to generate a temporary filesystem consisting of
// directories and plain text files from itself.
type testFSGen testFSDir
// gen returns the name of top directory of the generated filesystem.
func (g testFSGen) gen(t *testing.T) (dirName string) {
t.Helper()
dirName = t.TempDir()
g.rangeThrough(t, dirName)
return dirName
}
func (g testFSGen) rangeThrough(t *testing.T, dirName string) {
const perm fs.FileMode = 0o777
for k, e := range g {
switch e := e.(type) {
case []byte:
require.NoError(t, os.WriteFile(filepath.Join(dirName, k), e, perm))
case testFSDir:
newDir := filepath.Join(dirName, k)
require.NoError(t, os.Mkdir(newDir, perm))
testFSGen(e).rangeThrough(t, newDir)
default:
t.Fatalf("unexpected entry type %T", e)
}
}
}
</s> add </s> remove return aghos.FileWalker(interfaceName(ifaceName).rcConfStaticConfig).Walk(filename)
</s> add walker := aghos.FileWalker(interfaceName(ifaceName).rcConfStaticConfig)
return walker.Walk(aghos.RootDirFS(), rcConfFilename) </s> remove dir := testFSGen{
"mockfile.txt": []byte(`mockdata`),
}.gen(t)
</s> add f := fstest.MapFS{
"mockfile.txt": &fstest.MapFile{Data: []byte(`mockdata`)},
} </s> add const etcReleasePattern = "etc/*release*"
</s> remove return aghos.FileWalker(hostnameIfStaticConfig).Walk(filename)
</s> add return aghos.FileWalker(hostnameIfStaticConfig).Walk(aghos.RootDirFS(), filename) | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> return nil, false, nil
<mask> }
<mask>
<mask> if len(line) != 0 {
<mask> patterns = append(patterns, filepath.Join(dirName, line))
<mask> }
<mask> }
<mask>
<mask> return patterns, true, s.Err()
<mask> }
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove })
ok, err := fw.Walk(filepath.Join(dir, "bad_filename.txt"))
</s> add }).Walk(f, filename) </s> remove patterns, cont, err = checkFile(c, src[i])
</s> add patterns, cont, err = checkFile(fsys, fw, src[i]) </s> remove return res, nil
</s> add dnsr := dnsres.DNSRewrites()
if len(dnsr) == 0 {
return Result{}, nil </s> remove subsrc, err = handlePatterns(srcSet, patterns...)
</s> add subsrc, err = handlePatterns(fsys, srcSet, patterns...) </s> remove }).Walk("/etc/*release*")
</s> add }).Walk(RootDirFS(), etcReleasePattern) </s> remove if !clients.testing {
clients.updateFromDHCP(true)
if clients.dhcpServer != nil {
clients.dhcpServer.SetOnLeaseChanged(clients.onDHCPLeaseChanged)
}
if clients.etcHosts != nil {
clients.etcHosts.SetOnChanged(clients.onHostsChanged)
</s> add if clients.testing {
return
}
clients.updateFromDHCP(true)
if clients.dhcpServer != nil {
clients.dhcpServer.SetOnLeaseChanged(clients.onDHCPLeaseChanged)
}
go clients.handleHostsUpdates()
}
func (clients *clientsContainer) handleHostsUpdates() {
if clients.etcHosts != nil {
for upd := range clients.etcHosts.Upd() {
clients.addFromHostsFile(upd) | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep replace replace keep replace keep | <mask> testCases := []struct {
<mask> name string
<mask> testFS testFSGen
<mask> initPattern string
<mask> want bool
<mask> }{{
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove testFS: testFSGen{
"simple_0001.txt": []byte(attribute + nl),
</s> add testFS: fstest.MapFS{
"simple_0001.txt": &fstest.MapFile{Data: []byte(attribute + nl)}, </s> remove const nl = "\n"
</s> add </s> remove for _, pair := range []struct {
</s> add for _, pair := range [...]struct { </s> remove filename: "/etc/dhcpcd.conf",
</s> add filename: "etc/dhcpcd.conf", </s> remove // ServiceName is the name of the blocked service. It is empty
// unless Reason is set to FilteredBlockedService.
</s> add // ServiceName is the name of the blocked service. It is empty unless
// Reason is set to FilteredBlockedService. | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep keep keep keep replace replace keep keep replace keep keep keep | <mask> initPattern string
<mask> want bool
<mask> }{{
<mask> name: "simple",
<mask> testFS: testFSGen{
<mask> "simple_0001.txt": []byte(attribute + nl),
<mask> },
<mask> initPattern: "simple_0001.txt",
<mask> want: true,
<mask> }, {
<mask> name: "chain",
<mask> testFS: testFSGen{
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove want bool
</s> add name string </s> remove testFS: testFSGen{
"chain_0001.txt": []byte(`chain_0002.txt` + nl),
"chain_0002.txt": []byte(`chain_0003.txt` + nl),
"chain_0003.txt": []byte(attribute + nl),
</s> add testFS: fstest.MapFS{
"chain_0001.txt": &fstest.MapFile{Data: []byte(`chain_0002.txt` + nl)},
"chain_0002.txt": &fstest.MapFile{Data: []byte(`chain_0003.txt` + nl)},
"chain_0003.txt": &fstest.MapFile{Data: []byte(attribute + nl)}, </s> remove name string
testFS testFSGen
</s> add testFS fstest.MapFS
want assert.BoolAssertionFunc </s> remove testFS: testFSGen{
"dir": testFSDir{
"subdir_0002.txt": []byte(attribute + nl),
</s> add testFS: fstest.MapFS{
path.Join("dir", "subdir_0002.txt"): &fstest.MapFile{
Data: []byte(attribute + nl), </s> remove testFS: testFSGen{
"several_0001.txt": []byte(`several_*` + nl),
"several_0002.txt": []byte(`several_0001.txt` + nl),
"several_0003.txt": []byte(attribute + nl),
</s> add testFS: fstest.MapFS{
"several_0001.txt": &fstest.MapFile{Data: []byte(`several_*` + nl)},
"several_0002.txt": &fstest.MapFile{Data: []byte(`several_0001.txt` + nl)},
"several_0003.txt": &fstest.MapFile{Data: []byte(attribute + nl)}, | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep keep keep keep replace replace replace replace keep keep replace keep keep keep keep | <mask> initPattern: "simple_0001.txt",
<mask> want: true,
<mask> }, {
<mask> name: "chain",
<mask> testFS: testFSGen{
<mask> "chain_0001.txt": []byte(`chain_0002.txt` + nl),
<mask> "chain_0002.txt": []byte(`chain_0003.txt` + nl),
<mask> "chain_0003.txt": []byte(attribute + nl),
<mask> },
<mask> initPattern: "chain_0001.txt",
<mask> want: true,
<mask> }, {
<mask> name: "several",
<mask> testFS: testFSGen{
<mask> "several_0001.txt": []byte(`several_*` + nl),
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove want: true,
</s> add want: assert.True, </s> remove testFS: testFSGen{
"several_0001.txt": []byte(`several_*` + nl),
"several_0002.txt": []byte(`several_0001.txt` + nl),
"several_0003.txt": []byte(attribute + nl),
</s> add testFS: fstest.MapFS{
"several_0001.txt": &fstest.MapFile{Data: []byte(`several_*` + nl)},
"several_0002.txt": &fstest.MapFile{Data: []byte(`several_0001.txt` + nl)},
"several_0003.txt": &fstest.MapFile{Data: []byte(attribute + nl)}, </s> remove testFS: testFSGen{
"simple_0001.txt": []byte(attribute + nl),
</s> add testFS: fstest.MapFS{
"simple_0001.txt": &fstest.MapFile{Data: []byte(attribute + nl)}, </s> remove testFS: testFSGen{
"dir": testFSDir{
"subdir_0002.txt": []byte(attribute + nl),
</s> add testFS: fstest.MapFS{
path.Join("dir", "subdir_0002.txt"): &fstest.MapFile{
Data: []byte(attribute + nl), </s> remove want: true,
</s> add want: assert.True, | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep replace replace replace replace keep keep replace keep keep keep keep | <mask> name: "several",
<mask> testFS: testFSGen{
<mask> "several_0001.txt": []byte(`several_*` + nl),
<mask> "several_0002.txt": []byte(`several_0001.txt` + nl),
<mask> "several_0003.txt": []byte(attribute + nl),
<mask> },
<mask> initPattern: "several_0001.txt",
<mask> want: true,
<mask> }, {
<mask> name: "no",
<mask> testFS: testFSGen{
<mask> "no_0001.txt": []byte(nl),
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove want: true,
</s> add want: assert.True, </s> remove testFS: testFSGen{
"chain_0001.txt": []byte(`chain_0002.txt` + nl),
"chain_0002.txt": []byte(`chain_0003.txt` + nl),
"chain_0003.txt": []byte(attribute + nl),
</s> add testFS: fstest.MapFS{
"chain_0001.txt": &fstest.MapFile{Data: []byte(`chain_0002.txt` + nl)},
"chain_0002.txt": &fstest.MapFile{Data: []byte(`chain_0003.txt` + nl)},
"chain_0003.txt": &fstest.MapFile{Data: []byte(attribute + nl)}, </s> remove want: true,
</s> add want: assert.True, </s> remove testFS: testFSGen{
"dir": testFSDir{
"subdir_0002.txt": []byte(attribute + nl),
</s> add testFS: fstest.MapFS{
path.Join("dir", "subdir_0002.txt"): &fstest.MapFile{
Data: []byte(attribute + nl), </s> remove want: false,
</s> add want: assert.False, | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep replace replace replace replace keep keep replace keep keep keep | <mask> name: "no",
<mask> testFS: testFSGen{
<mask> "no_0001.txt": []byte(nl),
<mask> "no_0002.txt": []byte(nl),
<mask> "no_0003.txt": []byte(nl),
<mask> },
<mask> initPattern: "no_*",
<mask> want: false,
<mask> }, {
<mask> name: "subdirectory",
<mask> testFS: testFSGen{
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove want: true,
</s> add want: assert.True, </s> remove testFS: testFSGen{
"dir": testFSDir{
"subdir_0002.txt": []byte(attribute + nl),
</s> add testFS: fstest.MapFS{
path.Join("dir", "subdir_0002.txt"): &fstest.MapFile{
Data: []byte(attribute + nl), </s> remove testFS: testFSGen{
"several_0001.txt": []byte(`several_*` + nl),
"several_0002.txt": []byte(`several_0001.txt` + nl),
"several_0003.txt": []byte(attribute + nl),
</s> add testFS: fstest.MapFS{
"several_0001.txt": &fstest.MapFile{Data: []byte(`several_*` + nl)},
"several_0002.txt": &fstest.MapFile{Data: []byte(`several_0001.txt` + nl)},
"several_0003.txt": &fstest.MapFile{Data: []byte(attribute + nl)}, </s> remove want: true,
</s> add want: assert.True, </s> remove testFS: testFSGen{
"simple_0001.txt": []byte(attribute + nl),
</s> add testFS: fstest.MapFS{
"simple_0001.txt": &fstest.MapFile{Data: []byte(attribute + nl)}, | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep replace replace replace keep replace keep keep keep | <mask> name: "subdirectory",
<mask> testFS: testFSGen{
<mask> "dir": testFSDir{
<mask> "subdir_0002.txt": []byte(attribute + nl),
<mask> },
<mask> "subdir_0001.txt": []byte(`dir/*`),
<mask> },
<mask> initPattern: "subdir_0001.txt",
<mask> want: true,
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove want: false,
</s> add want: assert.False, </s> remove want: true,
</s> add want: assert.True, </s> remove testFS: testFSGen{
"chain_0001.txt": []byte(`chain_0002.txt` + nl),
"chain_0002.txt": []byte(`chain_0003.txt` + nl),
"chain_0003.txt": []byte(attribute + nl),
</s> add testFS: fstest.MapFS{
"chain_0001.txt": &fstest.MapFile{Data: []byte(`chain_0002.txt` + nl)},
"chain_0002.txt": &fstest.MapFile{Data: []byte(`chain_0003.txt` + nl)},
"chain_0003.txt": &fstest.MapFile{Data: []byte(attribute + nl)}, </s> remove testFS: testFSGen{
"several_0001.txt": []byte(`several_*` + nl),
"several_0002.txt": []byte(`several_0001.txt` + nl),
"several_0003.txt": []byte(attribute + nl),
</s> add testFS: fstest.MapFS{
"several_0001.txt": &fstest.MapFile{Data: []byte(`several_*` + nl)},
"several_0002.txt": &fstest.MapFile{Data: []byte(`several_0001.txt` + nl)},
"several_0003.txt": &fstest.MapFile{Data: []byte(attribute + nl)}, </s> remove want: true,
</s> add want: assert.True, | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep keep replace keep keep keep replace replace keep keep keep | <mask> },
<mask> initPattern: "subdir_0001.txt",
<mask> want: true,
<mask> }}
<mask>
<mask> for _, tc := range testCases {
<mask> testDir := tc.testFS.gen(t)
<mask> fw := makeFileWalker(testDir)
<mask>
<mask> t.Run(tc.name, func(t *testing.T) {
<mask> ok, err := fw.Walk(filepath.Join(testDir, tc.initPattern))
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove ok, err := fw.Walk(filepath.Join(testDir, tc.initPattern))
</s> add ok, err := fw.Walk(tc.testFS, tc.initPattern) </s> remove assert.Equal(t, tc.want, ok)
</s> add tc.want(t, ok) </s> remove "subdir_0001.txt": []byte(`dir/*`),
</s> add "subdir_0001.txt": &fstest.MapFile{Data: []byte(`dir/*`)}, </s> remove testFS: testFSGen{
"dir": testFSDir{
"subdir_0002.txt": []byte(attribute + nl),
</s> add testFS: fstest.MapFS{
path.Join("dir", "subdir_0002.txt"): &fstest.MapFile{
Data: []byte(attribute + nl), </s> remove _, ok, err := checkFile(nil, "lol")
</s> add _, ok, err := checkFile(emptyFS, nil, "lol") | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep keep replace keep keep replace keep | <mask>
<mask> t.Run(tc.name, func(t *testing.T) {
<mask> ok, err := fw.Walk(filepath.Join(testDir, tc.initPattern))
<mask> require.NoError(t, err)
<mask>
<mask> assert.Equal(t, tc.want, ok)
<mask> })
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove testDir := tc.testFS.gen(t)
fw := makeFileWalker(testDir)
</s> add fw := makeFileWalker("") </s> remove _, ok, err := checkFile(nil, "lol")
</s> add _, ok, err := checkFile(emptyFS, nil, "lol") </s> remove // TODO(e.burkov): Use assert.ErrorsIs within the error from
// less platform-dependent package instead of syscall.EINVAL.
//
// See https://github.com/golang/go/issues/46849 and
// https://github.com/golang/go/issues/30322.
pathErr := &os.PathError{}
require.ErrorAs(t, err, &pathErr)
assert.Equal(t, "open", pathErr.Op)
assert.Equal(t, badPath, pathErr.Path)
</s> add })
t.Run("ignore_dirs", func(t *testing.T) {
const dirName = "dir"
testFS := fstest.MapFS{
path.Join(dirName, "file"): &fstest.MapFile{Data: []byte{}},
}
patterns, ok, err := checkFile(testFS, nil, dirName)
require.NoError(t, err)
assert.Empty(t, patterns)
assert.True(t, ok) </s> add emptyFS := fstest.MapFS{}
</s> remove ok, err := makeFileWalker("").Walk("[]")
</s> add f := fstest.MapFS{}
ok, err := makeFileWalker("").Walk(f, "[]") | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep keep keep replace keep keep keep replace keep | <mask> }
<mask>
<mask> t.Run("pattern_malformed", func(t *testing.T) {
<mask> ok, err := makeFileWalker("").Walk("[]")
<mask> require.Error(t, err)
<mask>
<mask> assert.False(t, ok)
<mask> assert.ErrorIs(t, err, filepath.ErrBadPattern)
<mask> })
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove assert.ErrorIs(t, err, filepath.ErrBadPattern)
</s> add assert.ErrorIs(t, err, path.ErrBadPattern) </s> remove assert.ErrorIs(t, err, rerr)
</s> add assert.False(t, ok) </s> remove assert.Equal(t, tc.want, ok)
</s> add tc.want(t, ok) </s> remove })
ok, err := fw.Walk(filepath.Join(dir, "bad_filename.txt"))
</s> add }).Walk(f, filename) </s> remove const badPath = "\x00"
_, ok, err := checkFile(nil, badPath)
require.Error(t, err)
</s> add _, ok, err := checkFile(&errFS{}, nil, "")
require.ErrorIs(t, err, errErrFSOpen) | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep keep keep keep replace replace replace replace keep keep keep keep keep | <mask> assert.ErrorIs(t, err, filepath.ErrBadPattern)
<mask> })
<mask>
<mask> t.Run("bad_filename", func(t *testing.T) {
<mask> dir := testFSGen{
<mask> "bad_filename.txt": []byte("[]"),
<mask> }.gen(t)
<mask> fw := FileWalker(func(r io.Reader) (patterns []string, cont bool, err error) {
<mask> s := bufio.NewScanner(r)
<mask> for s.Scan() {
<mask> patterns = append(patterns, s.Text())
<mask> }
<mask>
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove assert.ErrorIs(t, err, filepath.ErrBadPattern)
</s> add assert.ErrorIs(t, err, path.ErrBadPattern) </s> remove makeFileWalker := func(dirName string) (fw FileWalker) {
</s> add makeFileWalker := func(_ string) (fw FileWalker) { </s> remove }).Walk(filepath.Join(dir, "*"))
require.Error(t, err)
require.False(t, ok)
</s> add }).Walk(f, "*")
require.ErrorIs(t, err, rerr) </s> remove dir := testFSGen{
"mockfile.txt": []byte(`mockdata`),
}.gen(t)
</s> add f := fstest.MapFS{
"mockfile.txt": &fstest.MapFile{Data: []byte(`mockdata`)},
} </s> remove })
ok, err := fw.Walk(filepath.Join(dir, "bad_filename.txt"))
</s> add }).Walk(f, filename) </s> remove assert.ErrorIs(t, err, filepath.ErrBadPattern)
</s> add assert.ErrorIs(t, err, path.ErrBadPattern) | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep keep replace replace replace keep keep keep replace keep keep keep | <mask>
<mask> return patterns, true, s.Err()
<mask> })
<mask>
<mask> ok, err := fw.Walk(filepath.Join(dir, "bad_filename.txt"))
<mask> require.Error(t, err)
<mask>
<mask> assert.False(t, ok)
<mask> assert.ErrorIs(t, err, filepath.ErrBadPattern)
<mask> })
<mask>
<mask> t.Run("itself_error", func(t *testing.T) {
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove assert.ErrorIs(t, err, filepath.ErrBadPattern)
</s> add assert.ErrorIs(t, err, path.ErrBadPattern) </s> remove ok, err := makeFileWalker("").Walk("[]")
</s> add f := fstest.MapFS{}
ok, err := makeFileWalker("").Walk(f, "[]") </s> remove assert.ErrorIs(t, err, rerr)
</s> add assert.False(t, ok) </s> remove }).Walk(filepath.Join(dir, "*"))
require.Error(t, err)
require.False(t, ok)
</s> add }).Walk(f, "*")
require.ErrorIs(t, err, rerr) </s> remove const badPath = "\x00"
_, ok, err := checkFile(nil, badPath)
require.Error(t, err)
</s> add _, ok, err := checkFile(&errFS{}, nil, "")
require.ErrorIs(t, err, errErrFSOpen) | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep keep keep replace replace replace keep keep keep replace replace replace | <mask> t.Run("itself_error", func(t *testing.T) {
<mask> const rerr errors.Error = "returned error"
<mask>
<mask> dir := testFSGen{
<mask> "mockfile.txt": []byte(`mockdata`),
<mask> }.gen(t)
<mask>
<mask> ok, err := FileWalker(func(r io.Reader) (patterns []string, ok bool, err error) {
<mask> return nil, true, rerr
<mask> }).Walk(filepath.Join(dir, "*"))
<mask> require.Error(t, err)
<mask> require.False(t, ok)
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove assert.ErrorIs(t, err, filepath.ErrBadPattern)
</s> add assert.ErrorIs(t, err, path.ErrBadPattern) </s> remove dir := testFSGen{
"bad_filename.txt": []byte("[]"),
}.gen(t)
fw := FileWalker(func(r io.Reader) (patterns []string, cont bool, err error) {
</s> add const filename = "bad_filename.txt"
f := fstest.MapFS{
filename: &fstest.MapFile{Data: []byte("[]")},
}
ok, err := FileWalker(func(r io.Reader) (patterns []string, cont bool, err error) { </s> remove assert.ErrorIs(t, err, rerr)
</s> add assert.False(t, ok) </s> remove assert.ErrorIs(t, err, filepath.ErrBadPattern)
</s> add assert.ErrorIs(t, err, path.ErrBadPattern) </s> add type errFS struct {
fs.GlobFS
}
const errErrFSOpen errors.Error = "this error is always returned"
func (efs *errFS) Open(name string) (fs.File, error) {
return nil, errErrFSOpen
}
| https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }).Walk(filepath.Join(dir, "*"))
<mask> require.Error(t, err)
<mask> require.False(t, ok)
<mask>
<mask> assert.ErrorIs(t, err, rerr)
<mask> })
<mask> }
<mask>
<mask> func TestWalkerFunc_CheckFile(t *testing.T) {
<mask> t.Run("non-existing", func(t *testing.T) {
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove }).Walk(filepath.Join(dir, "*"))
require.Error(t, err)
require.False(t, ok)
</s> add }).Walk(f, "*")
require.ErrorIs(t, err, rerr) </s> remove _, ok, err := checkFile(nil, "lol")
</s> add _, ok, err := checkFile(emptyFS, nil, "lol") </s> remove assert.ErrorIs(t, err, filepath.ErrBadPattern)
</s> add assert.ErrorIs(t, err, path.ErrBadPattern) </s> remove assert.ErrorIs(t, err, filepath.ErrBadPattern)
</s> add assert.ErrorIs(t, err, path.ErrBadPattern) </s> remove ok, err := makeFileWalker("").Walk("[]")
</s> add f := fstest.MapFS{}
ok, err := makeFileWalker("").Walk(f, "[]") </s> add emptyFS := fstest.MapFS{}
| https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep add keep keep keep keep keep keep | <mask> }
<mask>
<mask> func TestWalkerFunc_CheckFile(t *testing.T) {
<mask> emptyFS := fstest.MapFS{}
<mask>
<mask> t.Run("non-existing", func(t *testing.T) {
<mask> _, ok, err := checkFile(emptyFS, nil, "lol")
<mask> require.NoError(t, err)
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> add emptyFS := fstest.MapFS{}
</s> remove _, ok, err := checkFile(nil, "lol")
</s> add _, ok, err := checkFile(emptyFS, nil, "lol") </s> remove assert.ErrorIs(t, err, rerr)
</s> add assert.False(t, ok) </s> remove assert.Equal(t, tc.want, ok)
</s> add tc.want(t, ok) </s> remove ok, err := makeFileWalker("").Walk("[]")
</s> add f := fstest.MapFS{}
ok, err := makeFileWalker("").Walk(f, "[]") </s> remove testDir := tc.testFS.gen(t)
fw := makeFileWalker(testDir)
</s> add fw := makeFileWalker("") | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep keep keep add keep keep keep keep keep | <mask> return nil, errErrFSOpen
<mask> }
<mask>
<mask> func TestWalkerFunc_CheckFile(t *testing.T) {
<mask> t.Run("non-existing", func(t *testing.T) {
<mask> _, ok, err := checkFile(emptyFS, nil, "lol")
<mask> require.NoError(t, err)
<mask>
<mask> assert.True(t, ok)
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove _, ok, err := checkFile(nil, "lol")
</s> add _, ok, err := checkFile(emptyFS, nil, "lol") </s> add type errFS struct {
fs.GlobFS
}
const errErrFSOpen errors.Error = "this error is always returned"
func (efs *errFS) Open(name string) (fs.File, error) {
return nil, errErrFSOpen
}
</s> remove assert.ErrorIs(t, err, rerr)
</s> add assert.False(t, ok) </s> remove assert.Equal(t, tc.want, ok)
</s> add tc.want(t, ok) </s> remove const badPath = "\x00"
_, ok, err := checkFile(nil, badPath)
require.Error(t, err)
</s> add _, ok, err := checkFile(&errFS{}, nil, "")
require.ErrorIs(t, err, errErrFSOpen) </s> remove // TODO(e.burkov): Use assert.ErrorsIs within the error from
// less platform-dependent package instead of syscall.EINVAL.
//
// See https://github.com/golang/go/issues/46849 and
// https://github.com/golang/go/issues/30322.
pathErr := &os.PathError{}
require.ErrorAs(t, err, &pathErr)
assert.Equal(t, "open", pathErr.Op)
assert.Equal(t, badPath, pathErr.Path)
</s> add })
t.Run("ignore_dirs", func(t *testing.T) {
const dirName = "dir"
testFS := fstest.MapFS{
path.Join(dirName, "file"): &fstest.MapFile{Data: []byte{}},
}
patterns, ok, err := checkFile(testFS, nil, dirName)
require.NoError(t, err)
assert.Empty(t, patterns)
assert.True(t, ok) | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask>
<mask> func TestWalkerFunc_CheckFile(t *testing.T) {
<mask> t.Run("non-existing", func(t *testing.T) {
<mask> _, ok, err := checkFile(nil, "lol")
<mask> require.NoError(t, err)
<mask>
<mask> assert.True(t, ok)
<mask> })
<mask>
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> add emptyFS := fstest.MapFS{}
</s> remove assert.ErrorIs(t, err, rerr)
</s> add assert.False(t, ok) </s> add type errFS struct {
fs.GlobFS
}
const errErrFSOpen errors.Error = "this error is always returned"
func (efs *errFS) Open(name string) (fs.File, error) {
return nil, errErrFSOpen
}
</s> remove assert.Equal(t, tc.want, ok)
</s> add tc.want(t, ok) </s> remove const badPath = "\x00"
_, ok, err := checkFile(nil, badPath)
require.Error(t, err)
</s> add _, ok, err := checkFile(&errFS{}, nil, "")
require.ErrorIs(t, err, errErrFSOpen) </s> remove // TODO(e.burkov): Use assert.ErrorsIs within the error from
// less platform-dependent package instead of syscall.EINVAL.
//
// See https://github.com/golang/go/issues/46849 and
// https://github.com/golang/go/issues/30322.
pathErr := &os.PathError{}
require.ErrorAs(t, err, &pathErr)
assert.Equal(t, "open", pathErr.Op)
assert.Equal(t, badPath, pathErr.Path)
</s> add })
t.Run("ignore_dirs", func(t *testing.T) {
const dirName = "dir"
testFS := fstest.MapFS{
path.Join(dirName, "file"): &fstest.MapFile{Data: []byte{}},
}
patterns, ok, err := checkFile(testFS, nil, dirName)
require.NoError(t, err)
assert.Empty(t, patterns)
assert.True(t, ok) | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
keep keep keep replace replace replace replace keep keep replace replace replace replace replace replace replace replace replace | <mask> })
<mask>
<mask> t.Run("invalid_argument", func(t *testing.T) {
<mask> const badPath = "\x00"
<mask>
<mask> _, ok, err := checkFile(nil, badPath)
<mask> require.Error(t, err)
<mask>
<mask> assert.False(t, ok)
<mask> // TODO(e.burkov): Use assert.ErrorsIs within the error from
<mask> // less platform-dependent package instead of syscall.EINVAL.
<mask> //
<mask> // See https://github.com/golang/go/issues/46849 and
<mask> // https://github.com/golang/go/issues/30322.
<mask> pathErr := &os.PathError{}
<mask> require.ErrorAs(t, err, &pathErr)
<mask> assert.Equal(t, "open", pathErr.Op)
<mask> assert.Equal(t, badPath, pathErr.Path)
</s> Pull request: 2499 merge rewrites vol.1
Merge in DNS/adguard-home from 2499-merge-rewrites-vol.1 to master
Updates #2499.
Squashed commit of the following:
commit 6b308bc2b360cee8c22e506f31d62bacb4bf8fb3
Merge: f49e9186 2b635bf6
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 19:23:07 2021 +0300
Merge branch 'master' into 2499-merge-rewrites-vol.1
commit f49e9186ffc8b7074d03c6721ee56cdb09243684
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 18:50:49 2021 +0300
aghos: fix fs events filtering
commit 567dd646556606212af5dab60e3ecbb8fff22c25
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 14 16:50:37 2021 +0300
all: imp code, docs, fix windows
commit 140c8bf519345eb54d0e7500a996fcf465353d71
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:41:53 2021 +0300
aghnet: use const
commit bebf3f76bd394a498ccad812c57d4507c69529ba
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 19:32:37 2021 +0300
all: imp tests, docs
commit 9bfdbb6eb454833135d616e208e82699f98e2562
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 18:42:20 2021 +0300
all: imp path more, imp docs
commit ee9ea4c132a6b17787d150bf2bee703abaa57be3
Author: Eugene Burkov <[email protected]>
Date: Wed Oct 13 16:09:46 2021 +0300
all: fix windows, imp paths
commit 6fac8338a81e9ecfebfc23a1adcb964e89f6aee6
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 19:53:35 2021 +0300
all: imp code, docs
commit da1ce1a2a3dd2be3fdff2412a6dbd596859dc249
Author: Eugene Burkov <[email protected]>
Date: Mon Oct 11 18:22:50 2021 +0300
aghnet: fix windows tests
commit d29de359ed68118d71efb226a8433fac15ff5c66
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 21:02:14 2021 +0300
all: repl & imp
commit 1356c08944cdbb85ce5532d90fe5b077219ce5ff
Author: Eugene Burkov <[email protected]>
Date: Fri Oct 8 01:41:19 2021 +0300
all: add tests, mv logic, added tmpfs
commit f4b11adf8998bc8d9d955c5ac9f386f671bd5213
Author: Eugene Burkov <[email protected]>
Date: Thu Oct 7 14:26:30 2021 +0300
all: imp filewalker, refactor hosts container </s> remove assert.ErrorIs(t, err, filepath.ErrBadPattern)
</s> add assert.ErrorIs(t, err, path.ErrBadPattern) </s> remove assert.ErrorIs(t, err, filepath.ErrBadPattern)
</s> add assert.ErrorIs(t, err, path.ErrBadPattern) </s> remove ok, err := makeFileWalker("").Walk("[]")
</s> add f := fstest.MapFS{}
ok, err := makeFileWalker("").Walk(f, "[]") </s> remove assert.Equal(t, tc.want, ok)
</s> add tc.want(t, ok) </s> remove assert.ErrorIs(t, err, rerr)
</s> add assert.False(t, ok) | https://github.com/AdguardTeam/AdGuardHome/commit/2796e65468a87c7e556087fdec1c8663eedfe90e | internal/aghos/filewalker_test.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.