Compare commits

..

8 Commits

Author SHA1 Message Date
Andrey Meshkov
9fe34818e3 Fix #770 - dnsproxy v0.15.0
* commit '9a77bb3a0acddf88f32991e13891270deea5725c':
  go mod tidy
  * dnsproxy v0.15.0
2019-06-07 20:13:59 +03:00
Andrey Meshkov
9a77bb3a0a go mod tidy 2019-06-07 20:10:07 +03:00
Simon Zolin
86890a8609 * dnsproxy v0.15.0 2019-06-07 19:59:11 +03:00
Simon Zolin
1fd0f78612 Merge: - clients: fix race introduced by commit 07db927; update tech doc
Close #727

* commit '1fcb69d3a913dec9b53f148acab45b1f621faa24':
  - clients: fix race introduced by commit 07db927; update tech doc
2019-06-07 19:11:28 +03:00
Simon Zolin
1fcb69d3a9 - clients: fix race introduced by commit 07db927; update tech doc 2019-06-07 11:37:55 +03:00
Andrey Meshkov
07db927246 Fix #727 - use default parental sensitivity when it's not set 2019-06-06 22:42:17 +03:00
Andrey Meshkov
f9807e4011 Fix #806 2019-06-06 21:06:19 +03:00
Andrey Meshkov
5647bc1fc9 Fix #727 - apply client settings properly 2019-06-06 21:04:17 +03:00
7 changed files with 18 additions and 26 deletions

View File

@@ -526,7 +526,7 @@ Notes:
* If `use_global_settings` is true, then DNS responses for this client are processed and filtered using global settings.
* If `use_global_settings` is false, then the client-specific settings are used to override (disable) global settings. For example, if global setting `parental_enabled` is true, then per-client setting `parental_enabled:false` can disable Parental Control for this specific client.
* If `use_global_settings` is false, then the client-specific settings are used to override (enable or disable) global settings.
### Get list of clients

View File

