Skip to content

Commit

Permalink
Merge branch 'master' into doc-deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
ainar-g committed Dec 25, 2020
2 parents 108097c + 1191a9a commit c189404
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 22 deletions.
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,22 @@ AdGuard Home provides a lot of features out-of-the-box with no need to install a

> Disclaimer: some of the listed features can be added to Pi-Hole by installing additional software or by manually using SSH terminal and reconfiguring one of the utilities Pi-Hole consists of. However, in our opinion, this cannot be legitimately counted as a Pi-Hole's feature.
| Feature | AdGuard Home | Pi-Hole |
|-------------------------------------------------------------------------|--------------|--------------------------------------------------------|
| Blocking ads and trackers |||
| Customizing blocklists |||
| Built-in DHCP server |||
| HTTPS for the Admin interface || Kind of, but you'll need to manually configure lighthttpd |
| Encrypted DNS upstream servers (DNS-over-HTTPS, DNS-over-TLS, DNSCrypt) || ❌ (requires additional software) |
| Cross-platform || ❌ (not natively, only via Docker) |
| Running as a DNS-over-HTTPS or DNS-over-TLS server || ❌ (requires additional software) |
| Blocking phishing and malware domains || ❌ (requires non-default blocklists) |
| Parental control (blocking adult domains) |||
| Force Safe search on search engines |||
| Per-client (device) configuration |||
| Access settings (choose who can use AGH DNS) |||
| Feature | AdGuard Home | Pi-Hole |
|-------------------------------------------------------------------------|-------------------|-----------------------------------------------------------|
| Blocking ads and trackers |||
| Customizing blocklists |||
| Built-in DHCP server |||
| HTTPS for the Admin interface || Kind of, but you'll need to manually configure lighthttpd |
| Encrypted DNS upstream servers (DNS-over-HTTPS, DNS-over-TLS, DNSCrypt) || ❌ (requires additional software) |
| Cross-platform || ❌ (not natively, only via Docker) |
| Running as a DNS-over-HTTPS or DNS-over-TLS server || ❌ (requires additional software) |
| Blocking phishing and malware domains || ❌ (requires non-default blocklists) |
| Parental control (blocking adult domains) |||
| Force Safe search on search engines |||
| Per-client (device) configuration |||
| Access settings (choose who can use AGH DNS) |||
| Written in a memory-safe language |||
| Running without root privileges |||

<a id="comparison-adblock"></a>
### How does AdGuard Home compare to traditional ad blockers
Expand Down
39 changes: 31 additions & 8 deletions internal/home/controlupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package home

import (
"encoding/json"
"errors"
"net/http"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"syscall"
"time"

"github.com/AdguardTeam/AdGuardHome/internal/sysutil"
"github.com/AdguardTeam/AdGuardHome/internal/update"
Expand All @@ -19,6 +20,13 @@ type getVersionJSONRequest struct {
RecheckNow bool `json:"recheck_now"`
}

// temporaryError is the interface for temporary errors from the Go standard
// library.
type temporaryError interface {
error
Temporary() (ok bool)
}

// Get the latest available version from the Internet
func handleGetVersionJSON(w http.ResponseWriter, r *http.Request) {
if Context.disableUpdate {
Expand All @@ -41,14 +49,29 @@ func handleGetVersionJSON(w http.ResponseWriter, r *http.Request) {

var info update.VersionInfo
for i := 0; i != 3; i++ {
Context.controlLock.Lock()
info, err = Context.updater.GetVersionResponse(req.RecheckNow)
Context.controlLock.Unlock()
if err != nil && strings.HasSuffix(err.Error(), "i/o timeout") {
// This case may happen while we're restarting DNS server
// https://github.com/AdguardTeam/AdGuardHome/internal/issues/934
continue
func() {
Context.controlLock.Lock()
defer Context.controlLock.Unlock()

info, err = Context.updater.GetVersionResponse(req.RecheckNow)
}()

if err != nil {
var terr temporaryError
if errors.As(err, &terr) && terr.Temporary() {
// Temporary network error. This case may happen while
// we're restarting our DNS server. Log and sleep for
// some time.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/934.
d := time.Duration(i) * time.Second
log.Info("temp net error: %q; sleeping for %s and retrying", err, d)
time.Sleep(d)

continue
}
}

break
}
if err != nil {
Expand Down

0 comments on commit c189404

Please sign in to comment.