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> import './Tooltip.css'; <mask> import 'react-popper-tooltip/dist/styles.css'; <mask> <mask> const getHintElement = ({ <mask> className, <mask> contentItemClass, </s> Open tooltip on hover, show scroll on overflow y </s> add export const HIDE_TOOLTIP_DELAY = 300; </s> remove scrollHide: PropTypes.bool, </s> add </s> remove .tooltip__container { overflow-y: scroll; } </s> add </s> add overflow-y: scroll; max-height: 100%;
https://github.com/AdguardTeam/AdGuardHome/commit/15db9e9c1daec31d5d6f1d6d77a59bc125fb00d5
client/src/components/Logs/Cells/getHintElement.js
keep keep keep keep replace keep keep keep keep keep
<mask> title: PropTypes.string, <mask> placement: PropTypes.string, <mask> canShowTooltip: PropTypes.string, <mask> xlinkHref: PropTypes.string, <mask> scrollHide: PropTypes.bool, <mask> content: PropTypes.oneOfType([ <mask> PropTypes.string, <mask> PropTypes.array, <mask> ]), <mask> renderContent: PropTypes.arrayOf(PropTypes.element), </s> Open tooltip on hover, show scroll on overflow y </s> remove .tooltip__container { overflow-y: scroll; } </s> add </s> add export const HIDE_TOOLTIP_DELAY = 300; </s> add import { HIDE_TOOLTIP_DELAY } from '../../../helpers/constants'; </s> add overflow-y: scroll; max-height: 100%;
https://github.com/AdguardTeam/AdGuardHome/commit/15db9e9c1daec31d5d6f1d6d77a59bc125fb00d5
client/src/components/Logs/Cells/getHintElement.js
keep keep keep add keep keep keep keep
<mask> export const DEBOUNCE_FILTER_TIMEOUT = 500; <mask> export const CHECK_TIMEOUT = 1000; <mask> export const SUCCESS_TOAST_TIMEOUT = 5000; <mask> export const FAILURE_TOAST_TIMEOUT = 30000; <mask> <mask> export const UNSAFE_PORTS = [ <mask> 1, <mask> 7, </s> Open tooltip on hover, show scroll on overflow y </s> add import { HIDE_TOOLTIP_DELAY } from '../../../helpers/constants'; </s> remove scrollHide: PropTypes.bool, </s> add </s> remove .tooltip__container { overflow-y: scroll; } </s> add </s> add overflow-y: scroll; max-height: 100%;
https://github.com/AdguardTeam/AdGuardHome/commit/15db9e9c1daec31d5d6f1d6d77a59bc125fb00d5
client/src/helpers/constants.js
keep keep keep add keep keep keep keep keep keep
<mask> "runtime" <mask> "strconv" <mask> "strings" <mask> <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> // UnsupportedError is returned by functions and methods when a particular <mask> // operation Op cannot be performed on the current OS. <mask> type UnsupportedError struct { </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // Represents the program that will be launched by a service or daemon </s> add // program represents the program that will be launched by as a service or a // daemon. </s> add // Call chooseSystem expicitly to introduce OpenBSD support for service // package. It's a noop for other GOOS values. chooseSystem() </s> add "time" </s> remove // On OpenWrt it is important to run enable after the service installation // Otherwise, the service won't start on the system startup </s> add // On OpenWrt it is important to run enable after the service // installation Otherwise, the service won't start on the system // startup. </s> add "github.com/AdguardTeam/AdGuardHome/internal/version" </s> remove // Stop stops the program func (p *program) Stop(s service.Service) error { // Stop should not block. Return with a few seconds. </s> add // Stop implements service.Interface interface for *program. func (p *program) Stop(_ service.Service) error { // Stop should not block. Return with a few seconds.
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/aghos/os.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> out, err := cmd.Output() <mask> if len(out) > MaxCmdOutputSize { <mask> out = out[:MaxCmdOutputSize] <mask> } <mask> if err != nil { <mask> return 1, "", fmt.Errorf("exec.Command(%s) failed: %v: %s", command, err, string(out)) <mask> } <mask> <mask> return cmd.ProcessState.ExitCode(), string(out), nil <mask> } <mask> </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove } else if action == "run" { err = s.Run() if err != nil { </s> add case "run": if err = s.Run(); err != nil { </s> remove s, err := service.New(prg, svcConfig) if err != nil { </s> add var s service.Service if s, err = service.New(prg, svcConfig); err != nil { </s> remove err := svcAction(s, "uninstall") if err != nil { </s> add if err := svcAction(s, "uninstall"); err != nil { </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil { </s> remove if action == "status" { </s> add switch action { case "status": </s> remove err = os.Remove(launchdStdoutPath) </s> add err := os.Remove(launchdStdoutPath)
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/aghos/os.go
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep
<mask> } <mask> }() <mask> <mask> if args.serviceControlAction != "" { <mask> // TODO(a.garipov): github.com/kardianos/service doesn't seem to <mask> // support OpenBSD currently. Either patch it to do so or make <mask> // our own implementation of the service.System interface. <mask> if runtime.GOOS == "openbsd" { <mask> log.Fatal("service actions are not supported on openbsd, see issue 3226") <mask> } <mask> <mask> handleServiceControlAction(args, clientBuildFS) <mask> <mask> return <mask> } <mask> </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // Send SIGHUP to a process with ID taken from our pid-file // If pid-file doesn't exist, find our PID using 'ps' command </s> add // Send SIGHUP to a process with PID taken from our .pid file. If it doesn't // exist, find our PID using 'ps' command. </s> remove // On OpenWrt it is important to run enable after the service installation // Otherwise, the service won't start on the system startup </s> add // On OpenWrt it is important to run enable after the service // installation Otherwise, the service won't start on the system // startup. </s> add // Call chooseSystem expicitly to introduce OpenBSD support for service // package. It's a noop for other GOOS values. chooseSystem() </s> add c.Option["RunComScript"] = openBSDScript c.Option["SvcInfo"] = fmt.Sprintf("%s %s", version.Full(), time.Now()) </s> remove err := svcAction(s, "uninstall") if err != nil { </s> add if err := svcAction(s, "uninstall"); err != nil { </s> remove // Stop stops the program func (p *program) Stop(s service.Service) error { // Stop should not block. Return with a few seconds. </s> add // Stop implements service.Interface interface for *program. func (p *program) Stop(_ service.Service) error { // Stop should not block. Return with a few seconds.
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/home.go
keep keep add keep keep keep keep keep keep
<mask> "strconv" <mask> "strings" <mask> "syscall" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghos" <mask> "github.com/AdguardTeam/AdGuardHome/internal/version" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/kardianos/service" </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> add "github.com/AdguardTeam/AdGuardHome/internal/version" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove err = os.Remove(launchdStdoutPath) </s> add err := os.Remove(launchdStdoutPath) </s> remove if err != nil { return 1, "", fmt.Errorf("exec.Command(%s) failed: %v: %s", command, err, string(out)) </s> add if errors.As(err, new(*exec.ExitError)) { return cmd.ProcessState.ExitCode(), string(out), nil } else if err != nil { return 1, "", fmt.Errorf("exec.Command(%s) failed: %w: %s", command, err, string(out)) </s> remove // TODO(a.garipov): github.com/kardianos/service doesn't seem to // support OpenBSD currently. Either patch it to do so or make // our own implementation of the service.System interface. if runtime.GOOS == "openbsd" { log.Fatal("service actions are not supported on openbsd, see issue 3226") } </s> add </s> remove // Represents the program that will be launched by a service or daemon </s> add // program represents the program that will be launched by as a service or a // daemon.
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep add keep keep keep keep keep
<mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghos" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/kardianos/service" <mask> ) <mask> </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> add "time" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove // Represents the program that will be launched by a service or daemon </s> add // program represents the program that will be launched by as a service or a // daemon. </s> remove err = os.Remove(launchdStdoutPath) </s> add err := os.Remove(launchdStdoutPath) </s> remove if err != nil { return 1, "", fmt.Errorf("exec.Command(%s) failed: %v: %s", command, err, string(out)) </s> add if errors.As(err, new(*exec.ExitError)) { return cmd.ProcessState.ExitCode(), string(out), nil } else if err != nil { return 1, "", fmt.Errorf("exec.Command(%s) failed: %w: %s", command, err, string(out)) </s> remove // TODO(a.garipov): github.com/kardianos/service doesn't seem to // support OpenBSD currently. Either patch it to do so or make // our own implementation of the service.System interface. if runtime.GOOS == "openbsd" { log.Fatal("service actions are not supported on openbsd, see issue 3226") } </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep keep keep keep replace keep keep keep keep keep
<mask> serviceDisplayName = "AdGuard Home service" <mask> serviceDescription = "AdGuard Home: Network-level blocker" <mask> ) <mask> <mask> // Represents the program that will be launched by a service or daemon <mask> type program struct { <mask> clientBuildFS fs.FS <mask> opts options <mask> } <mask> </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> add "github.com/AdguardTeam/golibs/errors" </s> remove // Start should quickly start the program func (p *program) Start(s service.Service) error { // Start should not block. Do the actual work async. </s> add // Start implements service.Interface interface for *program. func (p *program) Start(_ service.Service) (err error) { // Start should not block. Do the actual work async. </s> add // Call chooseSystem expicitly to introduce OpenBSD support for service // package. It's a noop for other GOOS values. chooseSystem() </s> remove // Stop stops the program func (p *program) Stop(s service.Service) error { // Stop should not block. Return with a few seconds. </s> add // Stop implements service.Interface interface for *program. func (p *program) Stop(_ service.Service) error { // Stop should not block. Return with a few seconds. </s> add c.Option["RunComScript"] = openBSDScript c.Option["SvcInfo"] = fmt.Sprintf("%s %s", version.Full(), time.Now()) </s> remove // On OpenWrt it is important to run enable after the service installation // Otherwise, the service won't start on the system startup </s> add // On OpenWrt it is important to run enable after the service // installation Otherwise, the service won't start on the system // startup.
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> clientBuildFS fs.FS <mask> opts options <mask> } <mask> <mask> // Start should quickly start the program <mask> func (p *program) Start(s service.Service) error { <mask> // Start should not block. Do the actual work async. <mask> args := p.opts <mask> args.runningAsService = true <mask> go run(args, p.clientBuildFS) <mask> <mask> return nil </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // Stop stops the program func (p *program) Stop(s service.Service) error { // Stop should not block. Return with a few seconds. </s> add // Stop implements service.Interface interface for *program. func (p *program) Stop(_ service.Service) error { // Stop should not block. Return with a few seconds. </s> remove // Represents the program that will be launched by a service or daemon </s> add // program represents the program that will be launched by as a service or a // daemon. </s> remove // Start automatically after install </s> add // Start automatically after install. </s> remove // svcStatus check the service's status. </s> add // svcStatus returns the service's status. </s> remove // On OpenWrt it is important to run enable after the service installation // Otherwise, the service won't start on the system startup </s> add // On OpenWrt it is important to run enable after the service // installation Otherwise, the service won't start on the system // startup. </s> remove // TODO(a.garipov): github.com/kardianos/service doesn't seem to // support OpenBSD currently. Either patch it to do so or make // our own implementation of the service.System interface. if runtime.GOOS == "openbsd" { log.Fatal("service actions are not supported on openbsd, see issue 3226") } </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> <mask> return nil <mask> } <mask> <mask> // Stop stops the program <mask> func (p *program) Stop(s service.Service) error { <mask> // Stop should not block. Return with a few seconds. <mask> if Context.appSignalChannel == nil { <mask> os.Exit(0) <mask> } <mask> Context.appSignalChannel <- syscall.SIGINT <mask> return nil </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // Start should quickly start the program func (p *program) Start(s service.Service) error { // Start should not block. Do the actual work async. </s> add // Start implements service.Interface interface for *program. func (p *program) Start(_ service.Service) (err error) { // Start should not block. Do the actual work async. </s> remove // svcStatus check the service's status. </s> add // svcStatus returns the service's status. </s> remove // Send SIGHUP to a process with ID taken from our pid-file // If pid-file doesn't exist, find our PID using 'ps' command </s> add // Send SIGHUP to a process with PID taken from our .pid file. If it doesn't // exist, find our PID using 'ps' command. </s> remove if err != nil { return 1, "", fmt.Errorf("exec.Command(%s) failed: %v: %s", command, err, string(out)) </s> add if errors.As(err, new(*exec.ExitError)) { return cmd.ProcessState.ExitCode(), string(out), nil } else if err != nil { return 1, "", fmt.Errorf("exec.Command(%s) failed: %w: %s", command, err, string(out)) </s> remove // TODO(a.garipov): github.com/kardianos/service doesn't seem to // support OpenBSD currently. Either patch it to do so or make // our own implementation of the service.System interface. if runtime.GOOS == "openbsd" { log.Fatal("service actions are not supported on openbsd, see issue 3226") } </s> add </s> remove // Represents the program that will be launched by a service or daemon </s> add // program represents the program that will be launched by as a service or a // daemon.
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep keep keep keep replace keep keep keep keep keep
<mask> Context.appSignalChannel <- syscall.SIGINT <mask> return nil <mask> } <mask> <mask> // svcStatus check the service's status. <mask> // <mask> // On OpenWrt, the service utility may not exist. We use our service script <mask> // directly in this case. <mask> func svcStatus(s service.Service) (status service.Status, err error) { <mask> status, err = s.Status() </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // Stop stops the program func (p *program) Stop(s service.Service) error { // Stop should not block. Return with a few seconds. </s> add // Stop implements service.Interface interface for *program. func (p *program) Stop(_ service.Service) error { // Stop should not block. Return with a few seconds. </s> remove // On OpenWrt it is important to run enable after the service installation // Otherwise, the service won't start on the system startup </s> add // On OpenWrt it is important to run enable after the service // installation Otherwise, the service won't start on the system // startup. </s> remove // Start should quickly start the program func (p *program) Start(s service.Service) error { // Start should not block. Do the actual work async. </s> add // Start implements service.Interface interface for *program. func (p *program) Start(_ service.Service) (err error) { // Start should not block. Do the actual work async. </s> remove // handleServiceStatusCommand handles service "status" command </s> add // handleServiceStatusCommand handles service "status" command. </s> remove // Send SIGHUP to a process with ID taken from our pid-file // If pid-file doesn't exist, find our PID using 'ps' command </s> add // Send SIGHUP to a process with PID taken from our .pid file. If it doesn't // exist, find our PID using 'ps' command. </s> remove // TODO(a.garipov): github.com/kardianos/service doesn't seem to // support OpenBSD currently. Either patch it to do so or make // our own implementation of the service.System interface. if runtime.GOOS == "openbsd" { log.Fatal("service actions are not supported on openbsd, see issue 3226") } </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> <mask> return err <mask> } <mask> <mask> // Send SIGHUP to a process with ID taken from our pid-file <mask> // If pid-file doesn't exist, find our PID using 'ps' command <mask> func sendSigReload() { <mask> if runtime.GOOS == "windows" { <mask> log.Error("not implemented on windows") <mask> <mask> return </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // TODO(a.garipov): github.com/kardianos/service doesn't seem to // support OpenBSD currently. Either patch it to do so or make // our own implementation of the service.System interface. if runtime.GOOS == "openbsd" { log.Fatal("service actions are not supported on openbsd, see issue 3226") } </s> add </s> remove // Stop stops the program func (p *program) Stop(s service.Service) error { // Stop should not block. Return with a few seconds. </s> add // Stop implements service.Interface interface for *program. func (p *program) Stop(_ service.Service) error { // Stop should not block. Return with a few seconds. </s> remove // svcStatus check the service's status. </s> add // svcStatus returns the service's status. </s> add c.Option["RunComScript"] = openBSDScript c.Option["SvcInfo"] = fmt.Sprintf("%s %s", version.Full(), time.Now()) </s> remove err := svcAction(s, "uninstall") if err != nil { </s> add if err := svcAction(s, "uninstall"); err != nil { </s> remove if err != nil { return 1, "", fmt.Errorf("exec.Command(%s) failed: %v: %s", command, err, string(out)) </s> add if errors.As(err, new(*exec.ExitError)) { return cmd.ProcessState.ExitCode(), string(out), nil } else if err != nil { return 1, "", fmt.Errorf("exec.Command(%s) failed: %w: %s", command, err, string(out))
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep keep add keep keep keep keep
<mask> // it is specified when we register a service, and it indicates to the app <mask> // that it is being run as a service/daemon. <mask> func handleServiceControlAction(opts options, clientBuildFS fs.FS) { <mask> action := opts.serviceControlAction <mask> log.Printf("Service control action: %s", action) <mask> <mask> if action == "reload" { </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // On OpenWrt it is important to run enable after the service installation // Otherwise, the service won't start on the system startup </s> add // On OpenWrt it is important to run enable after the service // installation Otherwise, the service won't start on the system // startup. </s> add "github.com/AdguardTeam/golibs/errors" </s> remove // Represents the program that will be launched by a service or daemon </s> add // program represents the program that will be launched by as a service or a // daemon. </s> remove // Send SIGHUP to a process with ID taken from our pid-file // If pid-file doesn't exist, find our PID using 'ps' command </s> add // Send SIGHUP to a process with PID taken from our .pid file. If it doesn't // exist, find our PID using 'ps' command. </s> remove // TODO(a.garipov): github.com/kardianos/service doesn't seem to // support OpenBSD currently. Either patch it to do so or make // our own implementation of the service.System interface. if runtime.GOOS == "openbsd" { log.Fatal("service actions are not supported on openbsd, see issue 3226") } </s> add </s> remove // Stop stops the program func (p *program) Stop(s service.Service) error { // Stop should not block. Return with a few seconds. </s> add // Stop implements service.Interface interface for *program. func (p *program) Stop(_ service.Service) error { // Stop should not block. Return with a few seconds.
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep keep keep replace replace keep keep keep replace keep keep keep keep
<mask> clientBuildFS: clientBuildFS, <mask> opts: runOpts, <mask> } <mask> s, err := service.New(prg, svcConfig) <mask> if err != nil { <mask> log.Fatal(err) <mask> } <mask> <mask> if action == "status" { <mask> handleServiceStatusCommand(s) <mask> } else if action == "run" { <mask> err = s.Run() <mask> if err != nil { </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove } else if action == "run" { err = s.Run() if err != nil { </s> add case "run": if err = s.Run(); err != nil { </s> remove } else if action == "install" { </s> add case "install": </s> remove } else if action == "uninstall" { </s> add case "uninstall": </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil { </s> remove err := svcAction(s, "uninstall") if err != nil { </s> add if err := svcAction(s, "uninstall"); err != nil {
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep keep keep keep replace replace replace keep keep replace keep keep
<mask> } <mask> <mask> if action == "status" { <mask> handleServiceStatusCommand(s) <mask> } else if action == "run" { <mask> err = s.Run() <mask> if err != nil { <mask> log.Fatalf("Failed to run service: %s", err) <mask> } <mask> } else if action == "install" { <mask> initConfigFilename(opts) <mask> initWorkingDir(opts) </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove if action == "status" { </s> add switch action { case "status": </s> remove } else if action == "uninstall" { </s> add case "uninstall": </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil { </s> remove s, err := service.New(prg, svcConfig) if err != nil { </s> add var s service.Service if s, err = service.New(prg, svcConfig); err != nil { </s> remove // Start automatically after install </s> add // Start automatically after install.
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep keep keep keep replace keep replace replace replace keep keep
<mask> } else if action == "install" { <mask> initConfigFilename(opts) <mask> initWorkingDir(opts) <mask> handleServiceInstallCommand(s) <mask> } else if action == "uninstall" { <mask> handleServiceUninstallCommand(s) <mask> } else { <mask> err = svcAction(s, action) <mask> if err != nil { <mask> log.Fatal(err) <mask> } </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove } else if action == "install" { </s> add case "install": </s> remove } else if action == "run" { err = s.Run() if err != nil { </s> add case "run": if err = s.Run(); err != nil { </s> remove if action == "status" { </s> add switch action { case "status": </s> remove err := svcAction(s, "uninstall") if err != nil { </s> add if err := svcAction(s, "uninstall"); err != nil { </s> remove s, err := service.New(prg, svcConfig) if err != nil { </s> add var s service.Service if s, err = service.New(prg, svcConfig); err != nil {
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep keep keep keep replace keep keep keep keep keep
<mask> log.Fatal(err) <mask> } <mask> } <mask> <mask> log.Printf("Action %s has been done successfully on %s", action, service.ChosenSystem().String()) <mask> } <mask> <mask> // handleServiceStatusCommand handles service "status" command <mask> func handleServiceStatusCommand(s service.Service) { <mask> status, errSt := svcStatus(s) </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // handleServiceStatusCommand handles service "status" command </s> add // handleServiceStatusCommand handles service "status" command. </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil { </s> remove // Start automatically after install </s> add // Start automatically after install. </s> remove // svcStatus check the service's status. </s> add // svcStatus returns the service's status. </s> add c.Option["RunComScript"] = openBSDScript c.Option["SvcInfo"] = fmt.Sprintf("%s %s", version.Full(), time.Now()) </s> remove // On OpenWrt it is important to run enable after the service installation // Otherwise, the service won't start on the system startup </s> add // On OpenWrt it is important to run enable after the service // installation Otherwise, the service won't start on the system // startup.
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> log.Printf("Action %s has been done successfully on %s", action, service.ChosenSystem().String()) <mask> } <mask> <mask> // handleServiceStatusCommand handles service "status" command <mask> func handleServiceStatusCommand(s service.Service) { <mask> status, errSt := svcStatus(s) <mask> if errSt != nil { <mask> log.Fatalf("failed to get service status: %s", errSt) <mask> } </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove log.Printf("Action %s has been done successfully on %s", action, service.ChosenSystem().String()) </s> add log.Printf("action %s has been done successfully on %s", action, service.ChosenSystem()) </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil { </s> remove // Start automatically after install </s> add // Start automatically after install. </s> remove // On OpenWrt it is important to run enable after the service installation // Otherwise, the service won't start on the system startup </s> add // On OpenWrt it is important to run enable after the service // installation Otherwise, the service won't start on the system // startup. </s> remove // svcStatus check the service's status. </s> add // svcStatus returns the service's status. </s> add c.Option["RunComScript"] = openBSDScript c.Option["SvcInfo"] = fmt.Sprintf("%s %s", version.Full(), time.Now())
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> log.Fatal(err) <mask> } <mask> <mask> if aghos.IsOpenWrt() { <mask> // On OpenWrt it is important to run enable after the service installation <mask> // Otherwise, the service won't start on the system startup <mask> _, err = runInitdCommand("enable") <mask> if err != nil { <mask> log.Fatal(err) <mask> } <mask> } </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // Start automatically after install </s> add // Start automatically after install. </s> remove err := svcAction(s, "uninstall") if err != nil { </s> add if err := svcAction(s, "uninstall"); err != nil { </s> remove if action == "status" { </s> add switch action { case "status": </s> remove // svcStatus check the service's status. </s> add // svcStatus returns the service's status. </s> remove } else if action == "run" { err = s.Run() if err != nil { </s> add case "run": if err = s.Run(); err != nil { </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil {
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep keep keep keep replace keep keep keep keep keep
<mask> log.Fatal(err) <mask> } <mask> } <mask> <mask> // Start automatically after install <mask> err = svcAction(s, "start") <mask> if err != nil { <mask> log.Fatalf("Failed to start the service: %s", err) <mask> } <mask> log.Printf("Service has been started") </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil { </s> remove // On OpenWrt it is important to run enable after the service installation // Otherwise, the service won't start on the system startup </s> add // On OpenWrt it is important to run enable after the service // installation Otherwise, the service won't start on the system // startup. </s> remove if action == "status" { </s> add switch action { case "status": </s> remove } else if action == "run" { err = s.Run() if err != nil { </s> add case "run": if err = s.Run(); err != nil { </s> remove } else if action == "install" { </s> add case "install": </s> remove err := svcAction(s, "uninstall") if err != nil { </s> add if err := svcAction(s, "uninstall"); err != nil {
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> log.Fatal(err) <mask> } <mask> } <mask> <mask> err := svcAction(s, "uninstall") <mask> if err != nil { <mask> log.Fatal(err) <mask> } <mask> <mask> if runtime.GOOS == "darwin" { <mask> // Remove log files on cleanup and log errors. </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove err = os.Remove(launchdStdoutPath) </s> add err := os.Remove(launchdStdoutPath) </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil { </s> remove } else if action == "uninstall" { </s> add case "uninstall": </s> remove s, err := service.New(prg, svcConfig) if err != nil { </s> add var s service.Service if s, err = service.New(prg, svcConfig); err != nil { </s> remove if action == "status" { </s> add switch action { case "status": </s> remove // Start automatically after install </s> add // Start automatically after install.
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> if runtime.GOOS == "darwin" { <mask> // Remove log files on cleanup and log errors. <mask> err = os.Remove(launchdStdoutPath) <mask> if err != nil && !errors.Is(err, os.ErrNotExist) { <mask> log.Printf("removing stdout file: %s", err) <mask> } <mask> <mask> err = os.Remove(launchdStderrPath) </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove err := svcAction(s, "uninstall") if err != nil { </s> add if err := svcAction(s, "uninstall"); err != nil { </s> remove } else if action == "run" { err = s.Run() if err != nil { </s> add case "run": if err = s.Run(); err != nil { </s> remove if action == "status" { </s> add switch action { case "status": </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil { </s> remove } else if action == "install" { </s> add case "install": </s> remove } else if action == "uninstall" { </s> add case "uninstall":
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep keep add keep keep keep keep
<mask> } else if runtime.GOOS == "freebsd" { <mask> c.Option["SysvScript"] = freeBSDScript <mask> } <mask> } <mask> <mask> // runInitdCommand runs init.d service command <mask> // returns command code or error if any </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // handleServiceStatusCommand handles service "status" command </s> add // handleServiceStatusCommand handles service "status" command. </s> remove // TODO(a.garipov): github.com/kardianos/service doesn't seem to // support OpenBSD currently. Either patch it to do so or make // our own implementation of the service.System interface. if runtime.GOOS == "openbsd" { log.Fatal("service actions are not supported on openbsd, see issue 3226") } </s> add </s> remove } else if action == "run" { err = s.Run() if err != nil { </s> add case "run": if err = s.Run(); err != nil { </s> remove } else if action == "uninstall" { </s> add case "uninstall": </s> remove err := svcAction(s, "uninstall") if err != nil { </s> add if err := svcAction(s, "uninstall"); err != nil { </s> remove err = os.Remove(launchdStdoutPath) </s> add err := os.Remove(launchdStdoutPath)
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
keep keep add keep keep keep keep keep
<mask> <mask> // prepare prepares the a new or decoded entry. <mask> func (r *RewriteEntry) prepare() { <mask> switch r.Answer { <mask> case "AAAA": <mask> r.IP = nil <mask> r.Type = dns.TypeAAAA <mask> </s> Pull request: filtering: fix legacy rewrite domain case Updates #3351. Squashed commit of the following: commit cc1c72cc13026ed703bb140e55dc3eb886846e48 Author: Ainar Garipov <[email protected]> Date: Tue Jul 13 17:23:33 2021 +0300 filtering: fix legacy rewrite domain case </s> add }, { Domain: "BIGHOST.COM", Answer: "1.2.3.7", </s> add }, { name: "issue3351", host: "bighost.com", wantCName: "", wantVals: []net.IP{{1, 2, 3, 7}}, dtyp: dns.TypeA, </s> remove assert.Equal(t, Rewritten, r.Reason) </s> add assert.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason) </s> remove require.Equal(t, Rewritten, r.Reason) </s> add require.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason)
https://github.com/AdguardTeam/AdGuardHome/commit/167447547aa52cfa01b48680d13aff73ba64fb42
internal/filtering/rewrites.go
keep keep keep add keep keep keep keep keep keep
<mask> Answer: "1.2.3.6", <mask> }, { <mask> Domain: "*.hostboth.com", <mask> Answer: "1234::5678", <mask> }} <mask> d.prepareRewrites() <mask> <mask> testCases := []struct { <mask> name string <mask> host string </s> Pull request: filtering: fix legacy rewrite domain case Updates #3351. Squashed commit of the following: commit cc1c72cc13026ed703bb140e55dc3eb886846e48 Author: Ainar Garipov <[email protected]> Date: Tue Jul 13 17:23:33 2021 +0300 filtering: fix legacy rewrite domain case </s> add }, { name: "issue3351", host: "bighost.com", wantCName: "", wantVals: []net.IP{{1, 2, 3, 7}}, dtyp: dns.TypeA, </s> remove assert.Equal(t, Rewritten, r.Reason) </s> add assert.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason) </s> add // TODO(a.garipov): Write a case-agnostic version of strings.HasSuffix // and use it in matchDomainWildcard instead of using strings.ToLower // everywhere. r.Domain = strings.ToLower(r.Domain) </s> remove require.Equal(t, Rewritten, r.Reason) </s> add require.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason)
https://github.com/AdguardTeam/AdGuardHome/commit/167447547aa52cfa01b48680d13aff73ba64fb42
internal/filtering/rewrites_test.go
keep add keep keep keep keep keep keep
<mask> wantVals: []net.IP{net.ParseIP("1234::5678")}, <mask> dtyp: dns.TypeAAAA, <mask> }} <mask> <mask> for _, tc := range testCases { <mask> t.Run(tc.name, func(t *testing.T) { <mask> valsNum := len(tc.wantVals) <mask> </s> Pull request: filtering: fix legacy rewrite domain case Updates #3351. Squashed commit of the following: commit cc1c72cc13026ed703bb140e55dc3eb886846e48 Author: Ainar Garipov <[email protected]> Date: Tue Jul 13 17:23:33 2021 +0300 filtering: fix legacy rewrite domain case </s> remove assert.Equal(t, Rewritten, r.Reason) </s> add assert.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason) </s> add }, { Domain: "BIGHOST.COM", Answer: "1.2.3.7", </s> add // TODO(a.garipov): Write a case-agnostic version of strings.HasSuffix // and use it in matchDomainWildcard instead of using strings.ToLower // everywhere. r.Domain = strings.ToLower(r.Domain) </s> remove require.Equal(t, Rewritten, r.Reason) </s> add require.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason)
https://github.com/AdguardTeam/AdGuardHome/commit/167447547aa52cfa01b48680d13aff73ba64fb42
internal/filtering/rewrites_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> return <mask> } <mask> <mask> require.Equal(t, Rewritten, r.Reason) <mask> if tc.wantCName != "" { <mask> assert.Equal(t, tc.wantCName, r.CanonName) <mask> } <mask> <mask> require.Len(t, r.IPList, valsNum) </s> Pull request: filtering: fix legacy rewrite domain case Updates #3351. Squashed commit of the following: commit cc1c72cc13026ed703bb140e55dc3eb886846e48 Author: Ainar Garipov <[email protected]> Date: Tue Jul 13 17:23:33 2021 +0300 filtering: fix legacy rewrite domain case </s> remove assert.Equal(t, Rewritten, r.Reason) </s> add assert.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason) </s> add }, { Domain: "BIGHOST.COM", Answer: "1.2.3.7", </s> add }, { name: "issue3351", host: "bighost.com", wantCName: "", wantVals: []net.IP{{1, 2, 3, 7}}, dtyp: dns.TypeA, </s> add // TODO(a.garipov): Write a case-agnostic version of strings.HasSuffix // and use it in matchDomainWildcard instead of using strings.ToLower // everywhere. r.Domain = strings.ToLower(r.Domain)
https://github.com/AdguardTeam/AdGuardHome/commit/167447547aa52cfa01b48680d13aff73ba64fb42
internal/filtering/rewrites_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> return <mask> } <mask> <mask> assert.Equal(t, Rewritten, r.Reason) <mask> <mask> require.Len(t, r.IPList, len(tc.want)) <mask> <mask> for _, ip := range tc.want { <mask> assert.True(t, ip.Equal(r.IPList[0])) </s> Pull request: filtering: fix legacy rewrite domain case Updates #3351. Squashed commit of the following: commit cc1c72cc13026ed703bb140e55dc3eb886846e48 Author: Ainar Garipov <[email protected]> Date: Tue Jul 13 17:23:33 2021 +0300 filtering: fix legacy rewrite domain case </s> remove require.Equal(t, Rewritten, r.Reason) </s> add require.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason) </s> add }, { name: "issue3351", host: "bighost.com", wantCName: "", wantVals: []net.IP{{1, 2, 3, 7}}, dtyp: dns.TypeA, </s> add }, { Domain: "BIGHOST.COM", Answer: "1.2.3.7", </s> add // TODO(a.garipov): Write a case-agnostic version of strings.HasSuffix // and use it in matchDomainWildcard instead of using strings.ToLower // everywhere. r.Domain = strings.ToLower(r.Domain)
https://github.com/AdguardTeam/AdGuardHome/commit/167447547aa52cfa01b48680d13aff73ba64fb42
internal/filtering/rewrites_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> go 1.16 <mask> <mask> require ( <mask> github.com/AdguardTeam/dnsproxy v0.39.5 <mask> github.com/AdguardTeam/golibs v0.9.2 <mask> github.com/AdguardTeam/urlfilter v0.14.6 <mask> github.com/NYTimes/gziphandler v1.1.1 <mask> github.com/ameshkov/dnscrypt/v2 v2.2.2 <mask> github.com/digineo/go-ipset/v2 v2.2.1 <mask> github.com/fsnotify/fsnotify v1.4.9 </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove github.com/AdguardTeam/golibs v0.9.2 h1:H3BDFkaosxvb+UgFlNVyN66GZ+JglcZULnJ7z7PukyQ= </s> add </s> add github.com/AdguardTeam/golibs v0.9.3 h1:noeKHJEzrSwxzX0Zi3USM3cXf1qQV99SO772jet/uEY= github.com/AdguardTeam/golibs v0.9.3/go.mod h1:fCAMwPBJ8S7YMYbTWvYS+eeTLblP5E04IDtNAo7y7IY= </s> add "net" </s> add // Default ports. const ( defaultPortDNS = 53 defaultPortHTTP = 80 defaultPortHTTPS = 443 defaultPortQUIC = 784 defaultPortTLS = 853 ) </s> remove // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"` </s> remove Port: 53, </s> add Port: defaultPortDNS,
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
go.mod
keep keep keep keep replace keep keep keep keep keep
<mask> github.com/AdguardTeam/dnsproxy v0.39.5 h1:SQorhRLR1241t6hy9CiAGZUjRULhsDJlPJTl0UGX8uw= <mask> github.com/AdguardTeam/dnsproxy v0.39.5/go.mod h1:eDpJKAdkHORRwAedjuERv+7SWlcz4cn+5uwrbUAWHRY= <mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/AdguardTeam/golibs v0.9.2 h1:H3BDFkaosxvb+UgFlNVyN66GZ+JglcZULnJ7z7PukyQ= <mask> github.com/AdguardTeam/golibs v0.9.2/go.mod h1:fCAMwPBJ8S7YMYbTWvYS+eeTLblP5E04IDtNAo7y7IY= <mask> github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU= <mask> github.com/AdguardTeam/urlfilter v0.14.6 h1:emqoKZElooHACYehRBYENeKVN1a/rspxiqTIMYLuoIo= <mask> github.com/AdguardTeam/urlfilter v0.14.6/go.mod h1:klx4JbOfc4EaNb5lWLqOwfg+pVcyRukmoJRvO55lL5U= <mask> github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> add github.com/AdguardTeam/golibs v0.9.3 h1:noeKHJEzrSwxzX0Zi3USM3cXf1qQV99SO772jet/uEY= github.com/AdguardTeam/golibs v0.9.3/go.mod h1:fCAMwPBJ8S7YMYbTWvYS+eeTLblP5E04IDtNAo7y7IY= </s> remove github.com/AdguardTeam/golibs v0.9.2 </s> add github.com/AdguardTeam/golibs v0.9.3 </s> remove // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"` </s> remove Port: 53, </s> add Port: defaultPortDNS, </s> remove PortHTTPS: 443, PortDNSOverTLS: 853, // needs to be passed through to dnsproxy PortDNSOverQUIC: 784, </s> add PortHTTPS: defaultPortHTTPS, PortDNSOverTLS: defaultPortTLS, // needs to be passed through to dnsproxy PortDNSOverQUIC: defaultPortQUIC, </s> remove if config.DNS.Port != 53 { </s> add if config.DNS.Port != defaultPortDNS {
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
go.sum
keep add keep keep keep keep keep keep
<mask> github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/AdguardTeam/golibs v0.9.2/go.mod h1:fCAMwPBJ8S7YMYbTWvYS+eeTLblP5E04IDtNAo7y7IY= <mask> github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU= <mask> github.com/AdguardTeam/urlfilter v0.14.6 h1:emqoKZElooHACYehRBYENeKVN1a/rspxiqTIMYLuoIo= <mask> github.com/AdguardTeam/urlfilter v0.14.6/go.mod h1:klx4JbOfc4EaNb5lWLqOwfg+pVcyRukmoJRvO55lL5U= <mask> github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= <mask> github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= <mask> github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove github.com/AdguardTeam/golibs v0.9.2 h1:H3BDFkaosxvb+UgFlNVyN66GZ+JglcZULnJ7z7PukyQ= </s> add </s> remove github.com/AdguardTeam/golibs v0.9.2 </s> add github.com/AdguardTeam/golibs v0.9.3 </s> remove // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"` </s> remove Port: 53, </s> add Port: defaultPortDNS, </s> remove PortHTTPS: 443, PortDNSOverTLS: 853, // needs to be passed through to dnsproxy PortDNSOverQUIC: 784, </s> add PortHTTPS: defaultPortHTTPS, PortDNSOverTLS: defaultPortTLS, // needs to be passed through to dnsproxy PortDNSOverQUIC: defaultPortQUIC, </s> remove if config.DNS.Port != 53 { </s> add if config.DNS.Port != defaultPortDNS {
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
go.sum
keep keep keep keep replace keep keep keep keep keep
<mask> AuthAttempts: 5, <mask> AuthBlockMin: 15, <mask> DNS: dnsConfig{ <mask> BindHosts: []net.IP{{0, 0, 0, 0}}, <mask> Port: 53, <mask> StatsInterval: 1, <mask> FilteringConfig: dnsforward.FilteringConfig{ <mask> ProtectionEnabled: true, // whether or not use any of filtering features <mask> BlockingMode: "default", // mode how to answer filtered requests <mask> BlockedResponseTTL: 10, // in seconds </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS, </s> remove PortHTTPS: 443, PortDNSOverTLS: 853, // needs to be passed through to dnsproxy PortDNSOverQUIC: 784, </s> add PortHTTPS: defaultPortHTTPS, PortDNSOverTLS: defaultPortTLS, // needs to be passed through to dnsproxy PortDNSOverQUIC: defaultPortQUIC, </s> remove // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"` </s> add Context.tls = prevTLS </s> add Context.tls = &TLSMod{} </s> remove const defaultHTTPSPort = 443 </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/config.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> ResolveClients: true, <mask> UsePrivateRDNS: true, <mask> }, <mask> TLS: tlsConfigSettings{ <mask> PortHTTPS: 443, <mask> PortDNSOverTLS: 853, // needs to be passed through to dnsproxy <mask> PortDNSOverQUIC: 784, <mask> }, <mask> logSettings: logSettings{ <mask> LogCompress: false, <mask> LogLocalTime: false, <mask> LogMaxBackups: 0, </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove Port: 53, </s> add Port: defaultPortDNS, </s> remove const defaultHTTPSPort = 443 </s> add </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS, </s> add Context.tls = &TLSMod{} </s> remove // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"` </s> remove if config.DNS.Port != 53 { </s> add if config.DNS.Port != defaultPortDNS {
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/config.go
keep keep keep keep replace keep keep keep keep keep
<mask> // addresses to a slice of strings. <mask> func appendDNSAddrs(dst []string, addrs ...net.IP) (res []string) { <mask> for _, addr := range addrs { <mask> var hostport string <mask> if config.DNS.Port != 53 { <mask> hostport = netutil.JoinHostPort(addr.String(), config.DNS.Port) <mask> } else { <mask> hostport = addr.String() <mask> } <mask> </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> add </s> remove if tlsConf.PortHTTPS != 443 { </s> add if tlsConf.PortHTTPS != defaultPortHTTPS { </s> remove // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. var testBootstrapDNS = []string{ "94.140.14.14", "94.140.15.15", } // setupBootstraps is a helper that sets up the bootstrap plain DNS server // configuration for tests and also tears it down in a cleanup function. func setupBootstraps(t testing.TB) { </s> add // setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) { </s> remove // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"` </s> remove if port := web.conf.PortHTTPS; port != defaultHTTPSPort { </s> add if port := web.conf.PortHTTPS; port != defaultPortHTTPS { </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/control.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> func preInstallHandler(handler http.Handler) http.Handler { <mask> return &preInstallHandlerStruct{handler} <mask> } <mask> <mask> const defaultHTTPSPort = 443 <mask> <mask> // handleHTTPSRedirect redirects the request to HTTPS, if needed. If ok is <mask> // true, the middleware must continue handling the request. <mask> func handleHTTPSRedirect(w http.ResponseWriter, r *http.Request) (ok bool) { <mask> web := Context.web <mask> if web.httpsServer.server == nil { </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> add </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove if port := web.conf.PortHTTPS; port != defaultHTTPSPort { </s> add if port := web.conf.PortHTTPS; port != defaultPortHTTPS { </s> add dnsIPs, err := collectDNSIPs() if err != nil { // Don't add a lot of formatting, since the error is already // wrapped by collectDNSIPs. respondJSONError(w, http.StatusInternalServerError, err.Error()) return } </s> remove // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"`
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/control.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> if r.TLS == nil && web.forceHTTPS { <mask> hostPort := host <mask> if port := web.conf.PortHTTPS; port != defaultHTTPSPort { <mask> hostPort = netutil.JoinHostPort(host, port) <mask> } <mask> <mask> httpsURL := &url.URL{ <mask> Scheme: schemeHTTPS, </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove if tlsConf.PortHTTPS != 443 { </s> add if tlsConf.PortHTTPS != defaultPortHTTPS { </s> remove const defaultHTTPSPort = 443 </s> add </s> remove ServerAddresses: cloneBootstrap(), </s> add ServerAddresses: dnsIPs, </s> remove if config.DNS.Port != 53 { </s> add if config.DNS.Port != defaultPortDNS { </s> add dnsIPs, err := collectDNSIPs() if err != nil { // Don't add a lot of formatting, since the error is already // wrapped by collectDNSIPs. respondJSONError(w, http.StatusInternalServerError, err.Error()) return } </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/control.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> <mask> // handleInstallGetAddresses is the handler for /install/get_addresses endpoint. <mask> func (web *Web) handleInstallGetAddresses(w http.ResponseWriter, r *http.Request) { <mask> data := getAddrsResponse{} <mask> data.WebPort = 80 <mask> data.DNSPort = 53 <mask> <mask> ifaces, err := aghnet.GetValidNetInterfacesForWeb() <mask> if err != nil { <mask> httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) <mask> return </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> add dnsIPs, err := collectDNSIPs() if err != nil { // Don't add a lot of formatting, since the error is already // wrapped by collectDNSIPs. respondJSONError(w, http.StatusInternalServerError, err.Error()) return } </s> remove const defaultHTTPSPort = 443 </s> add </s> remove ServerAddresses: cloneBootstrap(), </s> add ServerAddresses: dnsIPs, </s> remove // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> add </s> remove if config.DNS.Port != 53 { </s> add if config.DNS.Port != defaultPortDNS {
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/controlinstall.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> // TODO(e.burkov): This should removed with the API v1 when the appropriate <mask> // functionality will appear in default handleInstallGetAddresses. <mask> func (web *Web) handleInstallGetAddressesBeta(w http.ResponseWriter, r *http.Request) { <mask> data := getAddrsResponseBeta{} <mask> data.WebPort = 80 <mask> data.DNSPort = 53 <mask> <mask> ifaces, err := aghnet.GetValidNetInterfacesForWeb() <mask> if err != nil { <mask> httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) <mask> return </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove const defaultHTTPSPort = 443 </s> add </s> add dnsIPs, err := collectDNSIPs() if err != nil { // Don't add a lot of formatting, since the error is already // wrapped by collectDNSIPs. respondJSONError(w, http.StatusInternalServerError, err.Error()) return } </s> remove // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> add </s> remove ServerAddresses: cloneBootstrap(), </s> add ServerAddresses: dnsIPs, </s> remove setupBootstraps(t) </s> add setupDNSIPs(t)
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/controlinstall.go
keep keep add keep keep keep keep keep
<mask> yaml "gopkg.in/yaml.v2" <mask> ) <mask> <mask> // Called by other modules when configuration is changed <mask> func onConfigModified() { <mask> _ = config.write() <mask> } <mask> </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. var testBootstrapDNS = []string{ "94.140.14.14", "94.140.15.15", } // setupBootstraps is a helper that sets up the bootstrap plain DNS server // configuration for tests and also tears it down in a cleanup function. func setupBootstraps(t testing.TB) { </s> add // setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) { </s> remove // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> add </s> add dnsIPs, err := collectDNSIPs() if err != nil { // Don't add a lot of formatting, since the error is already // wrapped by collectDNSIPs. respondJSONError(w, http.StatusInternalServerError, err.Error()) return } </s> remove "github.com/AdguardTeam/golibs/stringutil" </s> add </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove const defaultHTTPSPort = 443 </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/dns.go
keep keep keep keep replace keep keep keep keep keep
<mask> if tlsConf.Enabled && len(tlsConf.ServerName) != 0 { <mask> hostname := tlsConf.ServerName <mask> if tlsConf.PortHTTPS != 0 { <mask> addr := hostname <mask> if tlsConf.PortHTTPS != 443 { <mask> addr = netutil.JoinHostPort(addr, tlsConf.PortHTTPS) <mask> } <mask> <mask> de.https = (&url.URL{ <mask> Scheme: "https", </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove if port := web.conf.PortHTTPS; port != defaultHTTPSPort { </s> add if port := web.conf.PortHTTPS; port != defaultPortHTTPS { </s> remove if config.DNS.Port != 53 { </s> add if config.DNS.Port != defaultPortDNS { </s> remove ServerAddresses: cloneBootstrap(), </s> add ServerAddresses: dnsIPs, </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove const defaultHTTPSPort = 443 </s> add </s> add dnsIPs, err := collectDNSIPs() if err != nil { // Don't add a lot of formatting, since the error is already // wrapped by collectDNSIPs. respondJSONError(w, http.StatusInternalServerError, err.Error()) return }
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/dns.go
keep keep keep add keep keep keep keep keep keep
<mask> <mask> import ( <mask> "encoding/json" <mask> "fmt" <mask> "net/http" <mask> "net/url" <mask> "path" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" <mask> "github.com/AdguardTeam/golibs/errors" </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> add "net" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" </s> add "github.com/AdguardTeam/golibs/netutil" </s> remove "github.com/AdguardTeam/golibs/stringutil" </s> add </s> remove github.com/AdguardTeam/golibs v0.9.2 </s> add github.com/AdguardTeam/golibs v0.9.3 </s> add // Default ports. const ( defaultPortDNS = 53 defaultPortHTTP = 80 defaultPortHTTPS = 443 defaultPortQUIC = 784 defaultPortTLS = 853 ) </s> remove github.com/AdguardTeam/golibs v0.9.2 h1:H3BDFkaosxvb+UgFlNVyN66GZ+JglcZULnJ7z7PukyQ= </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/stringutil" <mask> uuid "github.com/satori/go.uuid" <mask> "howett.net/plist" <mask> ) <mask> <mask> // dnsSettings is the DNSSetting.DNSSettings mobileconfig profile. </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" </s> add "github.com/AdguardTeam/golibs/netutil" </s> add "net" </s> remove // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. var testBootstrapDNS = []string{ "94.140.14.14", "94.140.15.15", } // setupBootstraps is a helper that sets up the bootstrap plain DNS server // configuration for tests and also tears it down in a cleanup function. func setupBootstraps(t testing.TB) { </s> add // setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) { </s> remove // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"` </s> add // Default ports. const ( defaultPortDNS = 53 defaultPortHTTP = 80 defaultPortHTTPS = 443 defaultPortQUIC = 784 defaultPortTLS = 853 ) </s> remove const defaultHTTPSPort = 443 </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> // ServerName is the hostname of the DoT server. It must be empty if <mask> // DNSProtocol is not "TLS". <mask> ServerName string `plist:",omitempty"` <mask> <mask> // ServerAddresses is a list of plain DNS server IP addresses used to <mask> // resolve the hostname in ServerURL or ServerName. <mask> ServerAddresses []string `plist:",omitempty"` <mask> } <mask> <mask> // payloadContent is a Device Management Profile payload. <mask> // <mask> // See https://developer.apple.com/documentation/devicemanagement/configuring_multiple_devices_using_profiles#3234127. </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. var testBootstrapDNS = []string{ "94.140.14.14", "94.140.15.15", } // setupBootstraps is a helper that sets up the bootstrap plain DNS server // configuration for tests and also tears it down in a cleanup function. func setupBootstraps(t testing.TB) { </s> add // setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) { </s> add dnsIPs, err := collectDNSIPs() if err != nil { // Don't add a lot of formatting, since the error is already // wrapped by collectDNSIPs. respondJSONError(w, http.StatusInternalServerError, err.Error()) return } </s> remove const defaultHTTPSPort = 443 </s> add </s> remove if config.DNS.Port != 53 { </s> add if config.DNS.Port != defaultPortDNS { </s> remove Port: 53, </s> add Port: defaultPortDNS, </s> remove "github.com/AdguardTeam/golibs/stringutil" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig.go
keep keep keep add keep keep keep keep keep keep
<mask> return <mask> } <mask> } <mask> <mask> d := &dnsSettings{ <mask> DNSProtocol: dnsp, <mask> ServerName: host, <mask> ServerAddresses: dnsIPs, <mask> } <mask> </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove ServerAddresses: cloneBootstrap(), </s> add ServerAddresses: dnsIPs, </s> remove // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> add </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> remove if port := web.conf.PortHTTPS; port != defaultHTTPSPort { </s> add if port := web.conf.PortHTTPS; port != defaultPortHTTPS { </s> add Context.tls = &TLSMod{} </s> remove const defaultHTTPSPort = 443 </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> d := &dnsSettings{ <mask> DNSProtocol: dnsp, <mask> ServerName: host, <mask> ServerAddresses: cloneBootstrap(), <mask> } <mask> <mask> mobileconfig, err := encodeMobileConfig(d, clientID) <mask> if err != nil { <mask> respondJSONError(w, http.StatusInternalServerError, err.Error()) </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> add dnsIPs, err := collectDNSIPs() if err != nil { // Don't add a lot of formatting, since the error is already // wrapped by collectDNSIPs. respondJSONError(w, http.StatusInternalServerError, err.Error()) return } </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove if port := web.conf.PortHTTPS; port != defaultHTTPSPort { </s> add if port := web.conf.PortHTTPS; port != defaultPortHTTPS { </s> remove if tlsConf.PortHTTPS != 443 { </s> add if tlsConf.PortHTTPS != defaultPortHTTPS { </s> remove setupBootstraps(t) </s> add setupDNSIPs(t)
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig.go
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> <mask> _, _ = w.Write(mobileconfig) <mask> } <mask> <mask> // cloneBootstrap returns a clone of the current bootstrap DNS servers. <mask> func cloneBootstrap() (bootstrap []string) { <mask> config.RLock() <mask> defer config.RUnlock() <mask> <mask> return stringutil.CloneSlice(config.DNS.BootstrapDNS) <mask> } <mask> <mask> func handleMobileConfigDoH(w http.ResponseWriter, r *http.Request) { <mask> handleMobileConfig(w, r, dnsProtoHTTPS) <mask> } <mask> <mask> func handleMobileConfigDoT(w http.ResponseWriter, r *http.Request) { </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove const defaultHTTPSPort = 443 </s> add </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove if config.DNS.Port != 53 { </s> add if config.DNS.Port != defaultPortDNS { </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. var testBootstrapDNS = []string{ "94.140.14.14", "94.140.15.15", } // setupBootstraps is a helper that sets up the bootstrap plain DNS server // configuration for tests and also tears it down in a cleanup function. func setupBootstraps(t testing.TB) { </s> add // setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) { </s> add dnsIPs, err := collectDNSIPs() if err != nil { // Don't add a lot of formatting, since the error is already // wrapped by collectDNSIPs. respondJSONError(w, http.StatusInternalServerError, err.Error()) return }
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig.go
keep add keep keep keep keep keep keep
<mask> "bytes" <mask> "encoding/json" <mask> "net/http" <mask> "net/http/httptest" <mask> "testing" <mask> <mask> "github.com/AdguardTeam/golibs/netutil" <mask> "github.com/stretchr/testify/assert" </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" </s> add "github.com/AdguardTeam/golibs/netutil" </s> add "net" </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove "github.com/AdguardTeam/golibs/stringutil" </s> add </s> remove github.com/AdguardTeam/golibs v0.9.2 h1:H3BDFkaosxvb+UgFlNVyN66GZ+JglcZULnJ7z7PukyQ= </s> add </s> add github.com/AdguardTeam/golibs v0.9.3 h1:noeKHJEzrSwxzX0Zi3USM3cXf1qQV99SO772jet/uEY= github.com/AdguardTeam/golibs v0.9.3/go.mod h1:fCAMwPBJ8S7YMYbTWvYS+eeTLblP5E04IDtNAo7y7IY=
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> "net/http" <mask> "net/http/httptest" <mask> "testing" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" <mask> "github.com/stretchr/testify/assert" <mask> "github.com/stretchr/testify/require" <mask> "howett.net/plist" <mask> ) <mask> </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> add "net" </s> remove "github.com/AdguardTeam/golibs/stringutil" </s> add </s> add "net" </s> remove // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. var testBootstrapDNS = []string{ "94.140.14.14", "94.140.15.15", } // setupBootstraps is a helper that sets up the bootstrap plain DNS server // configuration for tests and also tears it down in a cleanup function. func setupBootstraps(t testing.TB) { </s> add // setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) { </s> add // Default ports. const ( defaultPortDNS = 53 defaultPortHTTP = 80 defaultPortHTTPS = 443 defaultPortQUIC = 784 defaultPortTLS = 853 ) </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
keep keep keep keep replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> "github.com/stretchr/testify/require" <mask> "howett.net/plist" <mask> ) <mask> <mask> // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. <mask> var testBootstrapDNS = []string{ <mask> "94.140.14.14", <mask> "94.140.15.15", <mask> } <mask> <mask> // setupBootstraps is a helper that sets up the bootstrap plain DNS server <mask> // configuration for tests and also tears it down in a cleanup function. <mask> func setupBootstraps(t testing.TB) { <mask> t.Helper() <mask> <mask> prevConfig := config <mask> t.Cleanup(func() { <mask> config = prevConfig </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> add prevTLS := Context.tls </s> remove // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"` </s> remove // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> add </s> remove if config.DNS.Port != 53 { </s> add if config.DNS.Port != defaultPortDNS { </s> add Context.tls = prevTLS </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS,
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
keep keep keep add keep keep keep keep keep keep
<mask> func setupDNSIPs(t testing.TB) { <mask> t.Helper() <mask> <mask> prevConfig := config <mask> t.Cleanup(func() { <mask> config = prevConfig <mask> Context.tls = prevTLS <mask> }) <mask> <mask> config = &configuration{ </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> add Context.tls = prevTLS </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS, </s> remove // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. var testBootstrapDNS = []string{ "94.140.14.14", "94.140.15.15", } // setupBootstraps is a helper that sets up the bootstrap plain DNS server // configuration for tests and also tears it down in a cleanup function. func setupBootstraps(t testing.TB) { </s> add // setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) { </s> add Context.tls = &TLSMod{} </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> remove if tlsConf.PortHTTPS != 443 { </s> add if tlsConf.PortHTTPS != defaultPortHTTPS {
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
keep add keep keep keep keep keep keep
<mask> t.Cleanup(func() { <mask> config = prevConfig <mask> }) <mask> <mask> config = &configuration{ <mask> DNS: dnsConfig{ <mask> BindHosts: []net.IP{netutil.IPv4Zero()}, <mask> Port: defaultPortDNS, </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS, </s> add prevTLS := Context.tls </s> add Context.tls = &TLSMod{} </s> remove Port: 53, </s> add Port: defaultPortDNS, </s> remove // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. var testBootstrapDNS = []string{ "94.140.14.14", "94.140.15.15", } // setupBootstraps is a helper that sets up the bootstrap plain DNS server // configuration for tests and also tears it down in a cleanup function. func setupBootstraps(t testing.TB) { </s> add // setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) { </s> remove setupBootstraps(t) </s> add setupDNSIPs(t)
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> config = prevConfig <mask> }) <mask> config = &configuration{ <mask> DNS: dnsConfig{ <mask> FilteringConfig: dnsforward.FilteringConfig{ <mask> BootstrapDNS: testBootstrapDNS, <mask> }, <mask> }, <mask> } <mask> } <mask> <mask> func TestHandleMobileConfigDoH(t *testing.T) { </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> add Context.tls = prevTLS </s> add prevTLS := Context.tls </s> add Context.tls = &TLSMod{} </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> remove Port: 53, </s> add Port: defaultPortDNS, </s> remove // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. var testBootstrapDNS = []string{ "94.140.14.14", "94.140.15.15", } // setupBootstraps is a helper that sets up the bootstrap plain DNS server // configuration for tests and also tears it down in a cleanup function. func setupBootstraps(t testing.TB) { </s> add // setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) {
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
keep keep keep add keep keep keep keep keep
<mask> BindHosts: []net.IP{netutil.IPv4Zero()}, <mask> Port: defaultPortDNS, <mask> }, <mask> } <mask> } <mask> <mask> func TestHandleMobileConfigDoH(t *testing.T) { <mask> setupDNSIPs(t) <mask> </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS, </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> add Context.tls = prevTLS </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> remove Port: 53, </s> add Port: defaultPortDNS, </s> remove // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> } <mask> <mask> func TestHandleMobileConfigDoH(t *testing.T) { <mask> setupBootstraps(t) <mask> <mask> t.Run("success", func(t *testing.T) { <mask> r, err := http.NewRequest(http.MethodGet, "https://example.com:12345/apple/doh.mobileconfig?host=example.org", nil) <mask> require.NoError(t, err) <mask> </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> add Context.tls = &TLSMod{} </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS, </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> s := mc.PayloadContent[0].DNSSettings <mask> require.NotNil(t, s) <mask> <mask> assert.Equal(t, testBootstrapDNS, s.ServerAddresses) <mask> assert.Empty(t, s.ServerName) <mask> assert.Equal(t, "https://example.org/dns-query", s.ServerURL) <mask> }) <mask> <mask> t.Run("error_no_host", func(t *testing.T) { </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS,
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> s := mc.PayloadContent[0].DNSSettings <mask> require.NotNil(t, s) <mask> <mask> assert.Equal(t, testBootstrapDNS, s.ServerAddresses) <mask> assert.Empty(t, s.ServerName) <mask> assert.Equal(t, "https://example.org/dns-query/cli42", s.ServerURL) <mask> }) <mask> } <mask> </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS, </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> add prevTLS := Context.tls
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> }) <mask> } <mask> <mask> func TestHandleMobileConfigDoT(t *testing.T) { <mask> setupBootstraps(t) <mask> <mask> t.Run("success", func(t *testing.T) { <mask> r, err := http.NewRequest(http.MethodGet, "https://example.com:12345/apple/dot.mobileconfig?host=example.org", nil) <mask> require.NoError(t, err) <mask> </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS, </s> add Context.tls = &TLSMod{} </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> s := mc.PayloadContent[0].DNSSettings <mask> require.NotNil(t, s) <mask> <mask> assert.Equal(t, testBootstrapDNS, s.ServerAddresses) <mask> assert.Equal(t, "example.org", s.ServerName) <mask> assert.Empty(t, s.ServerURL) <mask> }) <mask> <mask> t.Run("error_no_host", func(t *testing.T) { </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS,
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
keep keep keep keep replace keep keep keep keep
<mask> <mask> s := mc.PayloadContent[0].DNSSettings <mask> require.NotNil(t, s) <mask> <mask> assert.Equal(t, testBootstrapDNS, s.ServerAddresses) <mask> assert.Equal(t, "cli42.example.org", s.ServerName) <mask> assert.Empty(t, s.ServerURL) <mask> }) <mask> } </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS, </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> add prevTLS := Context.tls
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> import { createAction } from 'redux-actions'; <mask> <mask> import Api from '../api/Api'; <mask> import { addErrorToast, addSuccessToast } from './index'; <mask> import { normalizeTopStats } from '../helpers/helpers'; <mask> <mask> const apiClient = new Api(); <mask> <mask> export const getStatsConfigRequest = createAction('GET_LOGS_CONFIG_REQUEST'); <mask> export const getStatsConfigFailure = createAction('GET_LOGS_CONFIG_FAILURE'); </s> - client: convert average processing time to milliseconds </s> add export const secondsToMilliseconds = (seconds) => { if (seconds) { return seconds * 1000; } return seconds; }; </s> add avg_processing_time: secondsToMilliseconds(stats.avg_processing_time), </s> remove {avgProcessingTime ? `${round(avgProcessingTime, 2)} ms` : 0} </s> add {avgProcessingTime ? `${round(avgProcessingTime)} ms` : 0}
https://github.com/AdguardTeam/AdGuardHome/commit/17a26155cdf0150ea9d8cf915311f16fafa6354a
client/src/actions/stats.js
keep keep keep add keep keep keep keep keep
<mask> ...stats, <mask> top_blocked_domains: normalizeTopStats(stats.top_blocked_domains), <mask> top_clients: normalizeTopStats(stats.top_clients), <mask> top_queried_domains: normalizeTopStats(stats.top_queried_domains), <mask> }; <mask> <mask> dispatch(getStatsSuccess(normalizedStats)); <mask> } catch (error) { <mask> dispatch(addErrorToast({ error })); </s> - client: convert average processing time to milliseconds </s> remove import { normalizeTopStats } from '../helpers/helpers'; </s> add import { normalizeTopStats, secondsToMilliseconds } from '../helpers/helpers'; </s> add export const secondsToMilliseconds = (seconds) => { if (seconds) { return seconds * 1000; } return seconds; }; </s> remove {avgProcessingTime ? `${round(avgProcessingTime, 2)} ms` : 0} </s> add {avgProcessingTime ? `${round(avgProcessingTime)} ms` : 0}
https://github.com/AdguardTeam/AdGuardHome/commit/17a26155cdf0150ea9d8cf915311f16fafa6354a
client/src/actions/stats.js
keep keep keep keep replace keep keep keep keep keep
<mask> <Tooltip text={t('average_processing_time_hint')} type={tooltipType} /> <mask> </td> <mask> <td className="text-right"> <mask> <span className="text-muted"> <mask> {avgProcessingTime ? `${round(avgProcessingTime, 2)} ms` : 0} <mask> </span> <mask> </td> <mask> </tr> <mask> </tbody> <mask> </table> </s> - client: convert average processing time to milliseconds </s> add export const secondsToMilliseconds = (seconds) => { if (seconds) { return seconds * 1000; } return seconds; }; </s> add avg_processing_time: secondsToMilliseconds(stats.avg_processing_time), </s> remove import { normalizeTopStats } from '../helpers/helpers'; </s> add import { normalizeTopStats, secondsToMilliseconds } from '../helpers/helpers';
https://github.com/AdguardTeam/AdGuardHome/commit/17a26155cdf0150ea9d8cf915311f16fafa6354a
client/src/components/Dashboard/Counters.js
keep keep keep add
<mask> <mask> export const toggleAllServices = (services, change, isSelected) => { <mask> services.forEach(service => change(`blocked_services.${service.id}`, isSelected)); <mask> }; </s> - client: convert average processing time to milliseconds </s> remove import { normalizeTopStats } from '../helpers/helpers'; </s> add import { normalizeTopStats, secondsToMilliseconds } from '../helpers/helpers'; </s> add avg_processing_time: secondsToMilliseconds(stats.avg_processing_time), </s> remove {avgProcessingTime ? `${round(avgProcessingTime, 2)} ms` : 0} </s> add {avgProcessingTime ? `${round(avgProcessingTime)} ms` : 0}
https://github.com/AdguardTeam/AdGuardHome/commit/17a26155cdf0150ea9d8cf915311f16fafa6354a
client/src/helpers/helpers.js
keep keep keep replace replace keep replace keep keep keep
<mask> const hasV4Interface = !!interfaces[selectedInterface]?.ipv4_addresses; <mask> const hasV6Interface = !!interfaces[selectedInterface]?.ipv6_addresses; <mask> <mask> if ((hasV4Interface && v4.other_server.found === STATUS_RESPONSE.ERROR) <mask> || (hasV6Interface && v6.other_server.found === STATUS_RESPONSE.ERROR)) { <mask> isError = true; <mask> dispatch(addErrorToast({ error: 'dhcp_error' })); <mask> if (v4.other_server.error) { <mask> dispatch(addErrorToast({ error: v4.other_server.error })); <mask> } </s> Fix DHCP check when there is no V6 interface </s> add dispatch(addErrorToast({ error: 'dhcp_error' })); </s> add } if (hasV6Interface && v6.other_server.found === STATUS_RESPONSE.ERROR) { isError = true;
https://github.com/AdguardTeam/AdGuardHome/commit/1806816d9c1a655467e6ed3934beec96a6944d4a
client/src/actions/index.js
keep keep add keep keep keep keep keep keep
<mask> if (v4.other_server.error) { <mask> dispatch(addErrorToast({ error: v4.other_server.error })); <mask> } <mask> if (v6.other_server.error) { <mask> dispatch(addErrorToast({ error: v6.other_server.error })); <mask> } <mask> } <mask> <mask> if (hasV4Interface && v4.static_ip.static === STATUS_RESPONSE.ERROR) { </s> Fix DHCP check when there is no V6 interface </s> add dispatch(addErrorToast({ error: 'dhcp_error' })); </s> remove if ((hasV4Interface && v4.other_server.found === STATUS_RESPONSE.ERROR) || (hasV6Interface && v6.other_server.found === STATUS_RESPONSE.ERROR)) { </s> add if (hasV4Interface && v4.other_server.found === STATUS_RESPONSE.ERROR) { </s> remove dispatch(addErrorToast({ error: 'dhcp_error' })); </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/1806816d9c1a655467e6ed3934beec96a6944d4a
client/src/actions/index.js
keep keep add keep keep keep keep keep
<mask> } <mask> <mask> if (isError) { <mask> return; <mask> } <mask> <mask> if ((hasV4Interface && v4.other_server.found === STATUS_RESPONSE.YES) <mask> || (hasV6Interface && v6.other_server.found === STATUS_RESPONSE.YES)) { </s> Fix DHCP check when there is no V6 interface </s> add } if (hasV6Interface && v6.other_server.found === STATUS_RESPONSE.ERROR) { isError = true; </s> remove if ((hasV4Interface && v4.other_server.found === STATUS_RESPONSE.ERROR) || (hasV6Interface && v6.other_server.found === STATUS_RESPONSE.ERROR)) { </s> add if (hasV4Interface && v4.other_server.found === STATUS_RESPONSE.ERROR) { </s> remove dispatch(addErrorToast({ error: 'dhcp_error' })); </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/1806816d9c1a655467e6ed3934beec96a6944d4a
client/src/actions/index.js
keep keep keep keep replace keep keep keep keep keep
<mask> func (d *DNSFilter) processRewrites(host string, qtype uint16) (res Result) { <mask> d.confLock.RLock() <mask> defer d.confLock.RUnlock() <mask> <mask> rr := findRewrites(d.Rewrites, host) <mask> if len(rr) != 0 { <mask> res.Reason = Rewritten <mask> } <mask> <mask> cnames := aghstrings.NewSet() </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove if (r.Type == dns.TypeA && qtype == dns.TypeA) || (r.Type == dns.TypeAAAA && qtype == dns.TypeAAAA) { </s> add if r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA) { </s> remove rr = findRewrites(d.Rewrites, host) </s> add rr = findRewrites(d.Rewrites, host, qtype) </s> remove if r.Domain != host { if !matchDomainWildcard(host, r.Domain) { continue } </s> add if r.Domain != host && !matchDomainWildcard(host, r.Domain) { continue } // Return CNAMEs for all types requests, but only the // appropriate ones for A and AAAA. if r.Type == dns.TypeCNAME || (r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA)) { rr = append(rr, r) </s> add } else { r.IP = ip r.Type = dns.TypeAAAA </s> remove rr = append(rr, r) </s> add </s> remove res.Reason = 0 </s> add res.Reason = NotFilteredNotFound
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/filtering.go
keep keep keep replace keep keep keep replace replace replace
<mask> <mask> cnames.Add(host) <mask> res.CanonName = rr[0].Answer <mask> rr = findRewrites(d.Rewrites, host) <mask> } <mask> <mask> for _, r := range rr { <mask> if (r.Type == dns.TypeA && qtype == dns.TypeA) || <mask> (r.Type == dns.TypeAAAA && qtype == dns.TypeAAAA) { <mask> </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove res.Reason = 0 </s> add res.Reason = NotFilteredNotFound </s> remove if r.Domain != host { if !matchDomainWildcard(host, r.Domain) { continue } </s> add if r.Domain != host && !matchDomainWildcard(host, r.Domain) { continue } // Return CNAMEs for all types requests, but only the // appropriate ones for A and AAAA. if r.Type == dns.TypeCNAME || (r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA)) { rr = append(rr, r) </s> remove rr := findRewrites(d.Rewrites, host) </s> add rr := findRewrites(d.Rewrites, host, qtype) </s> remove } else if r.Answer == "A" { </s> add case "A": </s> remove rr = append(rr, r) </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/filtering.go
keep keep keep keep replace keep keep keep keep keep
<mask> if (r.Type == dns.TypeA && qtype == dns.TypeA) || <mask> (r.Type == dns.TypeAAAA && qtype == dns.TypeAAAA) { <mask> <mask> if r.IP == nil { // IP exception <mask> res.Reason = 0 <mask> return res <mask> } <mask> <mask> res.IPList = append(res.IPList, r.IP) <mask> log.Debug("rewrite: A/AAAA for %s is %s", host, r.IP) </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove if (r.Type == dns.TypeA && qtype == dns.TypeA) || (r.Type == dns.TypeAAAA && qtype == dns.TypeAAAA) { </s> add if r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA) { </s> remove rr = findRewrites(d.Rewrites, host) </s> add rr = findRewrites(d.Rewrites, host, qtype) </s> remove if r.Domain != host { if !matchDomainWildcard(host, r.Domain) { continue } </s> add if r.Domain != host && !matchDomainWildcard(host, r.Domain) { continue } // Return CNAMEs for all types requests, but only the // appropriate ones for A and AAAA. if r.Type == dns.TypeCNAME || (r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA)) { rr = append(rr, r) </s> remove } else if r.Answer == "A" { </s> add case "A": </s> remove if r.Answer == "AAAA" { </s> add switch r.Answer { case "AAAA": </s> add default: // Go on.
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/filtering.go
keep keep keep add keep keep keep keep keep keep
<mask> ) <mask> <mask> // RewriteEntry is a rewrite array element <mask> type RewriteEntry struct { <mask> Domain string `yaml:"domain"` <mask> // Answer is the IP address, canonical name, or one of the special <mask> // values: "A" or "AAAA". <mask> Answer string `yaml:"answer"` <mask> // IP is the IP address that should be used in the response if Type is <mask> // A or AAAA. </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove Answer string `yaml:"answer"` // IP address or canonical name Type uint16 `yaml:"-"` // DNS record type: CNAME, A or AAAA IP net.IP `yaml:"-"` // Parsed IP address (if Type is A or AAAA) </s> add // Answer is the IP address, canonical name, or one of the special // values: "A" or "AAAA". Answer string `yaml:"answer"` // IP is the IP address that should be used in the response if Type is // A or AAAA. IP net.IP `yaml:"-"` // Type is the DNS record type: A, AAAA, or CNAME. Type uint16 `yaml:"-"` </s> remove // Get the list of matched rewrite entries. // Priority: CNAME, A/AAAA; exact, wildcard. // If matched exactly, don't return wildcard entries. // If matched by several wildcards, select the more specific one func findRewrites(a []RewriteEntry, host string) []RewriteEntry { rr := rewritesArray{} </s> add // findRewrites returns the list of matched rewrite entries. The priority is: // CNAME, then A and AAAA; exact, then wildcard. If the host is matched // exactly, wildcard entries aren't returned. If the host matched by wildcards, // return the most specific for the question type. func findRewrites(a []RewriteEntry, host string, qtype uint16) []RewriteEntry { rr := rewritesSorted{} </s> remove // Prepare entry for use </s> add // prepare prepares the a new or decoded entry. </s> remove type rewritesArray []RewriteEntry </s> add // rewritesSorted is a slice of legacy rewrites for sorting. // // The sorting priority: // // A and AAAA > CNAME // wildcard > exact // lower level wildcard > higher level wildcard // type rewritesSorted []RewriteEntry </s> remove res.Reason = 0 </s> add res.Reason = NotFilteredNotFound </s> remove if r.Domain != host { if !matchDomainWildcard(host, r.Domain) { continue } </s> add if r.Domain != host && !matchDomainWildcard(host, r.Domain) { continue } // Return CNAMEs for all types requests, but only the // appropriate ones for A and AAAA. if r.Type == dns.TypeCNAME || (r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA)) { rr = append(rr, r)
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> <mask> // RewriteEntry is a rewrite array element <mask> type RewriteEntry struct { <mask> Domain string `yaml:"domain"` <mask> Answer string `yaml:"answer"` // IP address or canonical name <mask> Type uint16 `yaml:"-"` // DNS record type: CNAME, A or AAAA <mask> IP net.IP `yaml:"-"` // Parsed IP address (if Type is A or AAAA) <mask> } <mask> <mask> func (r *RewriteEntry) equals(b RewriteEntry) bool { <mask> return r.Domain == b.Domain && r.Answer == b.Answer <mask> } </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> add // Domain is the domain for which this rewrite should work. </s> remove // Prepare entry for use </s> add // prepare prepares the a new or decoded entry. </s> remove return len(host) >= 2 && host[0] == '*' && host[1] == '.' </s> add return len(host) > 1 && host[0] == '*' && host[1] == '.' </s> remove type rewritesArray []RewriteEntry </s> add // rewritesSorted is a slice of legacy rewrites for sorting. // // The sorting priority: // // A and AAAA > CNAME // wildcard > exact // lower level wildcard > higher level wildcard // type rewritesSorted []RewriteEntry </s> remove res.Reason = 0 </s> add res.Reason = NotFilteredNotFound </s> remove if r.Answer == "AAAA" { </s> add switch r.Answer { case "AAAA":
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites.go
keep keep replace replace keep keep replace replace replace replace keep
<mask> <mask> func isWildcard(host string) bool { <mask> return len(host) >= 2 && <mask> host[0] == '*' && host[1] == '.' <mask> } <mask> <mask> // Return TRUE of host name matches a wildcard pattern <mask> func matchDomainWildcard(host, wildcard string) bool { <mask> return isWildcard(wildcard) && <mask> strings.HasSuffix(host, wildcard[1:]) <mask> } </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove type rewritesArray []RewriteEntry </s> add // rewritesSorted is a slice of legacy rewrites for sorting. // // The sorting priority: // // A and AAAA > CNAME // wildcard > exact // lower level wildcard > higher level wildcard // type rewritesSorted []RewriteEntry </s> remove // Priority: // . CNAME < A/AAAA; // . exact < wildcard; // . higher level wildcard < lower level wildcard func (a rewritesArray) Less(i, j int) bool { </s> add // Less implements the sort.Interface interface for legacyRewritesSorted. func (a rewritesSorted) Less(i, j int) bool { </s> remove if r.Domain != host { if !matchDomainWildcard(host, r.Domain) { continue } </s> add if r.Domain != host && !matchDomainWildcard(host, r.Domain) { continue } // Return CNAMEs for all types requests, but only the // appropriate ones for A and AAAA. if r.Type == dns.TypeCNAME || (r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA)) { rr = append(rr, r) </s> remove // Get the list of matched rewrite entries. // Priority: CNAME, A/AAAA; exact, wildcard. // If matched exactly, don't return wildcard entries. // If matched by several wildcards, select the more specific one func findRewrites(a []RewriteEntry, host string) []RewriteEntry { rr := rewritesArray{} </s> add // findRewrites returns the list of matched rewrite entries. The priority is: // CNAME, then A and AAAA; exact, then wildcard. If the host is matched // exactly, wildcard entries aren't returned. If the host matched by wildcards, // return the most specific for the question type. func findRewrites(a []RewriteEntry, host string, qtype uint16) []RewriteEntry { rr := rewritesSorted{} </s> remove if (r.Type == dns.TypeA && qtype == dns.TypeA) || (r.Type == dns.TypeAAAA && qtype == dns.TypeAAAA) { </s> add if r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA) {
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites.go
keep keep keep keep replace keep replace keep keep keep keep
<mask> return isWildcard(wildcard) && <mask> strings.HasSuffix(host, wildcard[1:]) <mask> } <mask> <mask> type rewritesArray []RewriteEntry <mask> <mask> func (a rewritesArray) Len() int { return len(a) } <mask> <mask> func (a rewritesArray) Swap(i, j int) { a[i], a[j] = a[j], a[i] } <mask> <mask> // Priority: </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove func (a rewritesArray) Swap(i, j int) { a[i], a[j] = a[j], a[i] } </s> add // Swap implements the sort.Interface interface for legacyRewritesSorted. func (a rewritesSorted) Swap(i, j int) { a[i], a[j] = a[j], a[i] } </s> remove // Priority: // . CNAME < A/AAAA; // . exact < wildcard; // . higher level wildcard < lower level wildcard func (a rewritesArray) Less(i, j int) bool { </s> add // Less implements the sort.Interface interface for legacyRewritesSorted. func (a rewritesSorted) Less(i, j int) bool { </s> remove // Return TRUE of host name matches a wildcard pattern func matchDomainWildcard(host, wildcard string) bool { return isWildcard(wildcard) && strings.HasSuffix(host, wildcard[1:]) </s> add // matchDomainWildcard returns true if host matches the wildcard pattern. func matchDomainWildcard(host, wildcard string) (ok bool) { return isWildcard(wildcard) && strings.HasSuffix(host, wildcard[1:]) </s> remove return len(host) >= 2 && host[0] == '*' && host[1] == '.' </s> add return len(host) > 1 && host[0] == '*' && host[1] == '.' </s> remove // Get the list of matched rewrite entries. // Priority: CNAME, A/AAAA; exact, wildcard. // If matched exactly, don't return wildcard entries. // If matched by several wildcards, select the more specific one func findRewrites(a []RewriteEntry, host string) []RewriteEntry { rr := rewritesArray{} </s> add // findRewrites returns the list of matched rewrite entries. The priority is: // CNAME, then A and AAAA; exact, then wildcard. If the host is matched // exactly, wildcard entries aren't returned. If the host matched by wildcards, // return the most specific for the question type. func findRewrites(a []RewriteEntry, host string, qtype uint16) []RewriteEntry { rr := rewritesSorted{}
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites.go
keep keep keep replace keep replace replace replace replace replace keep keep
<mask> <mask> func (a rewritesArray) Len() int { return len(a) } <mask> <mask> func (a rewritesArray) Swap(i, j int) { a[i], a[j] = a[j], a[i] } <mask> <mask> // Priority: <mask> // . CNAME < A/AAAA; <mask> // . exact < wildcard; <mask> // . higher level wildcard < lower level wildcard <mask> func (a rewritesArray) Less(i, j int) bool { <mask> if a[i].Type == dns.TypeCNAME && a[j].Type != dns.TypeCNAME { <mask> return true </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove func (a rewritesArray) Len() int { return len(a) } </s> add // Len implements the sort.Interface interface for legacyRewritesSorted. func (a rewritesSorted) Len() int { return len(a) } </s> remove type rewritesArray []RewriteEntry </s> add // rewritesSorted is a slice of legacy rewrites for sorting. // // The sorting priority: // // A and AAAA > CNAME // wildcard > exact // lower level wildcard > higher level wildcard // type rewritesSorted []RewriteEntry </s> remove // Return TRUE of host name matches a wildcard pattern func matchDomainWildcard(host, wildcard string) bool { return isWildcard(wildcard) && strings.HasSuffix(host, wildcard[1:]) </s> add // matchDomainWildcard returns true if host matches the wildcard pattern. func matchDomainWildcard(host, wildcard string) (ok bool) { return isWildcard(wildcard) && strings.HasSuffix(host, wildcard[1:]) </s> remove return len(host) >= 2 && host[0] == '*' && host[1] == '.' </s> add return len(host) > 1 && host[0] == '*' && host[1] == '.' </s> remove // Get the list of matched rewrite entries. // Priority: CNAME, A/AAAA; exact, wildcard. // If matched exactly, don't return wildcard entries. // If matched by several wildcards, select the more specific one func findRewrites(a []RewriteEntry, host string) []RewriteEntry { rr := rewritesArray{} </s> add // findRewrites returns the list of matched rewrite entries. The priority is: // CNAME, then A and AAAA; exact, then wildcard. If the host is matched // exactly, wildcard entries aren't returned. If the host matched by wildcards, // return the most specific for the question type. func findRewrites(a []RewriteEntry, host string, qtype uint16) []RewriteEntry { rr := rewritesSorted{}
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites.go
keep keep keep keep replace keep replace
<mask> // both are wildcards <mask> return len(a[i].Domain) > len(a[j].Domain) <mask> } <mask> <mask> // Prepare entry for use <mask> func (r *RewriteEntry) prepare() { <mask> if r.Answer == "AAAA" { </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove } else if r.Answer == "A" { </s> add case "A": </s> remove return len(host) >= 2 && host[0] == '*' && host[1] == '.' </s> add return len(host) > 1 && host[0] == '*' && host[1] == '.' </s> remove type rewritesArray []RewriteEntry </s> add // rewritesSorted is a slice of legacy rewrites for sorting. // // The sorting priority: // // A and AAAA > CNAME // wildcard > exact // lower level wildcard > higher level wildcard // type rewritesSorted []RewriteEntry </s> remove // Priority: // . CNAME < A/AAAA; // . exact < wildcard; // . higher level wildcard < lower level wildcard func (a rewritesArray) Less(i, j int) bool { </s> add // Less implements the sort.Interface interface for legacyRewritesSorted. func (a rewritesSorted) Less(i, j int) bool { </s> remove Answer string `yaml:"answer"` // IP address or canonical name Type uint16 `yaml:"-"` // DNS record type: CNAME, A or AAAA IP net.IP `yaml:"-"` // Parsed IP address (if Type is A or AAAA) </s> add // Answer is the IP address, canonical name, or one of the special // values: "A" or "AAAA". Answer string `yaml:"answer"` // IP is the IP address that should be used in the response if Type is // A or AAAA. IP net.IP `yaml:"-"` // Type is the DNS record type: A, AAAA, or CNAME. Type uint16 `yaml:"-"`
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites.go
keep keep keep keep replace keep keep keep keep keep
<mask> if r.Answer == "AAAA" { <mask> r.IP = nil <mask> r.Type = dns.TypeAAAA <mask> return <mask> } else if r.Answer == "A" { <mask> r.IP = nil <mask> r.Type = dns.TypeA <mask> return <mask> } <mask> </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove if r.Answer == "AAAA" { </s> add switch r.Answer { case "AAAA": </s> remove r.IP = ip r.Type = dns.TypeAAAA </s> add </s> add default: // Go on. </s> remove // Prepare entry for use </s> add // prepare prepares the a new or decoded entry. </s> remove if (r.Type == dns.TypeA && qtype == dns.TypeA) || (r.Type == dns.TypeAAAA && qtype == dns.TypeAAAA) { </s> add if r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA) { </s> add } else { r.IP = ip r.Type = dns.TypeAAAA
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites.go
keep keep keep add keep keep keep keep keep keep
<mask> r.IP = nil <mask> r.Type = dns.TypeA <mask> <mask> return <mask> } <mask> <mask> ip := net.ParseIP(r.Answer) <mask> if ip == nil { <mask> r.Type = dns.TypeCNAME <mask> </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove r.IP = ip r.Type = dns.TypeAAAA </s> add </s> remove } else if r.Answer == "A" { </s> add case "A": </s> add } else { r.IP = ip r.Type = dns.TypeAAAA </s> remove if r.Answer == "AAAA" { </s> add switch r.Answer { case "AAAA": </s> remove if (r.Type == dns.TypeA && qtype == dns.TypeA) || (r.Type == dns.TypeAAAA && qtype == dns.TypeAAAA) { </s> add if r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA) { </s> remove // Prepare entry for use </s> add // prepare prepares the a new or decoded entry.
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> r.Type = dns.TypeCNAME <mask> return <mask> } <mask> <mask> r.IP = ip <mask> r.Type = dns.TypeAAAA <mask> <mask> ip4 := ip.To4() <mask> if ip4 != nil { <mask> r.IP = ip4 <mask> r.Type = dns.TypeA <mask> } </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> add } else { r.IP = ip r.Type = dns.TypeAAAA </s> add default: // Go on. </s> remove } else if r.Answer == "A" { </s> add case "A": </s> remove if r.Answer == "AAAA" { </s> add switch r.Answer { case "AAAA": </s> remove if (r.Type == dns.TypeA && qtype == dns.TypeA) || (r.Type == dns.TypeAAAA && qtype == dns.TypeAAAA) { </s> add if r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA) { </s> remove // Prepare entry for use </s> add // prepare prepares the a new or decoded entry.
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites.go
keep add keep keep keep keep keep
<mask> r.IP = ip4 <mask> r.Type = dns.TypeA <mask> } <mask> } <mask> <mask> func (d *DNSFilter) prepareRewrites() { <mask> for i := range d.Rewrites { </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove r.IP = ip r.Type = dns.TypeAAAA </s> add </s> remove } else if r.Answer == "A" { </s> add case "A": </s> add default: // Go on. </s> remove rr := findRewrites(d.Rewrites, host) </s> add rr := findRewrites(d.Rewrites, host, qtype) </s> remove if (r.Type == dns.TypeA && qtype == dns.TypeA) || (r.Type == dns.TypeAAAA && qtype == dns.TypeAAAA) { </s> add if r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA) { </s> remove if r.Answer == "AAAA" { </s> add switch r.Answer { case "AAAA":
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites.go
keep keep keep keep replace replace replace replace replace replace keep replace replace replace replace
<mask> d.Rewrites[i].prepare() <mask> } <mask> } <mask> <mask> // Get the list of matched rewrite entries. <mask> // Priority: CNAME, A/AAAA; exact, wildcard. <mask> // If matched exactly, don't return wildcard entries. <mask> // If matched by several wildcards, select the more specific one <mask> func findRewrites(a []RewriteEntry, host string) []RewriteEntry { <mask> rr := rewritesArray{} <mask> for _, r := range a { <mask> if r.Domain != host { <mask> if !matchDomainWildcard(host, r.Domain) { <mask> continue <mask> } </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove // Return TRUE of host name matches a wildcard pattern func matchDomainWildcard(host, wildcard string) bool { return isWildcard(wildcard) && strings.HasSuffix(host, wildcard[1:]) </s> add // matchDomainWildcard returns true if host matches the wildcard pattern. func matchDomainWildcard(host, wildcard string) (ok bool) { return isWildcard(wildcard) && strings.HasSuffix(host, wildcard[1:]) </s> remove // Priority: // . CNAME < A/AAAA; // . exact < wildcard; // . higher level wildcard < lower level wildcard func (a rewritesArray) Less(i, j int) bool { </s> add // Less implements the sort.Interface interface for legacyRewritesSorted. func (a rewritesSorted) Less(i, j int) bool { </s> remove rr = append(rr, r) </s> add </s> remove func (a rewritesArray) Len() int { return len(a) } </s> add // Len implements the sort.Interface interface for legacyRewritesSorted. func (a rewritesSorted) Len() int { return len(a) } </s> remove func (a rewritesArray) Swap(i, j int) { a[i], a[j] = a[j], a[i] } </s> add // Swap implements the sort.Interface interface for legacyRewritesSorted. func (a rewritesSorted) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites.go
keep keep keep keep replace keep keep keep keep keep
<mask> if !matchDomainWildcard(host, r.Domain) { <mask> continue <mask> } <mask> } <mask> rr = append(rr, r) <mask> } <mask> <mask> if len(rr) == 0 { <mask> return nil <mask> } </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove if r.Domain != host { if !matchDomainWildcard(host, r.Domain) { continue } </s> add if r.Domain != host && !matchDomainWildcard(host, r.Domain) { continue } // Return CNAMEs for all types requests, but only the // appropriate ones for A and AAAA. if r.Type == dns.TypeCNAME || (r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA)) { rr = append(rr, r) </s> remove if (r.Type == dns.TypeA && qtype == dns.TypeA) || (r.Type == dns.TypeAAAA && qtype == dns.TypeAAAA) { </s> add if r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA) { </s> remove } else if r.Answer == "A" { </s> add case "A": </s> remove rr := findRewrites(d.Rewrites, host) </s> add rr := findRewrites(d.Rewrites, host, qtype) </s> remove if r.Answer == "AAAA" { </s> add switch r.Answer { case "AAAA": </s> remove res.Reason = 0 </s> add res.Reason = NotFilteredNotFound
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites.go
keep keep add keep keep keep keep
<mask> }, { <mask> Domain: "a.host3.com", <mask> Answer: "x.host.com", <mask> }} <mask> d.prepareRewrites() <mask> <mask> testCases := []struct { </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> add Type: dns.TypeA, </s> add Type: dns.TypeA, </s> remove dtyp: dns.TypeA, </s> add </s> add dtyp: dns.TypeA, }, { name: "issue3343", host: "www.hostboth.com", wantCName: "", wantVals: []net.IP{net.ParseIP("1234::5678")}, dtyp: dns.TypeAAAA, </s> add Type: dns.TypeAAAA, </s> add Type: dns.TypeA,
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> testCases := []struct { <mask> name string <mask> host string <mask> dtyp uint16 <mask> wantCName string <mask> wantVals []net.IP <mask> }{{ <mask> name: "not_filtered_not_found", <mask> host: "hoost.com", </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> add dtyp uint16 </s> remove dtyp uint16 </s> add </s> remove name: "not_filtered_not_found", host: "hoost.com", dtyp: dns.TypeA, </s> add name: "not_filtered_not_found", host: "hoost.com", wantCName: "", wantVals: nil, dtyp: dns.TypeA, </s> add dtyp uint16 </s> add Type: dns.TypeA, </s> add Type: dns.TypeA,
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go
keep keep add keep keep keep keep keep keep
<mask> host string <mask> wantCName string <mask> wantVals []net.IP <mask> }{{ <mask> name: "not_filtered_not_found", <mask> host: "hoost.com", <mask> wantCName: "", <mask> wantVals: nil, <mask> dtyp: dns.TypeA, </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove name: "not_filtered_not_found", host: "hoost.com", dtyp: dns.TypeA, </s> add name: "not_filtered_not_found", host: "hoost.com", wantCName: "", wantVals: nil, dtyp: dns.TypeA, </s> remove dtyp uint16 </s> add </s> remove dtyp uint16 </s> add </s> add dtyp uint16 </s> add Type: dns.TypeA, </s> add dtyp: dns.TypeAAAA,
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go
keep replace replace replace keep keep keep replace keep keep keep keep
<mask> }{{ <mask> name: "not_filtered_not_found", <mask> host: "hoost.com", <mask> dtyp: dns.TypeA, <mask> }, { <mask> name: "rewritten_a", <mask> host: "www.host.com", <mask> dtyp: dns.TypeA, <mask> wantCName: "host.com", <mask> wantVals: []net.IP{{1, 2, 3, 4}, {1, 2, 3, 5}}, <mask> }, { <mask> name: "rewritten_aaaa", </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> add dtyp: dns.TypeA, </s> remove dtyp: dns.TypeAAAA, </s> add </s> remove dtyp: dns.TypeA, </s> add </s> remove dtyp: dns.TypeA, </s> add </s> add dtyp: dns.TypeA,
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go
keep keep keep add keep keep keep keep keep
<mask> name: "rewritten_a", <mask> host: "www.host.com", <mask> wantCName: "host.com", <mask> wantVals: []net.IP{{1, 2, 3, 4}, {1, 2, 3, 5}}, <mask> }, { <mask> name: "rewritten_aaaa", <mask> host: "www.host.com", <mask> wantCName: "host.com", <mask> wantVals: []net.IP{net.ParseIP("1:2:3::4")}, </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove dtyp: dns.TypeA, </s> add </s> remove dtyp: dns.TypeAAAA, </s> add </s> remove dtyp: dns.TypeA, </s> add </s> add dtyp: dns.TypeA, </s> remove name: "wildcard_match", host: "abc.host.com", dtyp: dns.TypeA, wantVals: []net.IP{{1, 2, 3, 5}}, </s> add name: "wildcard_match", host: "abc.host.com", wantCName: "", wantVals: []net.IP{{1, 2, 3, 5}}, dtyp: dns.TypeA, </s> remove dtyp: dns.TypeA, </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> wantVals: []net.IP{{1, 2, 3, 4}, {1, 2, 3, 5}}, <mask> }, { <mask> name: "rewritten_aaaa", <mask> host: "www.host.com", <mask> dtyp: dns.TypeAAAA, <mask> wantCName: "host.com", <mask> wantVals: []net.IP{net.ParseIP("1:2:3::4")}, <mask> }, { <mask> name: "wildcard_match", <mask> host: "abc.host.com", </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> add dtyp: dns.TypeA, </s> remove name: "wildcard_match", host: "abc.host.com", dtyp: dns.TypeA, wantVals: []net.IP{{1, 2, 3, 5}}, </s> add name: "wildcard_match", host: "abc.host.com", wantCName: "", wantVals: []net.IP{{1, 2, 3, 5}}, dtyp: dns.TypeA, </s> remove dtyp: dns.TypeA, </s> add </s> remove dtyp: dns.TypeA, </s> add </s> add dtyp: dns.TypeAAAA, </s> remove dtyp: dns.TypeA, </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go
keep keep add keep keep keep keep
<mask> host: "www.host.com", <mask> wantCName: "host.com", <mask> wantVals: []net.IP{net.ParseIP("1:2:3::4")}, <mask> }, { <mask> name: "wildcard_match", <mask> host: "abc.host.com", <mask> wantCName: "", </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove dtyp: dns.TypeAAAA, </s> add </s> remove name: "wildcard_match", host: "abc.host.com", dtyp: dns.TypeA, wantVals: []net.IP{{1, 2, 3, 5}}, </s> add name: "wildcard_match", host: "abc.host.com", wantCName: "", wantVals: []net.IP{{1, 2, 3, 5}}, dtyp: dns.TypeA, </s> add dtyp: dns.TypeA, </s> remove name: "wildcard_override", host: "a.host.com", dtyp: dns.TypeA, wantVals: []net.IP{{1, 2, 3, 4}}, </s> add name: "wildcard_override", host: "a.host.com", wantCName: "", wantVals: []net.IP{{1, 2, 3, 4}}, dtyp: dns.TypeA, </s> remove name: "not_filtered_not_found", host: "hoost.com", dtyp: dns.TypeA, </s> add name: "not_filtered_not_found", host: "hoost.com", wantCName: "", wantVals: nil, dtyp: dns.TypeA, </s> remove dtyp: dns.TypeA, </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go
keep keep keep replace replace replace replace keep replace replace replace replace keep
<mask> wantCName: "host.com", <mask> wantVals: []net.IP{net.ParseIP("1:2:3::4")}, <mask> }, { <mask> name: "wildcard_match", <mask> host: "abc.host.com", <mask> dtyp: dns.TypeA, <mask> wantVals: []net.IP{{1, 2, 3, 5}}, <mask> }, { <mask> name: "wildcard_override", <mask> host: "a.host.com", <mask> dtyp: dns.TypeA, <mask> wantVals: []net.IP{{1, 2, 3, 4}}, <mask> }, { </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove dtyp: dns.TypeAAAA, </s> add </s> remove dtyp: dns.TypeA, </s> add </s> add dtyp: dns.TypeA, </s> remove dtyp: dns.TypeA, </s> add </s> add dtyp: dns.TypeAAAA,
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> wantVals: []net.IP{{1, 2, 3, 4}}, <mask> }, { <mask> name: "wildcard_cname_interaction", <mask> host: "www.host2.com", <mask> dtyp: dns.TypeA, <mask> wantCName: "host.com", <mask> wantVals: []net.IP{{1, 2, 3, 4}, {1, 2, 3, 5}}, <mask> }, { <mask> name: "two_cnames", <mask> host: "b.host.com", </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> add dtyp: dns.TypeA, </s> remove dtyp: dns.TypeA, </s> add </s> remove name: "wildcard_override", host: "a.host.com", dtyp: dns.TypeA, wantVals: []net.IP{{1, 2, 3, 4}}, </s> add name: "wildcard_override", host: "a.host.com", wantCName: "", wantVals: []net.IP{{1, 2, 3, 4}}, dtyp: dns.TypeA, </s> remove dtyp: dns.TypeAAAA, </s> add </s> add dtyp: dns.TypeA, </s> remove dtyp: dns.TypeA, </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go
keep keep keep add keep keep keep keep keep keep
<mask> name: "wildcard_cname_interaction", <mask> host: "www.host2.com", <mask> wantCName: "host.com", <mask> wantVals: []net.IP{{1, 2, 3, 4}, {1, 2, 3, 5}}, <mask> }, { <mask> name: "two_cnames", <mask> host: "b.host.com", <mask> wantCName: "somehost.com", <mask> wantVals: []net.IP{{0, 0, 0, 0}}, <mask> dtyp: dns.TypeA, </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove dtyp: dns.TypeA, </s> add </s> add dtyp: dns.TypeA, </s> remove dtyp: dns.TypeA, </s> add </s> remove dtyp: dns.TypeA, </s> add </s> add dtyp: dns.TypeA, </s> remove name: "wildcard_override", host: "a.host.com", dtyp: dns.TypeA, wantVals: []net.IP{{1, 2, 3, 4}}, </s> add name: "wildcard_override", host: "a.host.com", wantCName: "", wantVals: []net.IP{{1, 2, 3, 4}}, dtyp: dns.TypeA,
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> wantVals: []net.IP{{1, 2, 3, 4}, {1, 2, 3, 5}}, <mask> }, { <mask> name: "two_cnames", <mask> host: "b.host.com", <mask> dtyp: dns.TypeA, <mask> wantCName: "somehost.com", <mask> wantVals: []net.IP{{0, 0, 0, 0}}, <mask> }, { <mask> name: "two_cnames_and_wildcard", <mask> host: "b.host3.com", </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> add dtyp: dns.TypeA, </s> add dtyp: dns.TypeA, </s> remove dtyp: dns.TypeA, </s> add </s> remove dtyp: dns.TypeA, </s> add </s> remove dtyp: dns.TypeAAAA, </s> add </s> add dtyp: dns.TypeA,
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go
keep keep add keep keep keep keep keep
<mask> host: "b.host.com", <mask> wantCName: "somehost.com", <mask> wantVals: []net.IP{{0, 0, 0, 0}}, <mask> }, { <mask> name: "two_cnames_and_wildcard", <mask> host: "b.host3.com", <mask> wantCName: "x.host.com", <mask> wantVals: []net.IP{{1, 2, 3, 5}}, </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove dtyp: dns.TypeA, </s> add </s> remove dtyp: dns.TypeA, </s> add </s> add dtyp: dns.TypeA, </s> add dtyp: dns.TypeA, }, { name: "issue3343", host: "www.hostboth.com", wantCName: "", wantVals: []net.IP{net.ParseIP("1234::5678")}, dtyp: dns.TypeAAAA, </s> remove dtyp: dns.TypeA, </s> add </s> remove name: "wildcard_match", host: "abc.host.com", dtyp: dns.TypeA, wantVals: []net.IP{{1, 2, 3, 5}}, </s> add name: "wildcard_match", host: "abc.host.com", wantCName: "", wantVals: []net.IP{{1, 2, 3, 5}}, dtyp: dns.TypeA,
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> wantVals: []net.IP{{0, 0, 0, 0}}, <mask> }, { <mask> name: "two_cnames_and_wildcard", <mask> host: "b.host3.com", <mask> dtyp: dns.TypeA, <mask> wantCName: "x.host.com", <mask> wantVals: []net.IP{{1, 2, 3, 5}}, <mask> }} <mask> <mask> for _, tc := range testCases { </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> add dtyp: dns.TypeA, </s> remove dtyp: dns.TypeA, </s> add </s> add dtyp: dns.TypeA, }, { name: "issue3343", host: "www.hostboth.com", wantCName: "", wantVals: []net.IP{net.ParseIP("1234::5678")}, dtyp: dns.TypeAAAA, </s> add dtyp: dns.TypeA, </s> remove want: []net.IP{}, </s> add </s> add want: nil,
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go
keep keep keep add keep keep keep keep
<mask> name: "two_cnames_and_wildcard", <mask> host: "b.host3.com", <mask> wantCName: "x.host.com", <mask> wantVals: []net.IP{{1, 2, 3, 5}}, <mask> }} <mask> <mask> for _, tc := range testCases { <mask> t.Run(tc.name, func(t *testing.T) { </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove dtyp: dns.TypeA, </s> add </s> add want: nil, </s> remove want: []net.IP{}, </s> add </s> add dtyp: dns.TypeA, </s> remove dtyp: dns.TypeA, </s> add </s> remove name: "wildcard_match", host: "abc.host.com", dtyp: dns.TypeA, wantVals: []net.IP{{1, 2, 3, 5}}, </s> add name: "wildcard_match", host: "abc.host.com", wantCName: "", wantVals: []net.IP{{1, 2, 3, 5}}, dtyp: dns.TypeA,
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go
keep keep add keep keep keep keep keep
<mask> d.Rewrites = []RewriteEntry{{ <mask> Domain: "host.com", <mask> Answer: "1.1.1.1", <mask> }, { <mask> Domain: "*.host.com", <mask> Answer: "2.2.2.2", <mask> Type: dns.TypeA, <mask> }, { </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> add Type: dns.TypeA, </s> add Type: dns.TypeA, </s> add Type: dns.TypeAAAA, </s> add Type: dns.TypeA, </s> add Type: dns.TypeAAAA, </s> add }, { Domain: "*.hostboth.com", Answer: "1.2.3.6", }, { Domain: "*.hostboth.com", Answer: "1234::5678",
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go
keep add keep keep keep keep
<mask> Domain: "*.host.com", <mask> Answer: "2.2.2.2", <mask> }, { <mask> Domain: "*.sub.host.com", <mask> Answer: "3.3.3.3", <mask> Type: dns.TypeA, </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> add Type: dns.TypeA, </s> add Type: dns.TypeA, </s> add Type: dns.TypeAAAA, </s> add Type: dns.TypeA, </s> add Type: dns.TypeAAAA, </s> add Type: dns.TypeA,
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go
keep keep keep add keep keep keep keep keep keep
<mask> Type: dns.TypeA, <mask> }, { <mask> Domain: "*.sub.host.com", <mask> Answer: "3.3.3.3", <mask> }} <mask> d.prepareRewrites() <mask> <mask> testCases := []struct { <mask> name string <mask> host string </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> add Type: dns.TypeA, </s> add }, { Domain: "*.hostboth.com", Answer: "1.2.3.6", }, { Domain: "*.hostboth.com", Answer: "1234::5678", </s> add Type: dns.TypeA, </s> remove dtyp uint16 </s> add </s> remove dtyp uint16 </s> add </s> add Type: dns.TypeAAAA,
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go
keep keep keep add keep keep keep keep keep keep
<mask> // Exception for AAAA record. <mask> d.Rewrites = []RewriteEntry{{ <mask> Domain: "host.com", <mask> Answer: "1.2.3.4", <mask> }, { <mask> Domain: "host.com", <mask> Answer: "AAAA", <mask> Type: dns.TypeAAAA, <mask> }, { <mask> Domain: "host2.com", </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> add Type: dns.TypeAAAA, </s> add Type: dns.TypeA, </s> add Type: dns.TypeAAAA, </s> add Type: dns.TypeA, </s> add Type: dns.TypeA, </s> add }, { Domain: "*.hostboth.com", Answer: "1.2.3.6", }, { Domain: "*.hostboth.com", Answer: "1234::5678",
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites_test.go