Skip to content

Commit

Permalink
all: imp names, docs
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneOne1 committed Jan 19, 2022
1 parent 12c8d9f commit 6e10600
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions internal/home/controlinstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (req *checkConfReq) validateWeb(uv aghalgo.UniquenessValidator) (err error)
// validateDNS returns error if the DNS part of the initial configuration can't
// be set. autofix is true if the port can be unbound by AdGuard Home
// automatically.
func (req *checkConfReq) validateDNS(uv aghalgo.UniquenessValidator) (autofix bool, err error) {
func (req *checkConfReq) validateDNS(uv aghalgo.UniquenessValidator) (canAutofix bool, err error) {
defer func() { err = errors.Annotate(err, "validating ports: %w") }()

port := req.DNS.Port
Expand All @@ -143,8 +143,8 @@ func (req *checkConfReq) validateDNS(uv aghalgo.UniquenessValidator) (autofix bo
case 0:
return false, nil
case config.BindPort:
// Go on and check only UDP since the port will be unbound for TCP on
// installation finish.
// Go on and only check the UDP port since the TCP one is already bound
// by AdGuard Home for web interface.
default:
// Check TCP either.
err = aghnet.CheckPort("tcp", req.DNS.IP, port)
Expand All @@ -159,17 +159,17 @@ func (req *checkConfReq) validateDNS(uv aghalgo.UniquenessValidator) (autofix bo
}

// Try to fix automatically.
autofix = checkDNSStubListener()
if autofix && req.DNS.Autofix {
canAutofix = checkDNSStubListener()
if canAutofix && req.DNS.Autofix {
if derr := disableDNSStubListener(); derr != nil {
log.Error("disabling DNSStubListener: %s", err)
}

err = aghnet.CheckPort("udp", req.DNS.IP, port)
autofix = false
canAutofix = false
}

return autofix, err
return canAutofix, err
}

// handleInstallCheckConfig handles the /check_config endpoint.
Expand Down

0 comments on commit 6e10600

Please sign in to comment.