@@ -18,7 +18,7 @@ const EncryptionTopline = (props) => {
if (isExpired) {
return (
<Topline type="danger">
<Trans components={[<a href="#settings" key="0">link</a>]}>
<Trans components={[<a href="#encryption" key="0">link</a>]}>
topline_expired_certificate
</Trans>
</Topline>
@@ -26,7 +26,7 @@ const EncryptionTopline = (props) => {
} else if (isAboutExpire) {
return (
<Topline type="warning">
<Trans components={[<a href="#settings" key="0">link</a>]}>
<Trans components={[<a href="#encryption" key="0">link</a>]}>
topline_expiring_certificate
</Trans>
</Topline>

16
dns.go
View File

@@ -221,18 +221,10 @@ func applyClientSettings(clientAddr string, setts *dnsfilter.RequestFilteringSet
}
log.Debug("Using settings for client with IP %s", clientAddr)
if !c.FilteringEnabled {
setts.FilteringEnabled = false
}
if !c.SafeSearchEnabled {
setts.SafeSearchEnabled = false
}
if !c.SafeBrowsingEnabled {
setts.SafeBrowsingEnabled = false
}
if !c.ParentalEnabled {
setts.ParentalEnabled = false
}
setts.FilteringEnabled = c.FilteringEnabled
setts.SafeSearchEnabled = c.SafeSearchEnabled
setts.SafeBrowsingEnabled = c.SafeBrowsingEnabled
setts.ParentalEnabled = c.ParentalEnabled
}
func startDNSServer() error {

View File

@@ -33,7 +33,8 @@ const defaultSafebrowsingServer = "sb.adtidy.org"
const defaultSafebrowsingURL = "%s://%s/safebrowsing-lookup-hash.html?prefixes=%s"
const defaultParentalServer = "pctrl.adguard.com"
const defaultParentalURL = "%s://%s/check-parental-control-hash?prefixes=%s&sensitivity=%d"
const maxDialCacheSize = 2 // the number of host names for safebrowsing and parental control
const defaultParentalSensitivity = 13 // use "TEEN" by default
const maxDialCacheSize = 2 // the number of host names for safebrowsing and parental control
// Custom filtering settings
type RequestFilteringSettings struct {
@@ -410,7 +411,11 @@ func (d *Dnsfilter) checkParental(host string) (Result, error) {
if d.UsePlainHTTP {
schema = "http"
}
url := fmt.Sprintf(defaultParentalURL, schema, d.parentalServer, hashparam, d.ParentalSensitivity)
sensitivity := d.ParentalSensitivity
if sensitivity == 0 {
sensitivity = defaultParentalSensitivity
}
url := fmt.Sprintf(defaultParentalURL, schema, d.parentalServer, hashparam, sensitivity)
return url
}
handleBody := func(body []byte, hashes map[string]bool) (Result, error) {

View File

@@ -123,7 +123,7 @@ func (l *queryLog) logRequest(question *dns.Msg, answer *dns.Msg, result *dnsfil
if needFlush {
// write to file
// do it in separate goroutine -- we are stalling DNS response this whole time
go l.flushLogBuffer(false)
go l.flushLogBuffer(false) // nolint
}
return &entry

2
go.mod
View File

@@ -3,7 +3,7 @@ module github.com/AdguardTeam/AdGuardHome
go 1.12
require (
github.com/AdguardTeam/dnsproxy v0.14.0
github.com/AdguardTeam/dnsproxy v0.15.0
github.com/AdguardTeam/golibs v0.1.3
github.com/AdguardTeam/urlfilter v0.3.0
github.com/NYTimes/gziphandler v1.1.1

9
go.sum
View File

@@ -1,5 +1,5 @@
github.com/AdguardTeam/dnsproxy v0.14.0 h1:ubB5031Oc8TfOWxRpYYDx0Lt181jiNGOfiOgEN5VJys=
github.com/AdguardTeam/dnsproxy v0.14.0/go.mod h1:50//JYIOMRnQnq0GQhvg516seqb5vjjyMIk+Z3RYy/s=
github.com/AdguardTeam/dnsproxy v0.15.0 h1:aK287RkLZmxWmwOZ8XqdhHYzP1I04gDQyzgXw6/nAZQ=
github.com/AdguardTeam/dnsproxy v0.15.0/go.mod h1:HYc+jgo3GRr82WSYPcbcNn6yJwnXuoMnbsb0Sz0ERLs=
github.com/AdguardTeam/golibs v0.1.2/go.mod h1:b0XkhgIcn2TxwX6C5AQMtpIFAgjPehNgxJErWkwA3ko=
github.com/AdguardTeam/golibs v0.1.3 h1:hmapdTtMtIk3T8eQDwTOLdqZLGDKNKk9325uC8z12xg=
github.com/AdguardTeam/golibs v0.1.3/go.mod h1:b0XkhgIcn2TxwX6C5AQMtpIFAgjPehNgxJErWkwA3ko=
@@ -86,10 +86,6 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90Pveol
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190422183909-d864b10871cd h1:sMHc2rZHuzQmrbVoSpt9HgerkXPyIeCSO6k0zUMGfFk=
golang.org/x/crypto v0.0.0-20190422183909-d864b10871cd/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190516052701-61b8692d9a5c/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/mobile v0.0.0-20190509164839-32b2708ab171/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190119204137-ed066c81e75e h1:MDa3fSUp6MdYHouVmCCNz/zaH2a6CRcxY3VhT/K3C5Q=
golang.org/x/net v0.0.0-20190119204137-ed066c81e75e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -108,7 +104,6 @@ golang.org/x/sys v0.0.0-20190122071731-054c452bb702 h1:Lk4tbZFnlyPgV+sLgTw5yGfzr
golang.org/x/sys v0.0.0-20190122071731-054c452bb702/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190424160641-4347357a82bc h1:ULV59IIHLrmESQT7EqC104GKra36T4CqHvPeEqR6v8M=
golang.org/x/sys v0.0.0-20190424160641-4347357a82bc/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=