code_before
stringlengths
16
1.81M
edits
stringlengths
4
328k
next_edit
stringlengths
0
76.5k
code_after
stringlengths
3
49.9M
label_window
sequencelengths
4
1.81k
instruction
stringlengths
20
51.9k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
"sync" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/AdguardTeam/golibs/cache" "github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/golibs/stringutil" "github.com/miekg/dns" "golang.org/x/exp/slices" "golang.org/x/net/publicsuffix"
</s> remove "github.com/AdguardTeam/golibs/stringutil" "github.com/miekg/dns" "golang.org/x/exp/slices" "golang.org/x/net/publicsuffix" </s> add </s> remove "time" </s> add </s> remove "github.com/AdguardTeam/dnsproxy/upstream" "github.com/AdguardTeam/golibs/cache" </s> add </s> remove "strings" </s> add </s> remove "github.com/AdguardTeam/golibs/cache" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering/hashprefix"
"sync" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/golibs/stringutil" "github.com/miekg/dns" "golang.org/x/exp/slices" "golang.org/x/net/publicsuffix"
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1837: AG-21462-imp-safebrowsing-parental Merge in DNS/adguard-home from AG-21462-imp-safebrowsing-parental to master Squashed commit of the following: commit 85016d4f1105e21a407efade0bd45b8362808061 Merge: 0e61edade 620b51e3e Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 16:36:30 2023 +0300 Merge branch 'master' into AG-21462-imp-safebrowsing-parental commit 0e61edadeff34f6305e941c1db94575c82f238d9 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 14:51:37 2023 +0300 filtering: imp tests commit 994255514cc0f67dfe33d5a0892432e8924d1e36 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:13:19 2023 +0300 filtering: fix typo commit 96d1069573171538333330d6af94ef0f4208a9c4 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:00:18 2023 +0300 filtering: imp code more commit c2a5620b04c4a529eea69983f1520cd2bc82ea9b Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 19:13:26 2023 +0300 all: add todo commit e5dcc2e9701f8bccfde6ef8c01a4a2e7eb31599e Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 14:36:08 2023 +0300 all: imp code more commit b6e734ccbeda82669023f6578481260b7c1f7161 Author: Stanislav Chzhen <[email protected]> Date: Tue Apr 25 15:01:56 2023 +0300 filtering: imp code commit 530648dadf836c1a4bd9917e0d3b47256fa8ff52 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 20:06:36 2023 +0300 all: imp code commit 49fa6e587052a40bb431fea457701ee860493527 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 14:57:19 2023 +0300 all: rm safe browsing ctx commit bbcb66cb03e18fa875e3c33cf16295892739e507 Author: Stanislav Chzhen <[email protected]> Date: Fri Apr 21 17:54:18 2023 +0300 filtering: add cache item commit cb7c9fffe8c4ff5e7a21ca912c223c799f61385f Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 18:43:02 2023 +0300 filtering: fix hashes commit 153fec46270212af03f3631bfb42c5d680c4e142 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 16:15:15 2023 +0300 filtering: add test cases commit 09372f92bbb1fc082f1b1283594ee589100209c5 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 15:38:05 2023 +0300 filtering: imp code commit 466bc26d524ea6d1c3efb33692a7785d39e491ca Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 18:38:40 2023 +0300 filtering: add tests commit 24365ecf8c60512fdac65833ee603c80864ae018 Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 11:38:57 2023 +0300 filtering: add hashprefix
https://github.com/AdguardTeam/AdGuardHome/commit/381f2f651d1a94d29bf534185e531b05a755f16c
internal/filtering/safebrowsing.go
"github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/AdguardTeam/golibs/cache" "github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/golibs/stringutil" "github.com/miekg/dns" "golang.org/x/exp/slices" "golang.org/x/net/publicsuffix" ) // Safe browsing and parental control methods. // TODO(a.garipov): Make configurable.
</s> remove "github.com/AdguardTeam/dnsproxy/upstream" "github.com/AdguardTeam/golibs/cache" </s> add </s> remove "github.com/AdguardTeam/dnsproxy/upstream" "github.com/AdguardTeam/golibs/cache" </s> add </s> remove "time" </s> add </s> remove "github.com/AdguardTeam/golibs/cache" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering/hashprefix"
"github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/AdguardTeam/golibs/cache" "github.com/AdguardTeam/golibs/log" ) // Safe browsing and parental control methods. // TODO(a.garipov): Make configurable.
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1837: AG-21462-imp-safebrowsing-parental Merge in DNS/adguard-home from AG-21462-imp-safebrowsing-parental to master Squashed commit of the following: commit 85016d4f1105e21a407efade0bd45b8362808061 Merge: 0e61edade 620b51e3e Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 16:36:30 2023 +0300 Merge branch 'master' into AG-21462-imp-safebrowsing-parental commit 0e61edadeff34f6305e941c1db94575c82f238d9 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 14:51:37 2023 +0300 filtering: imp tests commit 994255514cc0f67dfe33d5a0892432e8924d1e36 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:13:19 2023 +0300 filtering: fix typo commit 96d1069573171538333330d6af94ef0f4208a9c4 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:00:18 2023 +0300 filtering: imp code more commit c2a5620b04c4a529eea69983f1520cd2bc82ea9b Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 19:13:26 2023 +0300 all: add todo commit e5dcc2e9701f8bccfde6ef8c01a4a2e7eb31599e Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 14:36:08 2023 +0300 all: imp code more commit b6e734ccbeda82669023f6578481260b7c1f7161 Author: Stanislav Chzhen <[email protected]> Date: Tue Apr 25 15:01:56 2023 +0300 filtering: imp code commit 530648dadf836c1a4bd9917e0d3b47256fa8ff52 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 20:06:36 2023 +0300 all: imp code commit 49fa6e587052a40bb431fea457701ee860493527 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 14:57:19 2023 +0300 all: rm safe browsing ctx commit bbcb66cb03e18fa875e3c33cf16295892739e507 Author: Stanislav Chzhen <[email protected]> Date: Fri Apr 21 17:54:18 2023 +0300 filtering: add cache item commit cb7c9fffe8c4ff5e7a21ca912c223c799f61385f Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 18:43:02 2023 +0300 filtering: fix hashes commit 153fec46270212af03f3631bfb42c5d680c4e142 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 16:15:15 2023 +0300 filtering: add test cases commit 09372f92bbb1fc082f1b1283594ee589100209c5 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 15:38:05 2023 +0300 filtering: imp code commit 466bc26d524ea6d1c3efb33692a7785d39e491ca Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 18:38:40 2023 +0300 filtering: add tests commit 24365ecf8c60512fdac65833ee603c80864ae018 Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 11:38:57 2023 +0300 filtering: add hashprefix
https://github.com/AdguardTeam/AdGuardHome/commit/381f2f651d1a94d29bf534185e531b05a755f16c
internal/filtering/safebrowsing.go
) // Safe browsing and parental control methods. // TODO(a.garipov): Make configurable. const ( dnsTimeout = 3 * time.Second defaultSafebrowsingServer = `https://family.adguard-dns.com/dns-query` defaultParentalServer = `https://family.adguard-dns.com/dns-query` sbTXTSuffix = `sb.dns.adguard.com.` pcTXTSuffix = `pc.dns.adguard.com.` ) // SetParentalUpstream sets the parental upstream for *DNSFilter. // // TODO(e.burkov): Remove this in v1 API to forbid the direct access. func (d *DNSFilter) SetParentalUpstream(u upstream.Upstream) { d.parentalUpstream = u } // SetSafeBrowsingUpstream sets the safe browsing upstream for *DNSFilter. // // TODO(e.burkov): Remove this in v1 API to forbid the direct access. func (d *DNSFilter) SetSafeBrowsingUpstream(u upstream.Upstream) { d.safeBrowsingUpstream = u } func (d *DNSFilter) initSecurityServices() error { var err error d.safeBrowsingServer = defaultSafebrowsingServer d.parentalServer = defaultParentalServer opts := &upstream.Options{ Timeout: dnsTimeout, ServerIPAddrs: []net.IP{ {94, 140, 14, 15}, {94, 140, 15, 16}, net.ParseIP("2a10:50c0::bad1:ff"), net.ParseIP("2a10:50c0::bad2:ff"), }, } parUps, err := upstream.AddressToUpstream(d.parentalServer, opts) if err != nil { return fmt.Errorf("converting parental server: %w", err) } d.SetParentalUpstream(parUps) sbUps, err := upstream.AddressToUpstream(d.safeBrowsingServer, opts) if err != nil { return fmt.Errorf("converting safe browsing server: %w", err) } d.SetSafeBrowsingUpstream(sbUps) return nil } /* expire byte[4] hash byte[32] ... */ func (c *sbCtx) setCache(prefix, hashes []byte) { d := make([]byte, 4+len(hashes)) expire := uint(time.Now().Unix()) + c.cacheTime*60 binary.BigEndian.PutUint32(d[:4], uint32(expire)) copy(d[4:], hashes) c.cache.Set(prefix, d) log.Debug("%s: stored in cache: %v", c.svc, prefix) } // findInHash returns 32-byte hash if it's found in hashToHost. func (c *sbCtx) findInHash(val []byte) (hash32 [32]byte, found bool) { for i := 4; i < len(val); i += 32 { hash := val[i : i+32] copy(hash32[:], hash[0:32]) _, found = c.hashToHost[hash32] if found { return hash32, found } } return [32]byte{}, false } func (c *sbCtx) getCached() int { now := time.Now().Unix() hashesToRequest := map[[32]byte]string{} for k, v := range c.hashToHost { // nolint:looppointer // The subsilce is used for a safe cache lookup. val := c.cache.Get(k[0:2]) if val == nil || now >= int64(binary.BigEndian.Uint32(val)) { hashesToRequest[k] = v continue } if hash32, found := c.findInHash(val); found { log.Debug("%s: found in cache: %s: blocked by %v", c.svc, c.host, hash32) return 1 } } if len(hashesToRequest) == 0 { log.Debug("%s: found in cache: %s: not blocked", c.svc, c.host) return -1 } c.hashToHost = hashesToRequest return 0 } type sbCtx struct { host string svc string hashToHost map[[32]byte]string cache cache.Cache cacheTime uint } func hostnameToHashes(host string) map[[32]byte]string { hashes := map[[32]byte]string{} tld, icann := publicsuffix.PublicSuffix(host) if !icann { // private suffixes like cloudfront.net tld = "" } curhost := host nDots := 0 for i := len(curhost) - 1; i >= 0; i-- { if curhost[i] == '.' { nDots++ if nDots == 4 { curhost = curhost[i+1:] // "xxx.a.b.c.d" -> "a.b.c.d" break } } } for { if curhost == "" { // we've reached end of string break } if tld != "" && curhost == tld { // we've reached the TLD, don't hash it break } sum := sha256.Sum256([]byte(curhost)) hashes[sum] = curhost pos := strings.IndexByte(curhost, byte('.')) if pos < 0 { break } curhost = curhost[pos+1:] } return hashes } // convert hash array to string func (c *sbCtx) getQuestion() string { b := &strings.Builder{} for hash := range c.hashToHost { // nolint:looppointer // The subsilce is used for safe hex encoding. stringutil.WriteToBuilder(b, hex.EncodeToString(hash[0:2]), ".") } if c.svc == "SafeBrowsing" { stringutil.WriteToBuilder(b, sbTXTSuffix) return b.String() } stringutil.WriteToBuilder(b, pcTXTSuffix) return b.String() } // Find the target hash in TXT response func (c *sbCtx) processTXT(resp *dns.Msg) (bool, [][]byte) { matched := false hashes := [][]byte{} for _, a := range resp.Answer { txt, ok := a.(*dns.TXT) if !ok { continue } log.Debug("%s: received hashes for %s: %v", c.svc, c.host, txt.Txt) for _, t := range txt.Txt { if len(t) != 32*2 { continue } hash, err := hex.DecodeString(t) if err != nil { continue } hashes = append(hashes, hash) if !matched { var hash32 [32]byte copy(hash32[:], hash) var hashHost string hashHost, ok = c.hashToHost[hash32] if ok { log.Debug("%s: matched %s by %s/%s", c.svc, c.host, hashHost, t) matched = true } } } } return matched, hashes } func (c *sbCtx) storeCache(hashes [][]byte) { slices.SortFunc(hashes, func(a, b []byte) (sortsBefore bool) { return bytes.Compare(a, b) == -1 }) var curData []byte var prevPrefix []byte for i, hash := range hashes { // nolint:looppointer // The subsilce is used for a safe comparison. if !bytes.Equal(hash[0:2], prevPrefix) { if i != 0 { c.setCache(prevPrefix, curData) curData = nil } prevPrefix = hashes[i][0:2] } curData = append(curData, hash...) } if len(prevPrefix) != 0 { c.setCache(prevPrefix, curData) } for hash := range c.hashToHost { // nolint:looppointer // The subsilce is used for a safe cache lookup. prefix := hash[0:2] val := c.cache.Get(prefix) if val == nil { c.setCache(prefix, nil) } } } func check(c *sbCtx, r Result, u upstream.Upstream) (Result, error) { c.hashToHost = hostnameToHashes(c.host) switch c.getCached() { case -1: return Result{}, nil case 1: return r, nil } question := c.getQuestion() log.Tracef("%s: checking %s: %s", c.svc, c.host, question) req := (&dns.Msg{}).SetQuestion(question, dns.TypeTXT) resp, err := u.Exchange(req) if err != nil { return Result{}, err } matched, receivedHashes := c.processTXT(resp) c.storeCache(receivedHashes) if matched { return r, nil } return Result{}, nil } // TODO(a.garipov): Unify with checkParental. func (d *DNSFilter) checkSafeBrowsing( host string, _ uint16, setts *Settings,
</s> remove return check(sctx, res, d.safeBrowsingUpstream) </s> add block, err := d.safeBrowsingChecker.Check(host) if !block || err != nil { return Result{}, err } return res, nil </s> remove return check(sctx, res, d.parentalUpstream) </s> add block, err := d.parentalControlChecker.Check(host) if !block || err != nil { return Result{}, err } return res, nil </s> remove func purgeCaches(d *DNSFilter) { for _, c := range []cache.Cache{ d.safebrowsingCache, d.parentalCache, } { if c != nil { c.Clear() } } } </s> add </s> remove err = d.initSecurityServices() if err != nil { return nil, fmt.Errorf("initializing services: %s", err) } </s> add
) // Safe browsing and parental control methods. // TODO(a.garipov): Unify with checkParental. func (d *DNSFilter) checkSafeBrowsing( host string, _ uint16, setts *Settings,
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1837: AG-21462-imp-safebrowsing-parental Merge in DNS/adguard-home from AG-21462-imp-safebrowsing-parental to master Squashed commit of the following: commit 85016d4f1105e21a407efade0bd45b8362808061 Merge: 0e61edade 620b51e3e Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 16:36:30 2023 +0300 Merge branch 'master' into AG-21462-imp-safebrowsing-parental commit 0e61edadeff34f6305e941c1db94575c82f238d9 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 14:51:37 2023 +0300 filtering: imp tests commit 994255514cc0f67dfe33d5a0892432e8924d1e36 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:13:19 2023 +0300 filtering: fix typo commit 96d1069573171538333330d6af94ef0f4208a9c4 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:00:18 2023 +0300 filtering: imp code more commit c2a5620b04c4a529eea69983f1520cd2bc82ea9b Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 19:13:26 2023 +0300 all: add todo commit e5dcc2e9701f8bccfde6ef8c01a4a2e7eb31599e Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 14:36:08 2023 +0300 all: imp code more commit b6e734ccbeda82669023f6578481260b7c1f7161 Author: Stanislav Chzhen <[email protected]> Date: Tue Apr 25 15:01:56 2023 +0300 filtering: imp code commit 530648dadf836c1a4bd9917e0d3b47256fa8ff52 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 20:06:36 2023 +0300 all: imp code commit 49fa6e587052a40bb431fea457701ee860493527 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 14:57:19 2023 +0300 all: rm safe browsing ctx commit bbcb66cb03e18fa875e3c33cf16295892739e507 Author: Stanislav Chzhen <[email protected]> Date: Fri Apr 21 17:54:18 2023 +0300 filtering: add cache item commit cb7c9fffe8c4ff5e7a21ca912c223c799f61385f Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 18:43:02 2023 +0300 filtering: fix hashes commit 153fec46270212af03f3631bfb42c5d680c4e142 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 16:15:15 2023 +0300 filtering: add test cases commit 09372f92bbb1fc082f1b1283594ee589100209c5 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 15:38:05 2023 +0300 filtering: imp code commit 466bc26d524ea6d1c3efb33692a7785d39e491ca Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 18:38:40 2023 +0300 filtering: add tests commit 24365ecf8c60512fdac65833ee603c80864ae018 Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 11:38:57 2023 +0300 filtering: add hashprefix
https://github.com/AdguardTeam/AdGuardHome/commit/381f2f651d1a94d29bf534185e531b05a755f16c
internal/filtering/safebrowsing.go
timer := log.StartTimer() defer timer.LogElapsed("safebrowsing lookup for %q", host) } sctx := &sbCtx{ host: host, svc: "SafeBrowsing", cache: d.safebrowsingCache, cacheTime: d.Config.CacheTime, } res = Result{ Rules: []*ResultRule{{ Text: "adguard-malware-shavar", FilterListID: SafeBrowsingListID, }},
</s> remove sctx := &sbCtx{ host: host, svc: "Parental", cache: d.parentalCache, cacheTime: d.Config.CacheTime, } </s> add </s> remove func purgeCaches(d *DNSFilter) { for _, c := range []cache.Cache{ d.safebrowsingCache, d.parentalCache, } { if c != nil { c.Clear() } } } </s> add </s> remove d.SetSafeBrowsingUpstream(aghtest.NewBlockUpstream(sbBlocked, true)) </s> add </s> remove d, setts := newForTest(t, &Config{ParentalEnabled: true}, nil) </s> add d, setts := newForTest(t, &Config{ ParentalEnabled: true, ParentalControlChecker: newChecker(pcBlocked), }, nil) </s> remove d.SetParentalUpstream(aghtest.NewBlockUpstream(pcBlocked, true)) </s> add
timer := log.StartTimer() defer timer.LogElapsed("safebrowsing lookup for %q", host) } res = Result{ Rules: []*ResultRule{{ Text: "adguard-malware-shavar", FilterListID: SafeBrowsingListID, }},
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1837: AG-21462-imp-safebrowsing-parental Merge in DNS/adguard-home from AG-21462-imp-safebrowsing-parental to master Squashed commit of the following: commit 85016d4f1105e21a407efade0bd45b8362808061 Merge: 0e61edade 620b51e3e Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 16:36:30 2023 +0300 Merge branch 'master' into AG-21462-imp-safebrowsing-parental commit 0e61edadeff34f6305e941c1db94575c82f238d9 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 14:51:37 2023 +0300 filtering: imp tests commit 994255514cc0f67dfe33d5a0892432e8924d1e36 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:13:19 2023 +0300 filtering: fix typo commit 96d1069573171538333330d6af94ef0f4208a9c4 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:00:18 2023 +0300 filtering: imp code more commit c2a5620b04c4a529eea69983f1520cd2bc82ea9b Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 19:13:26 2023 +0300 all: add todo commit e5dcc2e9701f8bccfde6ef8c01a4a2e7eb31599e Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 14:36:08 2023 +0300 all: imp code more commit b6e734ccbeda82669023f6578481260b7c1f7161 Author: Stanislav Chzhen <[email protected]> Date: Tue Apr 25 15:01:56 2023 +0300 filtering: imp code commit 530648dadf836c1a4bd9917e0d3b47256fa8ff52 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 20:06:36 2023 +0300 all: imp code commit 49fa6e587052a40bb431fea457701ee860493527 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 14:57:19 2023 +0300 all: rm safe browsing ctx commit bbcb66cb03e18fa875e3c33cf16295892739e507 Author: Stanislav Chzhen <[email protected]> Date: Fri Apr 21 17:54:18 2023 +0300 filtering: add cache item commit cb7c9fffe8c4ff5e7a21ca912c223c799f61385f Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 18:43:02 2023 +0300 filtering: fix hashes commit 153fec46270212af03f3631bfb42c5d680c4e142 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 16:15:15 2023 +0300 filtering: add test cases commit 09372f92bbb1fc082f1b1283594ee589100209c5 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 15:38:05 2023 +0300 filtering: imp code commit 466bc26d524ea6d1c3efb33692a7785d39e491ca Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 18:38:40 2023 +0300 filtering: add tests commit 24365ecf8c60512fdac65833ee603c80864ae018 Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 11:38:57 2023 +0300 filtering: add hashprefix
https://github.com/AdguardTeam/AdGuardHome/commit/381f2f651d1a94d29bf534185e531b05a755f16c
internal/filtering/safebrowsing.go
Reason: FilteredSafeBrowsing, IsFiltered: true, } return check(sctx, res, d.safeBrowsingUpstream) } // TODO(a.garipov): Unify with checkSafeBrowsing. func (d *DNSFilter) checkParental( host string,
</s> remove return check(sctx, res, d.parentalUpstream) </s> add block, err := d.parentalControlChecker.Check(host) if !block || err != nil { return Result{}, err } return res, nil </s> remove purgeCaches(f) </s> add </s> remove // TODO(a.garipov): Make configurable. const ( dnsTimeout = 3 * time.Second defaultSafebrowsingServer = `https://family.adguard-dns.com/dns-query` defaultParentalServer = `https://family.adguard-dns.com/dns-query` sbTXTSuffix = `sb.dns.adguard.com.` pcTXTSuffix = `pc.dns.adguard.com.` ) // SetParentalUpstream sets the parental upstream for *DNSFilter. // // TODO(e.burkov): Remove this in v1 API to forbid the direct access. func (d *DNSFilter) SetParentalUpstream(u upstream.Upstream) { d.parentalUpstream = u } // SetSafeBrowsingUpstream sets the safe browsing upstream for *DNSFilter. // // TODO(e.burkov): Remove this in v1 API to forbid the direct access. func (d *DNSFilter) SetSafeBrowsingUpstream(u upstream.Upstream) { d.safeBrowsingUpstream = u } func (d *DNSFilter) initSecurityServices() error { var err error d.safeBrowsingServer = defaultSafebrowsingServer d.parentalServer = defaultParentalServer opts := &upstream.Options{ Timeout: dnsTimeout, ServerIPAddrs: []net.IP{ {94, 140, 14, 15}, {94, 140, 15, 16}, net.ParseIP("2a10:50c0::bad1:ff"), net.ParseIP("2a10:50c0::bad2:ff"), }, } parUps, err := upstream.AddressToUpstream(d.parentalServer, opts) if err != nil { return fmt.Errorf("converting parental server: %w", err) } d.SetParentalUpstream(parUps) sbUps, err := upstream.AddressToUpstream(d.safeBrowsingServer, opts) if err != nil { return fmt.Errorf("converting safe browsing server: %w", err) } d.SetSafeBrowsingUpstream(sbUps) return nil } /* expire byte[4] hash byte[32] ... */ func (c *sbCtx) setCache(prefix, hashes []byte) { d := make([]byte, 4+len(hashes)) expire := uint(time.Now().Unix()) + c.cacheTime*60 binary.BigEndian.PutUint32(d[:4], uint32(expire)) copy(d[4:], hashes) c.cache.Set(prefix, d) log.Debug("%s: stored in cache: %v", c.svc, prefix) } // findInHash returns 32-byte hash if it's found in hashToHost. func (c *sbCtx) findInHash(val []byte) (hash32 [32]byte, found bool) { for i := 4; i < len(val); i += 32 { hash := val[i : i+32] copy(hash32[:], hash[0:32]) _, found = c.hashToHost[hash32] if found { return hash32, found } } return [32]byte{}, false } func (c *sbCtx) getCached() int { now := time.Now().Unix() hashesToRequest := map[[32]byte]string{} for k, v := range c.hashToHost { // nolint:looppointer // The subsilce is used for a safe cache lookup. val := c.cache.Get(k[0:2]) if val == nil || now >= int64(binary.BigEndian.Uint32(val)) { hashesToRequest[k] = v continue } if hash32, found := c.findInHash(val); found { log.Debug("%s: found in cache: %s: blocked by %v", c.svc, c.host, hash32) return 1 } } if len(hashesToRequest) == 0 { log.Debug("%s: found in cache: %s: not blocked", c.svc, c.host) return -1 } c.hashToHost = hashesToRequest return 0 } type sbCtx struct { host string svc string hashToHost map[[32]byte]string cache cache.Cache cacheTime uint } func hostnameToHashes(host string) map[[32]byte]string { hashes := map[[32]byte]string{} tld, icann := publicsuffix.PublicSuffix(host) if !icann { // private suffixes like cloudfront.net tld = "" } curhost := host nDots := 0 for i := len(curhost) - 1; i >= 0; i-- { if curhost[i] == '.' { nDots++ if nDots == 4 { curhost = curhost[i+1:] // "xxx.a.b.c.d" -> "a.b.c.d" break } } } for { if curhost == "" { // we've reached end of string break } if tld != "" && curhost == tld { // we've reached the TLD, don't hash it break } sum := sha256.Sum256([]byte(curhost)) hashes[sum] = curhost pos := strings.IndexByte(curhost, byte('.')) if pos < 0 { break } curhost = curhost[pos+1:] } return hashes } // convert hash array to string func (c *sbCtx) getQuestion() string { b := &strings.Builder{} for hash := range c.hashToHost { // nolint:looppointer // The subsilce is used for safe hex encoding. stringutil.WriteToBuilder(b, hex.EncodeToString(hash[0:2]), ".") } if c.svc == "SafeBrowsing" { stringutil.WriteToBuilder(b, sbTXTSuffix) return b.String() } stringutil.WriteToBuilder(b, pcTXTSuffix) return b.String() } // Find the target hash in TXT response func (c *sbCtx) processTXT(resp *dns.Msg) (bool, [][]byte) { matched := false hashes := [][]byte{} for _, a := range resp.Answer { txt, ok := a.(*dns.TXT) if !ok { continue } log.Debug("%s: received hashes for %s: %v", c.svc, c.host, txt.Txt) for _, t := range txt.Txt { if len(t) != 32*2 { continue } hash, err := hex.DecodeString(t) if err != nil { continue } hashes = append(hashes, hash) if !matched { var hash32 [32]byte copy(hash32[:], hash) var hashHost string hashHost, ok = c.hashToHost[hash32] if ok { log.Debug("%s: matched %s by %s/%s", c.svc, c.host, hashHost, t) matched = true } } } } return matched, hashes } func (c *sbCtx) storeCache(hashes [][]byte) { slices.SortFunc(hashes, func(a, b []byte) (sortsBefore bool) { return bytes.Compare(a, b) == -1 }) var curData []byte var prevPrefix []byte for i, hash := range hashes { // nolint:looppointer // The subsilce is used for a safe comparison. if !bytes.Equal(hash[0:2], prevPrefix) { if i != 0 { c.setCache(prevPrefix, curData) curData = nil } prevPrefix = hashes[i][0:2] } curData = append(curData, hash...) } if len(prevPrefix) != 0 { c.setCache(prevPrefix, curData) } for hash := range c.hashToHost { // nolint:looppointer // The subsilce is used for a safe cache lookup. prefix := hash[0:2] val := c.cache.Get(prefix) if val == nil { c.setCache(prefix, nil) } } } func check(c *sbCtx, r Result, u upstream.Upstream) (Result, error) { c.hashToHost = hostnameToHashes(c.host) switch c.getCached() { case -1: return Result{}, nil case 1: return r, nil } question := c.getQuestion() log.Tracef("%s: checking %s: %s", c.svc, c.host, question) req := (&dns.Msg{}).SetQuestion(question, dns.TypeTXT) resp, err := u.Exchange(req) if err != nil { return Result{}, err } matched, receivedHashes := c.processTXT(resp) c.storeCache(receivedHashes) if matched { return r, nil } return Result{}, nil } </s> add </s> remove func purgeCaches(d *DNSFilter) { for _, c := range []cache.Cache{ d.safebrowsingCache, d.parentalCache, } { if c != nil { c.Clear() } } } </s> add
block, err := d.safeBrowsingChecker.Check(host) if !block || err != nil { return Result{}, err } return res, nil
Reason: FilteredSafeBrowsing, IsFiltered: true, } block, err := d.safeBrowsingChecker.Check(host) if !block || err != nil { return Result{}, err } return res, nil } // TODO(a.garipov): Unify with checkSafeBrowsing. func (d *DNSFilter) checkParental( host string,
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1837: AG-21462-imp-safebrowsing-parental Merge in DNS/adguard-home from AG-21462-imp-safebrowsing-parental to master Squashed commit of the following: commit 85016d4f1105e21a407efade0bd45b8362808061 Merge: 0e61edade 620b51e3e Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 16:36:30 2023 +0300 Merge branch 'master' into AG-21462-imp-safebrowsing-parental commit 0e61edadeff34f6305e941c1db94575c82f238d9 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 14:51:37 2023 +0300 filtering: imp tests commit 994255514cc0f67dfe33d5a0892432e8924d1e36 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:13:19 2023 +0300 filtering: fix typo commit 96d1069573171538333330d6af94ef0f4208a9c4 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:00:18 2023 +0300 filtering: imp code more commit c2a5620b04c4a529eea69983f1520cd2bc82ea9b Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 19:13:26 2023 +0300 all: add todo commit e5dcc2e9701f8bccfde6ef8c01a4a2e7eb31599e Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 14:36:08 2023 +0300 all: imp code more commit b6e734ccbeda82669023f6578481260b7c1f7161 Author: Stanislav Chzhen <[email protected]> Date: Tue Apr 25 15:01:56 2023 +0300 filtering: imp code commit 530648dadf836c1a4bd9917e0d3b47256fa8ff52 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 20:06:36 2023 +0300 all: imp code commit 49fa6e587052a40bb431fea457701ee860493527 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 14:57:19 2023 +0300 all: rm safe browsing ctx commit bbcb66cb03e18fa875e3c33cf16295892739e507 Author: Stanislav Chzhen <[email protected]> Date: Fri Apr 21 17:54:18 2023 +0300 filtering: add cache item commit cb7c9fffe8c4ff5e7a21ca912c223c799f61385f Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 18:43:02 2023 +0300 filtering: fix hashes commit 153fec46270212af03f3631bfb42c5d680c4e142 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 16:15:15 2023 +0300 filtering: add test cases commit 09372f92bbb1fc082f1b1283594ee589100209c5 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 15:38:05 2023 +0300 filtering: imp code commit 466bc26d524ea6d1c3efb33692a7785d39e491ca Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 18:38:40 2023 +0300 filtering: add tests commit 24365ecf8c60512fdac65833ee603c80864ae018 Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 11:38:57 2023 +0300 filtering: add hashprefix
https://github.com/AdguardTeam/AdGuardHome/commit/381f2f651d1a94d29bf534185e531b05a755f16c
internal/filtering/safebrowsing.go
timer := log.StartTimer() defer timer.LogElapsed("parental lookup for %q", host) } sctx := &sbCtx{ host: host, svc: "Parental", cache: d.parentalCache, cacheTime: d.Config.CacheTime, } res = Result{ Rules: []*ResultRule{{ Text: "parental CATEGORY_BLACKLISTED", FilterListID: ParentalListID, }},
</s> remove sctx := &sbCtx{ host: host, svc: "SafeBrowsing", cache: d.safebrowsingCache, cacheTime: d.Config.CacheTime, } </s> add </s> remove func purgeCaches(d *DNSFilter) { for _, c := range []cache.Cache{ d.safebrowsingCache, d.parentalCache, } { if c != nil { c.Clear() } } } </s> add </s> remove d.SetSafeBrowsingUpstream(aghtest.NewBlockUpstream(sbBlocked, true)) </s> add </s> remove d, setts := newForTest(t, &Config{ParentalEnabled: true}, nil) </s> add d, setts := newForTest(t, &Config{ ParentalEnabled: true, ParentalControlChecker: newChecker(pcBlocked), }, nil) </s> remove d.SetParentalUpstream(aghtest.NewBlockUpstream(pcBlocked, true)) </s> add
timer := log.StartTimer() defer timer.LogElapsed("parental lookup for %q", host) } res = Result{ Rules: []*ResultRule{{ Text: "parental CATEGORY_BLACKLISTED", FilterListID: ParentalListID, }},
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1837: AG-21462-imp-safebrowsing-parental Merge in DNS/adguard-home from AG-21462-imp-safebrowsing-parental to master Squashed commit of the following: commit 85016d4f1105e21a407efade0bd45b8362808061 Merge: 0e61edade 620b51e3e Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 16:36:30 2023 +0300 Merge branch 'master' into AG-21462-imp-safebrowsing-parental commit 0e61edadeff34f6305e941c1db94575c82f238d9 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 14:51:37 2023 +0300 filtering: imp tests commit 994255514cc0f67dfe33d5a0892432e8924d1e36 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:13:19 2023 +0300 filtering: fix typo commit 96d1069573171538333330d6af94ef0f4208a9c4 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:00:18 2023 +0300 filtering: imp code more commit c2a5620b04c4a529eea69983f1520cd2bc82ea9b Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 19:13:26 2023 +0300 all: add todo commit e5dcc2e9701f8bccfde6ef8c01a4a2e7eb31599e Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 14:36:08 2023 +0300 all: imp code more commit b6e734ccbeda82669023f6578481260b7c1f7161 Author: Stanislav Chzhen <[email protected]> Date: Tue Apr 25 15:01:56 2023 +0300 filtering: imp code commit 530648dadf836c1a4bd9917e0d3b47256fa8ff52 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 20:06:36 2023 +0300 all: imp code commit 49fa6e587052a40bb431fea457701ee860493527 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 14:57:19 2023 +0300 all: rm safe browsing ctx commit bbcb66cb03e18fa875e3c33cf16295892739e507 Author: Stanislav Chzhen <[email protected]> Date: Fri Apr 21 17:54:18 2023 +0300 filtering: add cache item commit cb7c9fffe8c4ff5e7a21ca912c223c799f61385f Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 18:43:02 2023 +0300 filtering: fix hashes commit 153fec46270212af03f3631bfb42c5d680c4e142 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 16:15:15 2023 +0300 filtering: add test cases commit 09372f92bbb1fc082f1b1283594ee589100209c5 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 15:38:05 2023 +0300 filtering: imp code commit 466bc26d524ea6d1c3efb33692a7785d39e491ca Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 18:38:40 2023 +0300 filtering: add tests commit 24365ecf8c60512fdac65833ee603c80864ae018 Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 11:38:57 2023 +0300 filtering: add hashprefix
https://github.com/AdguardTeam/AdGuardHome/commit/381f2f651d1a94d29bf534185e531b05a755f16c
internal/filtering/safebrowsing.go
Reason: FilteredParental, IsFiltered: true, } return check(sctx, res, d.parentalUpstream) } // setProtectedBool sets the value of a boolean pointer under a lock. l must // protect the value under ptr. //
</s> remove return check(sctx, res, d.safeBrowsingUpstream) </s> add block, err := d.safeBrowsingChecker.Check(host) if !block || err != nil { return Result{}, err } return res, nil </s> remove safeSearch SafeSearch </s> add </s> remove // TODO(a.garipov): Make configurable. const ( dnsTimeout = 3 * time.Second defaultSafebrowsingServer = `https://family.adguard-dns.com/dns-query` defaultParentalServer = `https://family.adguard-dns.com/dns-query` sbTXTSuffix = `sb.dns.adguard.com.` pcTXTSuffix = `pc.dns.adguard.com.` ) // SetParentalUpstream sets the parental upstream for *DNSFilter. // // TODO(e.burkov): Remove this in v1 API to forbid the direct access. func (d *DNSFilter) SetParentalUpstream(u upstream.Upstream) { d.parentalUpstream = u } // SetSafeBrowsingUpstream sets the safe browsing upstream for *DNSFilter. // // TODO(e.burkov): Remove this in v1 API to forbid the direct access. func (d *DNSFilter) SetSafeBrowsingUpstream(u upstream.Upstream) { d.safeBrowsingUpstream = u } func (d *DNSFilter) initSecurityServices() error { var err error d.safeBrowsingServer = defaultSafebrowsingServer d.parentalServer = defaultParentalServer opts := &upstream.Options{ Timeout: dnsTimeout, ServerIPAddrs: []net.IP{ {94, 140, 14, 15}, {94, 140, 15, 16}, net.ParseIP("2a10:50c0::bad1:ff"), net.ParseIP("2a10:50c0::bad2:ff"), }, } parUps, err := upstream.AddressToUpstream(d.parentalServer, opts) if err != nil { return fmt.Errorf("converting parental server: %w", err) } d.SetParentalUpstream(parUps) sbUps, err := upstream.AddressToUpstream(d.safeBrowsingServer, opts) if err != nil { return fmt.Errorf("converting safe browsing server: %w", err) } d.SetSafeBrowsingUpstream(sbUps) return nil } /* expire byte[4] hash byte[32] ... */ func (c *sbCtx) setCache(prefix, hashes []byte) { d := make([]byte, 4+len(hashes)) expire := uint(time.Now().Unix()) + c.cacheTime*60 binary.BigEndian.PutUint32(d[:4], uint32(expire)) copy(d[4:], hashes) c.cache.Set(prefix, d) log.Debug("%s: stored in cache: %v", c.svc, prefix) } // findInHash returns 32-byte hash if it's found in hashToHost. func (c *sbCtx) findInHash(val []byte) (hash32 [32]byte, found bool) { for i := 4; i < len(val); i += 32 { hash := val[i : i+32] copy(hash32[:], hash[0:32]) _, found = c.hashToHost[hash32] if found { return hash32, found } } return [32]byte{}, false } func (c *sbCtx) getCached() int { now := time.Now().Unix() hashesToRequest := map[[32]byte]string{} for k, v := range c.hashToHost { // nolint:looppointer // The subsilce is used for a safe cache lookup. val := c.cache.Get(k[0:2]) if val == nil || now >= int64(binary.BigEndian.Uint32(val)) { hashesToRequest[k] = v continue } if hash32, found := c.findInHash(val); found { log.Debug("%s: found in cache: %s: blocked by %v", c.svc, c.host, hash32) return 1 } } if len(hashesToRequest) == 0 { log.Debug("%s: found in cache: %s: not blocked", c.svc, c.host) return -1 } c.hashToHost = hashesToRequest return 0 } type sbCtx struct { host string svc string hashToHost map[[32]byte]string cache cache.Cache cacheTime uint } func hostnameToHashes(host string) map[[32]byte]string { hashes := map[[32]byte]string{} tld, icann := publicsuffix.PublicSuffix(host) if !icann { // private suffixes like cloudfront.net tld = "" } curhost := host nDots := 0 for i := len(curhost) - 1; i >= 0; i-- { if curhost[i] == '.' { nDots++ if nDots == 4 { curhost = curhost[i+1:] // "xxx.a.b.c.d" -> "a.b.c.d" break } } } for { if curhost == "" { // we've reached end of string break } if tld != "" && curhost == tld { // we've reached the TLD, don't hash it break } sum := sha256.Sum256([]byte(curhost)) hashes[sum] = curhost pos := strings.IndexByte(curhost, byte('.')) if pos < 0 { break } curhost = curhost[pos+1:] } return hashes } // convert hash array to string func (c *sbCtx) getQuestion() string { b := &strings.Builder{} for hash := range c.hashToHost { // nolint:looppointer // The subsilce is used for safe hex encoding. stringutil.WriteToBuilder(b, hex.EncodeToString(hash[0:2]), ".") } if c.svc == "SafeBrowsing" { stringutil.WriteToBuilder(b, sbTXTSuffix) return b.String() } stringutil.WriteToBuilder(b, pcTXTSuffix) return b.String() } // Find the target hash in TXT response func (c *sbCtx) processTXT(resp *dns.Msg) (bool, [][]byte) { matched := false hashes := [][]byte{} for _, a := range resp.Answer { txt, ok := a.(*dns.TXT) if !ok { continue } log.Debug("%s: received hashes for %s: %v", c.svc, c.host, txt.Txt) for _, t := range txt.Txt { if len(t) != 32*2 { continue } hash, err := hex.DecodeString(t) if err != nil { continue } hashes = append(hashes, hash) if !matched { var hash32 [32]byte copy(hash32[:], hash) var hashHost string hashHost, ok = c.hashToHost[hash32] if ok { log.Debug("%s: matched %s by %s/%s", c.svc, c.host, hashHost, t) matched = true } } } } return matched, hashes } func (c *sbCtx) storeCache(hashes [][]byte) { slices.SortFunc(hashes, func(a, b []byte) (sortsBefore bool) { return bytes.Compare(a, b) == -1 }) var curData []byte var prevPrefix []byte for i, hash := range hashes { // nolint:looppointer // The subsilce is used for a safe comparison. if !bytes.Equal(hash[0:2], prevPrefix) { if i != 0 { c.setCache(prevPrefix, curData) curData = nil } prevPrefix = hashes[i][0:2] } curData = append(curData, hash...) } if len(prevPrefix) != 0 { c.setCache(prevPrefix, curData) } for hash := range c.hashToHost { // nolint:looppointer // The subsilce is used for a safe cache lookup. prefix := hash[0:2] val := c.cache.Get(prefix) if val == nil { c.setCache(prefix, nil) } } } func check(c *sbCtx, r Result, u upstream.Upstream) (Result, error) { c.hashToHost = hostnameToHashes(c.host) switch c.getCached() { case -1: return Result{}, nil case 1: return r, nil } question := c.getQuestion() log.Tracef("%s: checking %s: %s", c.svc, c.host, question) req := (&dns.Msg{}).SetQuestion(question, dns.TypeTXT) resp, err := u.Exchange(req) if err != nil { return Result{}, err } matched, receivedHashes := c.processTXT(resp) c.storeCache(receivedHashes) if matched { return r, nil } return Result{}, nil } </s> add
block, err := d.parentalControlChecker.Check(host) if !block || err != nil { return Result{}, err } return res, nil
Reason: FilteredParental, IsFiltered: true, } block, err := d.parentalControlChecker.Check(host) if !block || err != nil { return Result{}, err } return res, nil } // setProtectedBool sets the value of a boolean pointer under a lock. l must // protect the value under ptr. //
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1837: AG-21462-imp-safebrowsing-parental Merge in DNS/adguard-home from AG-21462-imp-safebrowsing-parental to master Squashed commit of the following: commit 85016d4f1105e21a407efade0bd45b8362808061 Merge: 0e61edade 620b51e3e Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 16:36:30 2023 +0300 Merge branch 'master' into AG-21462-imp-safebrowsing-parental commit 0e61edadeff34f6305e941c1db94575c82f238d9 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 14:51:37 2023 +0300 filtering: imp tests commit 994255514cc0f67dfe33d5a0892432e8924d1e36 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:13:19 2023 +0300 filtering: fix typo commit 96d1069573171538333330d6af94ef0f4208a9c4 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:00:18 2023 +0300 filtering: imp code more commit c2a5620b04c4a529eea69983f1520cd2bc82ea9b Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 19:13:26 2023 +0300 all: add todo commit e5dcc2e9701f8bccfde6ef8c01a4a2e7eb31599e Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 14:36:08 2023 +0300 all: imp code more commit b6e734ccbeda82669023f6578481260b7c1f7161 Author: Stanislav Chzhen <[email protected]> Date: Tue Apr 25 15:01:56 2023 +0300 filtering: imp code commit 530648dadf836c1a4bd9917e0d3b47256fa8ff52 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 20:06:36 2023 +0300 all: imp code commit 49fa6e587052a40bb431fea457701ee860493527 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 14:57:19 2023 +0300 all: rm safe browsing ctx commit bbcb66cb03e18fa875e3c33cf16295892739e507 Author: Stanislav Chzhen <[email protected]> Date: Fri Apr 21 17:54:18 2023 +0300 filtering: add cache item commit cb7c9fffe8c4ff5e7a21ca912c223c799f61385f Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 18:43:02 2023 +0300 filtering: fix hashes commit 153fec46270212af03f3631bfb42c5d680c4e142 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 16:15:15 2023 +0300 filtering: add test cases commit 09372f92bbb1fc082f1b1283594ee589100209c5 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 15:38:05 2023 +0300 filtering: imp code commit 466bc26d524ea6d1c3efb33692a7785d39e491ca Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 18:38:40 2023 +0300 filtering: add tests commit 24365ecf8c60512fdac65833ee603c80864ae018 Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 11:38:57 2023 +0300 filtering: add hashprefix
https://github.com/AdguardTeam/AdGuardHome/commit/381f2f651d1a94d29bf534185e531b05a755f16c
internal/filtering/safebrowsing.go
"github.com/AdguardTeam/AdGuardHome/internal/dnsforward" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/AdGuardHome/internal/filtering/safesearch" "github.com/AdguardTeam/AdGuardHome/internal/querylog" "github.com/AdguardTeam/AdGuardHome/internal/stats" "github.com/AdguardTeam/AdGuardHome/internal/updater" "github.com/AdguardTeam/AdGuardHome/internal/version"
</s> remove sctx := &sbCtx{ host: host, svc: "Parental", cache: d.parentalCache, cacheTime: d.Config.CacheTime, } </s> add </s> remove safeSearch SafeSearch </s> add </s> remove d, setts := newForTest(t, &Config{SafeBrowsingEnabled: true}, nil) </s> add sbChecker := newChecker(sbBlocked) d, setts := newForTest(t, &Config{ SafeBrowsingEnabled: true, SafeBrowsingChecker: sbChecker, }, nil)
"github.com/AdguardTeam/AdGuardHome/internal/filtering/hashprefix"
"github.com/AdguardTeam/AdGuardHome/internal/dnsforward" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/AdGuardHome/internal/filtering/hashprefix" "github.com/AdguardTeam/AdGuardHome/internal/filtering/safesearch" "github.com/AdguardTeam/AdGuardHome/internal/querylog" "github.com/AdguardTeam/AdGuardHome/internal/stats" "github.com/AdguardTeam/AdGuardHome/internal/updater" "github.com/AdguardTeam/AdGuardHome/internal/version"
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1837: AG-21462-imp-safebrowsing-parental Merge in DNS/adguard-home from AG-21462-imp-safebrowsing-parental to master Squashed commit of the following: commit 85016d4f1105e21a407efade0bd45b8362808061 Merge: 0e61edade 620b51e3e Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 16:36:30 2023 +0300 Merge branch 'master' into AG-21462-imp-safebrowsing-parental commit 0e61edadeff34f6305e941c1db94575c82f238d9 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 14:51:37 2023 +0300 filtering: imp tests commit 994255514cc0f67dfe33d5a0892432e8924d1e36 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:13:19 2023 +0300 filtering: fix typo commit 96d1069573171538333330d6af94ef0f4208a9c4 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:00:18 2023 +0300 filtering: imp code more commit c2a5620b04c4a529eea69983f1520cd2bc82ea9b Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 19:13:26 2023 +0300 all: add todo commit e5dcc2e9701f8bccfde6ef8c01a4a2e7eb31599e Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 14:36:08 2023 +0300 all: imp code more commit b6e734ccbeda82669023f6578481260b7c1f7161 Author: Stanislav Chzhen <[email protected]> Date: Tue Apr 25 15:01:56 2023 +0300 filtering: imp code commit 530648dadf836c1a4bd9917e0d3b47256fa8ff52 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 20:06:36 2023 +0300 all: imp code commit 49fa6e587052a40bb431fea457701ee860493527 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 14:57:19 2023 +0300 all: rm safe browsing ctx commit bbcb66cb03e18fa875e3c33cf16295892739e507 Author: Stanislav Chzhen <[email protected]> Date: Fri Apr 21 17:54:18 2023 +0300 filtering: add cache item commit cb7c9fffe8c4ff5e7a21ca912c223c799f61385f Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 18:43:02 2023 +0300 filtering: fix hashes commit 153fec46270212af03f3631bfb42c5d680c4e142 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 16:15:15 2023 +0300 filtering: add test cases commit 09372f92bbb1fc082f1b1283594ee589100209c5 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 15:38:05 2023 +0300 filtering: imp code commit 466bc26d524ea6d1c3efb33692a7785d39e491ca Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 18:38:40 2023 +0300 filtering: add tests commit 24365ecf8c60512fdac65833ee603c80864ae018 Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 11:38:57 2023 +0300 filtering: add hashprefix
https://github.com/AdguardTeam/AdGuardHome/commit/381f2f651d1a94d29bf534185e531b05a755f16c
internal/home/home.go
"github.com/AdguardTeam/AdGuardHome/internal/stats" "github.com/AdguardTeam/AdGuardHome/internal/updater" "github.com/AdguardTeam/AdGuardHome/internal/version" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/golibs/netutil" "golang.org/x/exp/slices"
</s> remove "github.com/AdguardTeam/dnsproxy/upstream" "github.com/AdguardTeam/golibs/cache" </s> add </s> remove "github.com/AdguardTeam/dnsproxy/upstream" "github.com/AdguardTeam/golibs/cache" </s> add </s> remove "github.com/AdguardTeam/golibs/stringutil" "github.com/miekg/dns" "golang.org/x/exp/slices" "golang.org/x/net/publicsuffix" </s> add
"github.com/AdguardTeam/dnsproxy/upstream"
"github.com/AdguardTeam/AdGuardHome/internal/stats" "github.com/AdguardTeam/AdGuardHome/internal/updater" "github.com/AdguardTeam/AdGuardHome/internal/version" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/golibs/netutil" "golang.org/x/exp/slices"
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request 1837: AG-21462-imp-safebrowsing-parental Merge in DNS/adguard-home from AG-21462-imp-safebrowsing-parental to master Squashed commit of the following: commit 85016d4f1105e21a407efade0bd45b8362808061 Merge: 0e61edade 620b51e3e Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 16:36:30 2023 +0300 Merge branch 'master' into AG-21462-imp-safebrowsing-parental commit 0e61edadeff34f6305e941c1db94575c82f238d9 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 14:51:37 2023 +0300 filtering: imp tests commit 994255514cc0f67dfe33d5a0892432e8924d1e36 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:13:19 2023 +0300 filtering: fix typo commit 96d1069573171538333330d6af94ef0f4208a9c4 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 27 11:00:18 2023 +0300 filtering: imp code more commit c2a5620b04c4a529eea69983f1520cd2bc82ea9b Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 19:13:26 2023 +0300 all: add todo commit e5dcc2e9701f8bccfde6ef8c01a4a2e7eb31599e Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 26 14:36:08 2023 +0300 all: imp code more commit b6e734ccbeda82669023f6578481260b7c1f7161 Author: Stanislav Chzhen <[email protected]> Date: Tue Apr 25 15:01:56 2023 +0300 filtering: imp code commit 530648dadf836c1a4bd9917e0d3b47256fa8ff52 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 20:06:36 2023 +0300 all: imp code commit 49fa6e587052a40bb431fea457701ee860493527 Author: Stanislav Chzhen <[email protected]> Date: Mon Apr 24 14:57:19 2023 +0300 all: rm safe browsing ctx commit bbcb66cb03e18fa875e3c33cf16295892739e507 Author: Stanislav Chzhen <[email protected]> Date: Fri Apr 21 17:54:18 2023 +0300 filtering: add cache item commit cb7c9fffe8c4ff5e7a21ca912c223c799f61385f Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 18:43:02 2023 +0300 filtering: fix hashes commit 153fec46270212af03f3631bfb42c5d680c4e142 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 16:15:15 2023 +0300 filtering: add test cases commit 09372f92bbb1fc082f1b1283594ee589100209c5 Author: Stanislav Chzhen <[email protected]> Date: Thu Apr 20 15:38:05 2023 +0300 filtering: imp code commit 466bc26d524ea6d1c3efb33692a7785d39e491ca Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 18:38:40 2023 +0300 filtering: add tests commit 24365ecf8c60512fdac65833ee603c80864ae018 Author: Stanislav Chzhen <[email protected]> Date: Wed Apr 19 11:38:57 2023 +0300 filtering: add hashprefix
https://github.com/AdguardTeam/AdGuardHome/commit/381f2f651d1a94d29bf534185e531b05a755f16c
internal/home/home.go
"github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/golibs/stringutil" "github.com/AdguardTeam/urlfilter" "github.com/AdguardTeam/urlfilter/filterlist" ) // unit is a convenient alias for struct{} type unit = struct{}
</s> remove func (a *accessManager) isBlockedHost(host string) (ok bool) { _, ok = a.blockedHostsEng.Match(strings.ToLower(host)) </s> add func (a *accessManager) isBlockedHost(host string, qt rules.RRType) (ok bool) { _, ok = a.blockedHostsEng.MatchRequest(&urlfilter.DNSRequest{ Hostname: host, ClientIP: "0.0.0.0", DNSType: qt, }) </s> remove host := strings.TrimSuffix(pctx.Req.Question[0].Name, ".") if s.access.isBlockedHost(host) { log.Debug("host %s is in access blocklist", host) </s> add q := pctx.Req.Question[0] qt := q.Qtype host := strings.TrimSuffix(q.Name, ".") if s.access.isBlockedHost(host, qt) { log.Debug("request %s %s is in access blocklist", dns.Type(qt), host) </s> remove ip: netip.MustParseAddr("9.6.7.100"), </s> add </s> remove assert.Equal(t, tc.want, a.isBlockedHost(tc.host)) </s> add tc.want(t, a.isBlockedHost(tc.host, tc.qt))
"github.com/AdguardTeam/urlfilter/rules"
"github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/golibs/stringutil" "github.com/AdguardTeam/urlfilter" "github.com/AdguardTeam/urlfilter/filterlist" "github.com/AdguardTeam/urlfilter/rules" ) // unit is a convenient alias for struct{} type unit = struct{}
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access.go
return a.blockedClientIDs.Has(id) } // isBlockedHost returns true if host should be blocked. func (a *accessManager) isBlockedHost(host string) (ok bool) { _, ok = a.blockedHostsEng.Match(strings.ToLower(host)) return ok } // isBlockedIP returns the status of the IP address blocking as well as the rule
</s> remove host := strings.TrimSuffix(pctx.Req.Question[0].Name, ".") if s.access.isBlockedHost(host) { log.Debug("host %s is in access blocklist", host) </s> add q := pctx.Req.Question[0] qt := q.Qtype host := strings.TrimSuffix(q.Name, ".") if s.access.isBlockedHost(host, qt) { log.Debug("request %s %s is in access blocklist", dns.Type(qt), host) </s> remove assert.Equal(t, tc.want, a.isBlockedHost(tc.host)) </s> add tc.want(t, a.isBlockedHost(tc.host, tc.qt)) </s> remove ip: netip.MustParseAddr("9.6.7.100"), </s> add
func (a *accessManager) isBlockedHost(host string, qt rules.RRType) (ok bool) { _, ok = a.blockedHostsEng.MatchRequest(&urlfilter.DNSRequest{ Hostname: host, ClientIP: "0.0.0.0", DNSType: qt, })
return a.blockedClientIDs.Has(id) } // isBlockedHost returns true if host should be blocked. func (a *accessManager) isBlockedHost(host string, qt rules.RRType) (ok bool) { _, ok = a.blockedHostsEng.MatchRequest(&urlfilter.DNSRequest{ Hostname: host, ClientIP: "0.0.0.0", DNSType: qt, }) func (a *accessManager) isBlockedHost(host string, qt rules.RRType) (ok bool) { _, ok = a.blockedHostsEng.MatchRequest(&urlfilter.DNSRequest{ Hostname: host, ClientIP: "0.0.0.0", DNSType: qt, }) return ok } // isBlockedIP returns the status of the IP address blocking as well as the rule
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access.go
"testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestIsBlockedClientID(t *testing.T) {
</s> remove assert.Equal(t, tc.want, a.isBlockedHost(tc.host)) </s> add tc.want(t, a.isBlockedHost(tc.host, tc.qt)) </s> remove ip: netip.MustParseAddr("9.6.7.100"), </s> add </s> remove func (a *accessManager) isBlockedHost(host string) (ok bool) { _, ok = a.blockedHostsEng.Match(strings.ToLower(host)) </s> add func (a *accessManager) isBlockedHost(host string, qt rules.RRType) (ok bool) { _, ok = a.blockedHostsEng.MatchRequest(&urlfilter.DNSRequest{ Hostname: host, ClientIP: "0.0.0.0", DNSType: qt, }) </s> remove want: false, </s> add qt: dns.TypeA, }, { want: assert.True, name: "by_qtype", host: "site-with-https-record.example", qt: dns.TypeHTTPS, }, { want: assert.False, name: "by_qtype_other", host: "site-with-https-record.example", qt: dns.TypeA,
"github.com/AdguardTeam/urlfilter/rules" "github.com/miekg/dns"
"testing" "github.com/AdguardTeam/urlfilter/rules" "github.com/miekg/dns" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestIsBlockedClientID(t *testing.T) {
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
"*.host.com", "||host3.com^", }) require.NoError(t, err) testCases := []struct { want assert.BoolAssertionFunc
</s> remove want bool </s> add qt rules.RRType </s> remove assert.Equal(t, tc.want, a.isBlockedHost(tc.host)) </s> add tc.want(t, a.isBlockedHost(tc.host, tc.qt)) </s> remove ip netip.Addr </s> add
"||*^$dnstype=HTTPS",
"*.host.com", "||host3.com^", "||*^$dnstype=HTTPS", }) require.NoError(t, err) testCases := []struct { want assert.BoolAssertionFunc
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
}) require.NoError(t, err) testCases := []struct { name string host string qt rules.RRType }{{ want: assert.True,
</s> remove want bool </s> add qt rules.RRType </s> remove ip netip.Addr </s> add
want assert.BoolAssertionFunc
}) require.NoError(t, err) testCases := []struct { want assert.BoolAssertionFunc name string host string qt rules.RRType }{{ want: assert.True,
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
testCases := []struct { name string host string want bool }{{ name: "plain_match", host: "host1", want: true, }, {
</s> remove ip netip.Addr </s> add </s> remove want: true, </s> add qt: dns.TypeA,
qt rules.RRType
testCases := []struct { name string host string qt rules.RRType }{{ name: "plain_match", host: "host1", want: true, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
name string host string qt rules.RRType }{{ name: "plain_match", host: "host1", qt: dns.TypeA, }, { want: assert.False, name: "plain_mismatch",
</s> remove want bool </s> add qt rules.RRType </s> remove want: true, </s> add qt: dns.TypeA, </s> remove ip netip.Addr </s> add
want: assert.True,
name string host string qt rules.RRType }{{ want: assert.True, name: "plain_match", host: "host1", qt: dns.TypeA, }, { want: assert.False, name: "plain_mismatch",
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
want bool }{{ name: "plain_match", host: "host1", want: true, }, { name: "plain_mismatch", host: "host2", want: false, }, {
</s> remove want bool </s> add qt rules.RRType </s> remove want: false, </s> add qt: dns.TypeA,
qt: dns.TypeA,
want bool }{{ name: "plain_match", host: "host1", qt: dns.TypeA, }, { name: "plain_mismatch", host: "host2", want: false, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
qt: dns.TypeA, }, { name: "plain_mismatch", host: "host2", qt: dns.TypeA, }, { want: assert.True,
</s> remove want: false, </s> add qt: dns.TypeA, </s> remove want: true, </s> add qt: dns.TypeA,
want: assert.False,
qt: dns.TypeA, }, { want: assert.False, name: "plain_mismatch", host: "host2", qt: dns.TypeA, }, { want: assert.True,
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
want: true, }, { name: "plain_mismatch", host: "host2", want: false, }, { name: "subdomain_match_short", host: "asdf.host.com", want: true, }, {
</s> remove want: true, </s> add qt: dns.TypeA, </s> remove want: true, </s> add qt: dns.TypeA, </s> remove want: false, </s> add qt: dns.TypeA,
qt: dns.TypeA,
want: true, }, { name: "plain_mismatch", host: "host2", qt: dns.TypeA, }, { name: "subdomain_match_short", host: "asdf.host.com", want: true, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
host: "host2", qt: dns.TypeA, }, { name: "subdomain_match_short", host: "asdf.host.com", qt: dns.TypeA, }, { want: assert.True, name: "subdomain_match_long",
</s> remove want: true, </s> add qt: dns.TypeA, </s> remove want: false, </s> add qt: dns.TypeA, </s> remove want: true, </s> add qt: dns.TypeA,
want: assert.True,
host: "host2", qt: dns.TypeA, }, { want: assert.True, name: "subdomain_match_short", host: "asdf.host.com", qt: dns.TypeA, }, { want: assert.True, name: "subdomain_match_long",
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
want: false, }, { name: "subdomain_match_short", host: "asdf.host.com", want: true, }, { name: "subdomain_match_long", host: "qwer.asdf.host.com", want: true, }, {
</s> remove want: false, </s> add qt: dns.TypeA, </s> remove want: true, </s> add qt: dns.TypeA, </s> remove want: false, </s> add qt: dns.TypeA,
qt: dns.TypeA,
want: false, }, { name: "subdomain_match_short", host: "asdf.host.com", qt: dns.TypeA, }, { name: "subdomain_match_long", host: "qwer.asdf.host.com", want: true, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
host: "asdf.host.com", qt: dns.TypeA, }, { name: "subdomain_match_long", host: "qwer.asdf.host.com", qt: dns.TypeA, }, {
</s> remove want: true, </s> add qt: dns.TypeA, </s> remove want: true, </s> add qt: dns.TypeA, </s> remove want: false, </s> add qt: dns.TypeA, </s> remove want: false, </s> add qt: dns.TypeA,
want: assert.True,
host: "asdf.host.com", qt: dns.TypeA, }, { want: assert.True, name: "subdomain_match_long", host: "qwer.asdf.host.com", qt: dns.TypeA, }, {
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
want: true, }, { name: "subdomain_match_long", host: "qwer.asdf.host.com", want: true, }, { name: "subdomain_mismatch_no_lead", host: "host.com", want: false, }, {
</s> remove want: false, </s> add qt: dns.TypeA, </s> remove want: true, </s> add qt: dns.TypeA, </s> remove want: false, </s> add qt: dns.TypeA,
qt: dns.TypeA,
want: true, }, { name: "subdomain_match_long", host: "qwer.asdf.host.com", qt: dns.TypeA, }, { name: "subdomain_mismatch_no_lead", host: "host.com", want: false, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
qt: dns.TypeA, }, { name: "subdomain_mismatch_no_lead", host: "host.com", qt: dns.TypeA, }, { want: assert.False, name: "subdomain_mismatch_bad_asterisk",
</s> remove want: false, </s> add qt: dns.TypeA, </s> remove want: true, </s> add qt: dns.TypeA, </s> remove want: false, </s> add qt: dns.TypeA,
want: assert.False,
qt: dns.TypeA, }, { want: assert.False, name: "subdomain_mismatch_no_lead", host: "host.com", qt: dns.TypeA, }, { want: assert.False, name: "subdomain_mismatch_bad_asterisk",
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
want: true, }, { name: "subdomain_mismatch_no_lead", host: "host.com", want: false, }, { name: "subdomain_mismatch_bad_asterisk", host: "asdf.zhost.com", want: false, }, {
</s> remove want: true, </s> add qt: dns.TypeA, </s> remove want: false, </s> add qt: dns.TypeA,
qt: dns.TypeA,
want: true, }, { name: "subdomain_mismatch_no_lead", host: "host.com", qt: dns.TypeA, }, { name: "subdomain_mismatch_bad_asterisk", host: "asdf.zhost.com", want: false, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
qt: dns.TypeA, }, { name: "subdomain_mismatch_bad_asterisk", host: "asdf.zhost.com", qt: dns.TypeA, }, { want: assert.True,
</s> remove want: false, </s> add qt: dns.TypeA, </s> remove want: false, </s> add qt: dns.TypeA,
want: assert.False,
qt: dns.TypeA, }, { want: assert.False, name: "subdomain_mismatch_bad_asterisk", host: "asdf.zhost.com", qt: dns.TypeA, }, { want: assert.True,
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
want: false, }, { name: "subdomain_mismatch_bad_asterisk", host: "asdf.zhost.com", want: false, }, { name: "rule_match_simple", host: "host3.com", want: true, }, {
</s> remove want: true, </s> add qt: dns.TypeA, </s> remove want: false, </s> add qt: dns.TypeA, </s> remove want: false, </s> add qt: dns.TypeA,
qt: dns.TypeA,
want: false, }, { name: "subdomain_mismatch_bad_asterisk", host: "asdf.zhost.com", qt: dns.TypeA, }, { name: "rule_match_simple", host: "host3.com", want: true, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
name: "subdomain_mismatch_bad_asterisk", host: "asdf.zhost.com", qt: dns.TypeA, }, { name: "rule_match_simple", host: "host3.com", qt: dns.TypeA, }, { want: assert.True, name: "rule_match_complex",
</s> remove want: false, </s> add qt: dns.TypeA, </s> remove want: true, </s> add qt: dns.TypeA, </s> remove want: false, </s> add qt: dns.TypeA,
want: assert.True,
name: "subdomain_mismatch_bad_asterisk", host: "asdf.zhost.com", qt: dns.TypeA, }, { want: assert.True, name: "rule_match_simple", host: "host3.com", qt: dns.TypeA, }, { want: assert.True, name: "rule_match_complex",
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
want: false, }, { name: "rule_match_simple", host: "host3.com", want: true, }, { name: "rule_match_complex", host: "asdf.host3.com", want: true, }, {
</s> remove want: false, </s> add qt: dns.TypeA, </s> remove want: true, </s> add qt: dns.TypeA, </s> remove want: false, </s> add qt: dns.TypeA,
qt: dns.TypeA,
want: false, }, { name: "rule_match_simple", host: "host3.com", qt: dns.TypeA, }, { name: "rule_match_complex", host: "asdf.host3.com", want: true, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
host: "host3.com", qt: dns.TypeA, }, { name: "rule_match_complex", host: "asdf.host3.com", qt: dns.TypeA, }, { want: assert.False,
</s> remove want: true, </s> add qt: dns.TypeA, </s> remove want: true, </s> add qt: dns.TypeA, </s> remove want: false, </s> add qt: dns.TypeA,
want: assert.True,
host: "host3.com", qt: dns.TypeA, }, { want: assert.True, name: "rule_match_complex", host: "asdf.host3.com", qt: dns.TypeA, }, { want: assert.False,
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
want: true, }, { name: "rule_match_complex", host: "asdf.host3.com", want: true, }, { name: "rule_mismatch", host: ".host3.com", want: false, }}
</s> remove want: true, </s> add qt: dns.TypeA, </s> remove want: false, </s> add qt: dns.TypeA, }, { want: assert.True, name: "by_qtype", host: "site-with-https-record.example", qt: dns.TypeHTTPS, }, { want: assert.False, name: "by_qtype_other", host: "site-with-https-record.example", qt: dns.TypeA,
qt: dns.TypeA,
want: true, }, { name: "rule_match_complex", host: "asdf.host3.com", qt: dns.TypeA, }, { name: "rule_mismatch", host: ".host3.com", want: false, }}
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
qt: dns.TypeA, }, { name: "rule_mismatch", host: ".host3.com", qt: dns.TypeA, }, { want: assert.True, name: "by_qtype",
</s> remove want: false, </s> add qt: dns.TypeA, }, { want: assert.True, name: "by_qtype", host: "site-with-https-record.example", qt: dns.TypeHTTPS, }, { want: assert.False, name: "by_qtype_other", host: "site-with-https-record.example", qt: dns.TypeA, </s> remove want: true, </s> add qt: dns.TypeA,
want: assert.False,
qt: dns.TypeA, }, { want: assert.False, name: "rule_mismatch", host: ".host3.com", qt: dns.TypeA, }, { want: assert.True, name: "by_qtype",
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
want: true, }, { name: "rule_mismatch", host: ".host3.com", want: false, }} for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { assert.Equal(t, tc.want, a.isBlockedHost(tc.host))
</s> remove assert.Equal(t, tc.want, a.isBlockedHost(tc.host)) </s> add tc.want(t, a.isBlockedHost(tc.host, tc.qt)) </s> remove ip: netip.MustParseAddr("9.6.7.100"), </s> add </s> remove want: true, </s> add qt: dns.TypeA, </s> remove want: false, </s> add qt: dns.TypeA,
qt: dns.TypeA, }, { want: assert.True, name: "by_qtype", host: "site-with-https-record.example", qt: dns.TypeHTTPS, }, { want: assert.False, name: "by_qtype_other", host: "site-with-https-record.example", qt: dns.TypeA,
want: true, }, { name: "rule_mismatch", host: ".host3.com", qt: dns.TypeA, }, { want: assert.True, name: "by_qtype", host: "site-with-https-record.example", qt: dns.TypeHTTPS, }, { want: assert.False, name: "by_qtype_other", host: "site-with-https-record.example", qt: dns.TypeA, }} for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { assert.Equal(t, tc.want, a.isBlockedHost(tc.host))
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
}} for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { assert.Equal(t, tc.want, a.isBlockedHost(tc.host)) }) } } func TestIsBlockedIP(t *testing.T) {
</s> remove want: false, </s> add qt: dns.TypeA, }, { want: assert.True, name: "by_qtype", host: "site-with-https-record.example", qt: dns.TypeHTTPS, }, { want: assert.False, name: "by_qtype_other", host: "site-with-https-record.example", qt: dns.TypeA, </s> remove ip: netip.MustParseAddr("9.6.7.100"), </s> add </s> remove func (a *accessManager) isBlockedHost(host string) (ok bool) { _, ok = a.blockedHostsEng.Match(strings.ToLower(host)) </s> add func (a *accessManager) isBlockedHost(host string, qt rules.RRType) (ok bool) { _, ok = a.blockedHostsEng.MatchRequest(&urlfilter.DNSRequest{ Hostname: host, ClientIP: "0.0.0.0", DNSType: qt, }) </s> remove host := strings.TrimSuffix(pctx.Req.Question[0].Name, ".") if s.access.isBlockedHost(host) { log.Debug("host %s is in access blocklist", host) </s> add q := pctx.Req.Question[0] qt := q.Qtype host := strings.TrimSuffix(q.Name, ".") if s.access.isBlockedHost(host, qt) { log.Debug("request %s %s is in access blocklist", dns.Type(qt), host)
tc.want(t, a.isBlockedHost(tc.host, tc.qt))
}} for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { tc.want(t, a.isBlockedHost(tc.host, tc.qt)) }) } } func TestIsBlockedIP(t *testing.T) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
require.NoError(t, err) testCases := []struct { name string wantRule string wantBlocked bool }{{
</s> remove ip netip.Addr </s> add </s> remove want bool </s> add qt rules.RRType
ip netip.Addr
require.NoError(t, err) testCases := []struct { ip netip.Addr name string wantRule string wantBlocked bool }{{
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
testCases := []struct { name string wantRule string ip netip.Addr wantBlocked bool }{{ name: "match_ip", wantRule: "1.2.3.4", ip: netip.MustParseAddr("1.2.3.4"),
</s> remove ip: netip.MustParseAddr("1.2.3.4"), </s> add </s> remove want bool </s> add qt rules.RRType
testCases := []struct { name string wantRule string wantBlocked bool }{{ name: "match_ip", wantRule: "1.2.3.4", ip: netip.MustParseAddr("1.2.3.4"),
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
wantRule string wantBlocked bool }{{ name: "match_ip", wantRule: "1.2.3.4", wantBlocked: true, }, { ip: netip.MustParseAddr("5.6.7.100"), name: "match_cidr",
</s> remove ip: netip.MustParseAddr("1.2.3.4"), </s> add </s> remove ip netip.Addr </s> add </s> remove ip: netip.MustParseAddr("5.6.7.100"), </s> add
ip: netip.MustParseAddr("1.2.3.4"),
wantRule string wantBlocked bool }{{ ip: netip.MustParseAddr("1.2.3.4"), name: "match_ip", wantRule: "1.2.3.4", wantBlocked: true, }, { ip: netip.MustParseAddr("5.6.7.100"), name: "match_cidr",
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
wantBlocked bool }{{ name: "match_ip", wantRule: "1.2.3.4", ip: netip.MustParseAddr("1.2.3.4"), wantBlocked: true, }, { name: "match_cidr", wantRule: "5.6.7.8/24", ip: netip.MustParseAddr("5.6.7.100"),
</s> remove ip: netip.MustParseAddr("5.6.7.100"), </s> add </s> remove ip netip.Addr </s> add </s> remove ip: netip.MustParseAddr("9.2.3.4"), </s> add
wantBlocked bool }{{ name: "match_ip", wantRule: "1.2.3.4", wantBlocked: true, }, { name: "match_cidr", wantRule: "5.6.7.8/24", ip: netip.MustParseAddr("5.6.7.100"),
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
wantRule: "1.2.3.4", wantBlocked: true, }, { name: "match_cidr", wantRule: "5.6.7.8/24", wantBlocked: true, }, {
</s> remove ip: netip.MustParseAddr("1.2.3.4"), </s> add </s> remove ip: netip.MustParseAddr("5.6.7.100"), </s> add </s> remove ip: netip.MustParseAddr("9.2.3.4"), </s> add
ip: netip.MustParseAddr("5.6.7.100"),
wantRule: "1.2.3.4", wantBlocked: true, }, { ip: netip.MustParseAddr("5.6.7.100"), name: "match_cidr", wantRule: "5.6.7.8/24", wantBlocked: true, }, {
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
wantBlocked: true, }, { name: "match_cidr", wantRule: "5.6.7.8/24", ip: netip.MustParseAddr("5.6.7.100"), wantBlocked: true, }, { name: "no_match_ip", wantRule: "", ip: netip.MustParseAddr("9.2.3.4"),
</s> remove ip: netip.MustParseAddr("9.2.3.4"), </s> add </s> remove ip: netip.MustParseAddr("1.2.3.4"), </s> add
wantBlocked: true, }, { name: "match_cidr", wantRule: "5.6.7.8/24", wantBlocked: true, }, { name: "no_match_ip", wantRule: "", ip: netip.MustParseAddr("9.2.3.4"),
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
wantBlocked: true, }, { name: "no_match_ip", wantRule: "", wantBlocked: false, }, { ip: netip.MustParseAddr("9.6.7.100"), name: "no_match_cidr",
</s> remove ip: netip.MustParseAddr("9.2.3.4"), </s> add </s> remove ip: netip.MustParseAddr("5.6.7.100"), </s> add </s> remove ip: netip.MustParseAddr("9.6.7.100"), </s> add
ip: netip.MustParseAddr("9.2.3.4"),
wantBlocked: true, }, { ip: netip.MustParseAddr("9.2.3.4"), name: "no_match_ip", wantRule: "", wantBlocked: false, }, { ip: netip.MustParseAddr("9.6.7.100"), name: "no_match_cidr",
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
wantBlocked: true, }, { name: "no_match_ip", wantRule: "", ip: netip.MustParseAddr("9.2.3.4"), wantBlocked: false, }, { name: "no_match_cidr", wantRule: "", ip: netip.MustParseAddr("9.6.7.100"),
</s> remove ip: netip.MustParseAddr("5.6.7.100"), </s> add </s> remove ip: netip.MustParseAddr("9.6.7.100"), </s> add
wantBlocked: true, }, { name: "no_match_ip", wantRule: "", wantBlocked: false, }, { name: "no_match_cidr", wantRule: "", ip: netip.MustParseAddr("9.6.7.100"),
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
wantBlocked: false, }, { name: "no_match_cidr", wantRule: "", wantBlocked: false, }}
</s> remove ip: netip.MustParseAddr("9.2.3.4"), </s> add </s> remove ip: netip.MustParseAddr("9.6.7.100"), </s> add </s> remove ip: netip.MustParseAddr("5.6.7.100"), </s> add
ip: netip.MustParseAddr("9.6.7.100"),
wantBlocked: false, }, { ip: netip.MustParseAddr("9.6.7.100"), name: "no_match_cidr", wantRule: "", wantBlocked: false, }}
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
wantBlocked: false, }, { name: "no_match_cidr", wantRule: "", ip: netip.MustParseAddr("9.6.7.100"), wantBlocked: false, }} t.Run("allow", func(t *testing.T) { for _, tc := range testCases {
</s> remove assert.Equal(t, tc.want, a.isBlockedHost(tc.host)) </s> add tc.want(t, a.isBlockedHost(tc.host, tc.qt)) </s> remove ip: netip.MustParseAddr("9.2.3.4"), </s> add </s> remove want: false, </s> add qt: dns.TypeA, }, { want: assert.True, name: "by_qtype", host: "site-with-https-record.example", qt: dns.TypeHTTPS, }, { want: assert.False, name: "by_qtype_other", host: "site-with-https-record.example", qt: dns.TypeA,
wantBlocked: false, }, { name: "no_match_cidr", wantRule: "", wantBlocked: false, }} t.Run("allow", func(t *testing.T) { for _, tc := range testCases {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/access_test.go
return s.preBlockedResponse(pctx) } if len(pctx.Req.Question) == 1 { host := strings.TrimSuffix(pctx.Req.Question[0].Name, ".") if s.access.isBlockedHost(host) { log.Debug("host %s is in access blocklist", host) return s.preBlockedResponse(pctx) } }
</s> remove func (a *accessManager) isBlockedHost(host string) (ok bool) { _, ok = a.blockedHostsEng.Match(strings.ToLower(host)) </s> add func (a *accessManager) isBlockedHost(host string, qt rules.RRType) (ok bool) { _, ok = a.blockedHostsEng.MatchRequest(&urlfilter.DNSRequest{ Hostname: host, ClientIP: "0.0.0.0", DNSType: qt, }) </s> remove assert.Equal(t, tc.want, a.isBlockedHost(tc.host)) </s> add tc.want(t, a.isBlockedHost(tc.host, tc.qt)) </s> remove want bool </s> add qt rules.RRType
q := pctx.Req.Question[0] qt := q.Qtype host := strings.TrimSuffix(q.Name, ".") if s.access.isBlockedHost(host, qt) { log.Debug("request %s %s is in access blocklist", dns.Type(qt), host)
return s.preBlockedResponse(pctx) } if len(pctx.Req.Question) == 1 { q := pctx.Req.Question[0] qt := q.Qtype host := strings.TrimSuffix(q.Name, ".") if s.access.isBlockedHost(host, qt) { log.Debug("request %s %s is in access blocklist", dns.Type(qt), host) q := pctx.Req.Question[0] qt := q.Qtype host := strings.TrimSuffix(q.Name, ".") if s.access.isBlockedHost(host, qt) { log.Debug("request %s %s is in access blocklist", dns.Type(qt), host) q := pctx.Req.Question[0] qt := q.Qtype host := strings.TrimSuffix(q.Name, ".") if s.access.isBlockedHost(host, qt) { log.Debug("request %s %s is in access blocklist", dns.Type(qt), host) return s.preBlockedResponse(pctx) } }
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request 1750: 5468-disallowed-dnstype Updates #5468. Squashed commit of the following: commit ecb0c7cc53d43fe5aa75be0c5fc0f2a9179099ad Author: Ainar Garipov <[email protected]> Date: Mon Feb 27 13:57:40 2023 +0300 dnsforward: imp access test commit 3fdc2c4533d1fce8a01f6e636e326454ef96565b Author: Ainar Garipov <[email protected]> Date: Wed Feb 22 19:29:50 2023 +0300 dnsforward: allow dnstype rules in disallowed domains
https://github.com/AdguardTeam/AdGuardHome/commit/386add033b91e3110c822369fa91629d9006436c
internal/dnsforward/filter.go
await apiClient.setTlsConfig(values); dispatch(setTlsConfigSuccess(config)); dispatch(addSuccessToast('encryption_config_saved')); } catch (error) { dispatch(addErrorToast({ error })); dispatch(setTlsConfigFailure()); }
</s> remove {encryption && !encryption.processing && </s> add {encryption &&
dispatch(getTlsStatus());
await apiClient.setTlsConfig(values); dispatch(setTlsConfigSuccess(config)); dispatch(addSuccessToast('encryption_config_saved')); dispatch(getTlsStatus()); } catch (error) { dispatch(addErrorToast({ error })); dispatch(setTlsConfigFailure()); }
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Request tls status after save
https://github.com/AdguardTeam/AdGuardHome/commit/38983097785c3d7f37c99cc2560512c4b342a201
client/src/actions/index.js
} = encryption; return ( <div className="encryption"> {encryption && !encryption.processing && <Card title={t('encryption_title')} subtitle={t('encryption_desc')} bodyType="card-body box-body--settings" >
</s>
{encryption &&
} = encryption; return ( <div className="encryption"> {encryption && <Card title={t('encryption_title')} subtitle={t('encryption_desc')} bodyType="card-body box-body--settings" >
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Request tls status after save
https://github.com/AdguardTeam/AdGuardHome/commit/38983097785c3d7f37c99cc2560512c4b342a201
client/src/components/Settings/Encryption/index.js
processing: true, processingConfig: false, }); export default combineReducers({ settings, dashboard,
</s> remove {encryption && !encryption.processing && </s> add {encryption &&
status_cert: '', status_key: '',
processing: true, processingConfig: false, status_cert: '', status_key: '', }); export default combineReducers({ settings, dashboard,
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Request tls status after save
https://github.com/AdguardTeam/AdGuardHome/commit/38983097785c3d7f37c99cc2560512c4b342a201
client/src/reducers/index.js
import ( "encoding/binary" "fmt" "io/ioutil" "net" "strings"
</s> remove conn, err := net.DialTimeout("tcp", serverAddr, time.Duration(w.timeoutMsec)*time.Millisecond) </s> add conn, err := customDialContext(context.TODO(), "tcp", serverAddr)
"context"
import ( "context" "encoding/binary" "fmt" "io/ioutil" "net" "strings"
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
* whois: use the upstream server to resolve whois server hostname Close #1535 Squashed commit of the following: commit 7755d7a50e48db5d341029e1c21da95a396d9090 Merge: e24e945f 5c2ca690 Author: Simon Zolin <[email protected]> Date: Wed May 27 14:41:24 2020 +0300 Merge remote-tracking branch 'origin/master' into 1535-whois-resolve commit e24e945f9b949e3cabcddb3a8a62962bb7a5b0b9 Merge: db764710 355e634f Author: Simon Zolin <[email protected]> Date: Wed May 27 14:29:44 2020 +0300 Merge remote-tracking branch 'origin/master' into 1535-whois-resolve commit db764710a0f0b60293f7bdf6b0d7b858d56819e0 Author: Simon Zolin <[email protected]> Date: Wed May 27 12:57:00 2020 +0300 fix commit dc38f668d5845cfd696b3107a8f02dda4f10298e Author: Simon Zolin <[email protected]> Date: Wed May 27 12:44:10 2020 +0300 * whois: use the upstream server to resolve whois server hostname
https://github.com/AdguardTeam/AdGuardHome/commit/391e619979e1849947d55eac78a6664745e4d288
home/whois.go
addr, _, _ := net.SplitHostPort(serverAddr) if addr == "whois.arin.net" { target = "n + " + target } conn, err := net.DialTimeout("tcp", serverAddr, time.Duration(w.timeoutMsec)*time.Millisecond) if err != nil { return "", err } defer conn.Close()
</s>
conn, err := customDialContext(context.TODO(), "tcp", serverAddr)
addr, _, _ := net.SplitHostPort(serverAddr) if addr == "whois.arin.net" { target = "n + " + target } conn, err := customDialContext(context.TODO(), "tcp", serverAddr) if err != nil { return "", err } defer conn.Close()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
* whois: use the upstream server to resolve whois server hostname Close #1535 Squashed commit of the following: commit 7755d7a50e48db5d341029e1c21da95a396d9090 Merge: e24e945f 5c2ca690 Author: Simon Zolin <[email protected]> Date: Wed May 27 14:41:24 2020 +0300 Merge remote-tracking branch 'origin/master' into 1535-whois-resolve commit e24e945f9b949e3cabcddb3a8a62962bb7a5b0b9 Merge: db764710 355e634f Author: Simon Zolin <[email protected]> Date: Wed May 27 14:29:44 2020 +0300 Merge remote-tracking branch 'origin/master' into 1535-whois-resolve commit db764710a0f0b60293f7bdf6b0d7b858d56819e0 Author: Simon Zolin <[email protected]> Date: Wed May 27 12:57:00 2020 +0300 fix commit dc38f668d5845cfd696b3107a8f02dda4f10298e Author: Simon Zolin <[email protected]> Date: Wed May 27 12:44:10 2020 +0300 * whois: use the upstream server to resolve whois server hostname
https://github.com/AdguardTeam/AdGuardHome/commit/391e619979e1849947d55eac78a6664745e4d288
home/whois.go
import ( "testing" "github.com/AdguardTeam/AdGuardHome/dnsforward" "github.com/AdguardTeam/dnsproxy/proxy" "github.com/stretchr/testify/assert"
</s> remove conn, err := net.DialTimeout("tcp", serverAddr, time.Duration(w.timeoutMsec)*time.Millisecond) </s> add conn, err := customDialContext(context.TODO(), "tcp", serverAddr)
"time"
import ( "testing" "time" "github.com/AdguardTeam/AdGuardHome/dnsforward" "github.com/AdguardTeam/dnsproxy/proxy" "github.com/stretchr/testify/assert"
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
* whois: use the upstream server to resolve whois server hostname Close #1535 Squashed commit of the following: commit 7755d7a50e48db5d341029e1c21da95a396d9090 Merge: e24e945f 5c2ca690 Author: Simon Zolin <[email protected]> Date: Wed May 27 14:41:24 2020 +0300 Merge remote-tracking branch 'origin/master' into 1535-whois-resolve commit e24e945f9b949e3cabcddb3a8a62962bb7a5b0b9 Merge: db764710 355e634f Author: Simon Zolin <[email protected]> Date: Wed May 27 14:29:44 2020 +0300 Merge remote-tracking branch 'origin/master' into 1535-whois-resolve commit db764710a0f0b60293f7bdf6b0d7b858d56819e0 Author: Simon Zolin <[email protected]> Date: Wed May 27 12:57:00 2020 +0300 fix commit dc38f668d5845cfd696b3107a8f02dda4f10298e Author: Simon Zolin <[email protected]> Date: Wed May 27 12:44:10 2020 +0300 * whois: use the upstream server to resolve whois server hostname
https://github.com/AdguardTeam/AdGuardHome/commit/391e619979e1849947d55eac78a6664745e4d288
home/whois_test.go
"time" "github.com/stretchr/testify/assert" ) func prepareTestDNSServer() error { config.DNS.Port = 1234
</s> remove conn, err := net.DialTimeout("tcp", serverAddr, time.Duration(w.timeoutMsec)*time.Millisecond) </s> add conn, err := customDialContext(context.TODO(), "tcp", serverAddr)
"github.com/AdguardTeam/AdGuardHome/dnsforward" "github.com/AdguardTeam/dnsproxy/proxy"
"time" "github.com/AdguardTeam/AdGuardHome/dnsforward" "github.com/AdguardTeam/dnsproxy/proxy" "github.com/stretchr/testify/assert" ) func prepareTestDNSServer() error { config.DNS.Port = 1234
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
* whois: use the upstream server to resolve whois server hostname Close #1535 Squashed commit of the following: commit 7755d7a50e48db5d341029e1c21da95a396d9090 Merge: e24e945f 5c2ca690 Author: Simon Zolin <[email protected]> Date: Wed May 27 14:41:24 2020 +0300 Merge remote-tracking branch 'origin/master' into 1535-whois-resolve commit e24e945f9b949e3cabcddb3a8a62962bb7a5b0b9 Merge: db764710 355e634f Author: Simon Zolin <[email protected]> Date: Wed May 27 14:29:44 2020 +0300 Merge remote-tracking branch 'origin/master' into 1535-whois-resolve commit db764710a0f0b60293f7bdf6b0d7b858d56819e0 Author: Simon Zolin <[email protected]> Date: Wed May 27 12:57:00 2020 +0300 fix commit dc38f668d5845cfd696b3107a8f02dda4f10298e Author: Simon Zolin <[email protected]> Date: Wed May 27 12:44:10 2020 +0300 * whois: use the upstream server to resolve whois server hostname
https://github.com/AdguardTeam/AdGuardHome/commit/391e619979e1849947d55eac78a6664745e4d288
home/whois_test.go
) func TestWhois(t *testing.T) { err := prepareTestDNSServer() assert.Nil(t, err) w := Whois{timeoutMsec: 5000} resp, err := w.queryAll("8.8.8.8")
</s> remove conn, err := net.DialTimeout("tcp", serverAddr, time.Duration(w.timeoutMsec)*time.Millisecond) </s> add conn, err := customDialContext(context.TODO(), "tcp", serverAddr)
func prepareTestDNSServer() error { config.DNS.Port = 1234 Context.dnsServer = dnsforward.NewServer(nil, nil, nil) conf := &dnsforward.ServerConfig{} uc, err := proxy.ParseUpstreamsConfig([]string{"1.1.1.1"}, nil, time.Second*5) if err != nil { return err } conf.UpstreamConfig = &uc return Context.dnsServer.Prepare(conf) }
) func prepareTestDNSServer() error { config.DNS.Port = 1234 Context.dnsServer = dnsforward.NewServer(nil, nil, nil) conf := &dnsforward.ServerConfig{} uc, err := proxy.ParseUpstreamsConfig([]string{"1.1.1.1"}, nil, time.Second*5) if err != nil { return err } conf.UpstreamConfig = &uc return Context.dnsServer.Prepare(conf) } func TestWhois(t *testing.T) { err := prepareTestDNSServer() assert.Nil(t, err) w := Whois{timeoutMsec: 5000} resp, err := w.queryAll("8.8.8.8")
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
* whois: use the upstream server to resolve whois server hostname Close #1535 Squashed commit of the following: commit 7755d7a50e48db5d341029e1c21da95a396d9090 Merge: e24e945f 5c2ca690 Author: Simon Zolin <[email protected]> Date: Wed May 27 14:41:24 2020 +0300 Merge remote-tracking branch 'origin/master' into 1535-whois-resolve commit e24e945f9b949e3cabcddb3a8a62962bb7a5b0b9 Merge: db764710 355e634f Author: Simon Zolin <[email protected]> Date: Wed May 27 14:29:44 2020 +0300 Merge remote-tracking branch 'origin/master' into 1535-whois-resolve commit db764710a0f0b60293f7bdf6b0d7b858d56819e0 Author: Simon Zolin <[email protected]> Date: Wed May 27 12:57:00 2020 +0300 fix commit dc38f668d5845cfd696b3107a8f02dda4f10298e Author: Simon Zolin <[email protected]> Date: Wed May 27 12:44:10 2020 +0300 * whois: use the upstream server to resolve whois server hostname
https://github.com/AdguardTeam/AdGuardHome/commit/391e619979e1849947d55eac78a6664745e4d288
home/whois_test.go
func TestWhois(t *testing.T) { w := Whois{timeoutMsec: 5000} resp, err := w.queryAll("8.8.8.8") assert.True(t, err == nil) m := whoisParse(resp) assert.True(t, m["orgname"] == "Google LLC")
</s> remove conn, err := net.DialTimeout("tcp", serverAddr, time.Duration(w.timeoutMsec)*time.Millisecond) </s> add conn, err := customDialContext(context.TODO(), "tcp", serverAddr)
err := prepareTestDNSServer() assert.Nil(t, err)
func TestWhois(t *testing.T) { err := prepareTestDNSServer() assert.Nil(t, err) w := Whois{timeoutMsec: 5000} resp, err := w.queryAll("8.8.8.8") assert.True(t, err == nil) m := whoisParse(resp) assert.True(t, m["orgname"] == "Google LLC")
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
* whois: use the upstream server to resolve whois server hostname Close #1535 Squashed commit of the following: commit 7755d7a50e48db5d341029e1c21da95a396d9090 Merge: e24e945f 5c2ca690 Author: Simon Zolin <[email protected]> Date: Wed May 27 14:41:24 2020 +0300 Merge remote-tracking branch 'origin/master' into 1535-whois-resolve commit e24e945f9b949e3cabcddb3a8a62962bb7a5b0b9 Merge: db764710 355e634f Author: Simon Zolin <[email protected]> Date: Wed May 27 14:29:44 2020 +0300 Merge remote-tracking branch 'origin/master' into 1535-whois-resolve commit db764710a0f0b60293f7bdf6b0d7b858d56819e0 Author: Simon Zolin <[email protected]> Date: Wed May 27 12:57:00 2020 +0300 fix commit dc38f668d5845cfd696b3107a8f02dda4f10298e Author: Simon Zolin <[email protected]> Date: Wed May 27 12:44:10 2020 +0300 * whois: use the upstream server to resolve whois server hostname
https://github.com/AdguardTeam/AdGuardHome/commit/391e619979e1849947d55eac78a6664745e4d288
home/whois_test.go
} } // Set necessary properties f.ID = assignUniqueFilterID() f.Enabled = true // Download the filter contents ok, err := f.update(true) if err != nil {
</s> remove w.Write(versionCheckJSON) </s> add w.Write(data)
controlLock.Lock() cached := now.Sub(versionCheckLastTime) <= versionCheckPeriod && len(versionCheckJSON) != 0 data := versionCheckJSON controlLock.Unlock() if cached {
} } // Set necessary properties controlLock.Lock() cached := now.Sub(versionCheckLastTime) <= versionCheckPeriod && len(versionCheckJSON) != 0 data := versionCheckJSON controlLock.Unlock() if cached { f.Enabled = true // Download the filter contents ok, err := f.update(true) if err != nil {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
- control: fix race in /control/version.json handler
https://github.com/AdguardTeam/AdGuardHome/commit/392c7b6ee19ed38650fc9d7f4f3750d965e94da5
control.go
now := time.Now() if now.Sub(versionCheckLastTime) <= versionCheckPeriod && len(versionCheckJSON) != 0 { // return cached copy w.Header().Set("Content-Type", "application/json") w.Write(versionCheckJSON) return } resp, err := client.Get(versionCheckURL) if err != nil {
</s> remove f.ID = assignUniqueFilterID() </s> add controlLock.Lock() cached := now.Sub(versionCheckLastTime) <= versionCheckPeriod && len(versionCheckJSON) != 0 data := versionCheckJSON controlLock.Unlock() if cached {
w.Write(data)
now := time.Now() if now.Sub(versionCheckLastTime) <= versionCheckPeriod && len(versionCheckJSON) != 0 { // return cached copy w.Header().Set("Content-Type", "application/json") w.Write(data) return } resp, err := client.Get(versionCheckURL) if err != nil {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
- control: fix race in /control/version.json handler
https://github.com/AdguardTeam/AdGuardHome/commit/392c7b6ee19ed38650fc9d7f4f3750d965e94da5
control.go
if err != nil { httpError(w, http.StatusInternalServerError, "Couldn't write body: %s", err) } versionCheckLastTime = now versionCheckJSON = body controlLock.Unlock() }
</s> remove f.ID = assignUniqueFilterID() </s> add controlLock.Lock() cached := now.Sub(versionCheckLastTime) <= versionCheckPeriod && len(versionCheckJSON) != 0 data := versionCheckJSON controlLock.Unlock() if cached { </s> remove w.Write(versionCheckJSON) </s> add w.Write(data)
controlLock.Lock()
if err != nil { httpError(w, http.StatusInternalServerError, "Couldn't write body: %s", err) } controlLock.Lock() versionCheckLastTime = now versionCheckJSON = body controlLock.Unlock() }
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
- control: fix race in /control/version.json handler
https://github.com/AdguardTeam/AdGuardHome/commit/392c7b6ee19ed38650fc9d7f4f3750d965e94da5
control.go
controlLock.Lock() versionCheckLastTime = now versionCheckJSON = body } // --------- // filtering // ---------
</s> remove f.ID = assignUniqueFilterID() </s> add controlLock.Lock() cached := now.Sub(versionCheckLastTime) <= versionCheckPeriod && len(versionCheckJSON) != 0 data := versionCheckJSON controlLock.Unlock() if cached { </s> remove w.Write(versionCheckJSON) </s> add w.Write(data)
controlLock.Unlock()
controlLock.Lock() versionCheckLastTime = now versionCheckJSON = body controlLock.Unlock() } // --------- // filtering // ---------
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
- control: fix race in /control/version.json handler
https://github.com/AdguardTeam/AdGuardHome/commit/392c7b6ee19ed38650fc9d7f4f3750d965e94da5
control.go
NATIVE_GOARCH = $(shell unset GOARCH; go env GOARCH) GOPATH := $(shell go env GOPATH) JSFILES = $(shell find client -path client/node_modules -prune -o -type f -name '*.js') STATIC = build/static/index.html TARGET=AdGuardHome .PHONY: all build clean all: build
</s> remove CGO_ENABLED=0 go build -ldflags="-s -w -X main.VersionString=$(GIT_VERSION)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)" </s> add CGO_ENABLED=0 go build -ldflags="-s -w -X main.VersionString=$(GIT_VERSION) -X main.updateChannel=$(CHANNEL)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)" </s> remove const versionCheckURL = "https://adguardteam.github.io/AdGuardHome/version.json" const versionCheckPeriod = time.Hour * 8 </s> add </s> remove log.Printf("AdGuard Home, version %s\n", VersionString) </s> add log.Printf("AdGuard Home, version %s, channel %s\n", VersionString, updateChannel)
CHANNEL ?= release
NATIVE_GOARCH = $(shell unset GOARCH; go env GOARCH) GOPATH := $(shell go env GOPATH) JSFILES = $(shell find client -path client/node_modules -prune -o -type f -name '*.js') STATIC = build/static/index.html CHANNEL ?= release TARGET=AdGuardHome .PHONY: all build clean all: build
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Fix #773 - preparing the new update channel
https://github.com/AdguardTeam/AdGuardHome/commit/395833056097fa44c1221da33319cd64e4a5ca62
Makefile
$(TARGET): $(STATIC) *.go dhcpd/*.go dnsfilter/*.go dnsforward/*.go GOOS=$(NATIVE_GOOS) GOARCH=$(NATIVE_GOARCH) GO111MODULE=off go get -v github.com/gobuffalo/packr/... PATH=$(GOPATH)/bin:$(PATH) packr -z CGO_ENABLED=0 go build -ldflags="-s -w -X main.VersionString=$(GIT_VERSION)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)" PATH=$(GOPATH)/bin:$(PATH) packr clean clean: $(MAKE) cleanfast rm -rf build
</s> remove const versionCheckURL = "https://adguardteam.github.io/AdGuardHome/version.json" const versionCheckPeriod = time.Hour * 8 </s> add </s> remove log.Printf("AdGuard Home, version %s\n", VersionString) </s> add log.Printf("AdGuard Home, version %s, channel %s\n", VersionString, updateChannel)
CGO_ENABLED=0 go build -ldflags="-s -w -X main.VersionString=$(GIT_VERSION) -X main.updateChannel=$(CHANNEL)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)"
$(TARGET): $(STATIC) *.go dhcpd/*.go dnsfilter/*.go dnsforward/*.go GOOS=$(NATIVE_GOOS) GOARCH=$(NATIVE_GOARCH) GO111MODULE=off go get -v github.com/gobuffalo/packr/... PATH=$(GOPATH)/bin:$(PATH) packr -z CGO_ENABLED=0 go build -ldflags="-s -w -X main.VersionString=$(GIT_VERSION) -X main.updateChannel=$(CHANNEL)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)" PATH=$(GOPATH)/bin:$(PATH) packr clean clean: $(MAKE) cleanfast rm -rf build
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Fix #773 - preparing the new update channel
https://github.com/AdguardTeam/AdGuardHome/commit/395833056097fa44c1221da33319cd64e4a5ca62
Makefile
"strings" "sync" "syscall" "github.com/AdguardTeam/golibs/log" "github.com/NYTimes/gziphandler" "github.com/gobuffalo/packr" )
</s> remove const versionCheckURL = "https://adguardteam.github.io/AdGuardHome/version.json" const versionCheckPeriod = time.Hour * 8 </s> add </s> remove log.Printf("AdGuard Home, version %s\n", VersionString) </s> add log.Printf("AdGuard Home, version %s, channel %s\n", VersionString, updateChannel) </s> remove CGO_ENABLED=0 go build -ldflags="-s -w -X main.VersionString=$(GIT_VERSION)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)" </s> add CGO_ENABLED=0 go build -ldflags="-s -w -X main.VersionString=$(GIT_VERSION) -X main.updateChannel=$(CHANNEL)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)"
"time"
"strings" "sync" "syscall" "time" "github.com/AdguardTeam/golibs/log" "github.com/NYTimes/gziphandler" "github.com/gobuffalo/packr" )
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Fix #773 - preparing the new update channel
https://github.com/AdguardTeam/AdGuardHome/commit/395833056097fa44c1221da33319cd64e4a5ca62
app.go
// VersionString will be set through ldflags, contains current version var VersionString = "undefined" var httpServer *http.Server var httpsServer struct { server *http.Server cond *sync.Cond // reacts to config.TLS.Enabled, PortHTTPS, CertificateChain and PrivateKey sync.Mutex // protects config.TLS shutdown bool // if TRUE, don't restart the server
</s> remove log.Printf("AdGuard Home, version %s\n", VersionString) </s> add log.Printf("AdGuard Home, version %s, channel %s\n", VersionString, updateChannel) </s> remove const versionCheckURL = "https://adguardteam.github.io/AdGuardHome/version.json" const versionCheckPeriod = time.Hour * 8 </s> add </s> remove CGO_ENABLED=0 go build -ldflags="-s -w -X main.VersionString=$(GIT_VERSION)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)" </s> add CGO_ENABLED=0 go build -ldflags="-s -w -X main.VersionString=$(GIT_VERSION) -X main.updateChannel=$(CHANNEL)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)"
// updateChannel can be set via ldflags var updateChannel = "release" var versionCheckURL = "https://static.adguard.com/adguardhome/" + updateChannel + "/version.json" const versionCheckPeriod = time.Hour * 8
// VersionString will be set through ldflags, contains current version var VersionString = "undefined" // updateChannel can be set via ldflags var updateChannel = "release" var versionCheckURL = "https://static.adguard.com/adguardhome/" + updateChannel + "/version.json" const versionCheckPeriod = time.Hour * 8 var httpServer *http.Server var httpsServer struct { server *http.Server cond *sync.Cond // reacts to config.TLS.Enabled, PortHTTPS, CertificateChain and PrivateKey sync.Mutex // protects config.TLS shutdown bool // if TRUE, don't restart the server
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Fix #773 - preparing the new update channel
https://github.com/AdguardTeam/AdGuardHome/commit/395833056097fa44c1221da33319cd64e4a5ca62
app.go
// enable TLS 1.3 enableTLS13() // print the first message after logger is configured log.Printf("AdGuard Home, version %s\n", VersionString) log.Debug("Current working directory is %s", config.ourWorkingDir) if args.runningAsService { log.Info("AdGuard Home is running as a service") } config.runningAsService = args.runningAsService
</s> remove const versionCheckURL = "https://adguardteam.github.io/AdGuardHome/version.json" const versionCheckPeriod = time.Hour * 8 </s> add </s> remove CGO_ENABLED=0 go build -ldflags="-s -w -X main.VersionString=$(GIT_VERSION)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)" </s> add CGO_ENABLED=0 go build -ldflags="-s -w -X main.VersionString=$(GIT_VERSION) -X main.updateChannel=$(CHANNEL)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)"
log.Printf("AdGuard Home, version %s, channel %s\n", VersionString, updateChannel)
// enable TLS 1.3 enableTLS13() // print the first message after logger is configured log.Printf("AdGuard Home, version %s, channel %s\n", VersionString, updateChannel) log.Debug("Current working directory is %s", config.ourWorkingDir) if args.runningAsService { log.Info("AdGuard Home is running as a service") } config.runningAsService = args.runningAsService
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Fix #773 - preparing the new update channel
https://github.com/AdguardTeam/AdGuardHome/commit/395833056097fa44c1221da33319cd64e4a5ca62
app.go
var versionCheckLastTime time.Time var protocols = []string{"tls://", "https://", "tcp://", "sdns://"} const versionCheckURL = "https://adguardteam.github.io/AdGuardHome/version.json" const versionCheckPeriod = time.Hour * 8 var transport = &http.Transport{ DialContext: customDialContext, } var client = &http.Client{
</s> remove log.Printf("AdGuard Home, version %s\n", VersionString) </s> add log.Printf("AdGuard Home, version %s, channel %s\n", VersionString, updateChannel) </s> remove CGO_ENABLED=0 go build -ldflags="-s -w -X main.VersionString=$(GIT_VERSION)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)" </s> add CGO_ENABLED=0 go build -ldflags="-s -w -X main.VersionString=$(GIT_VERSION) -X main.updateChannel=$(CHANNEL)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)"
var versionCheckLastTime time.Time var protocols = []string{"tls://", "https://", "tcp://", "sdns://"} var transport = &http.Transport{ DialContext: customDialContext, } var client = &http.Client{
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Fix #773 - preparing the new update channel
https://github.com/AdguardTeam/AdGuardHome/commit/395833056097fa44c1221da33319cd64e4a5ca62
control.go
// Initialize and run the admin Web interface box := packr.NewBox("build/static") // if not configured, redirect / to /install.html, otherwise redirect /install.html to / http.Handle("/", postInstallHandler(optionalAuthHandler(http.FileServer(box)))) http.Handle("/install.html", preInstallHandler(http.FileServer(box))) registerControlHandlers() // this loop is used as an ability to change listening host and/or port for { address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
</s> remove // TODO: move to registerInstallHandlers() http.HandleFunc("/control/install/get_addresses", preInstall(ensureGET(handleInstallGetAddresses))) http.HandleFunc("/control/install/configure", preInstall(ensurePOST(handleInstallConfigure))) </s> add
// Initialize and run the admin Web interface box := packr.NewBox("build/static") // if not configured, redirect / to /install.html, otherwise redirect /install.html to / http.Handle("/", postInstallHandler(optionalAuthHandler(http.FileServer(box)))) registerControlHandlers() // this loop is used as an ability to change listening host and/or port for { address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move installation of /install handlers into a separate optional function
https://github.com/AdguardTeam/AdGuardHome/commit/398312cd80537d49b3c8752425ab7fd8358c7bc0
app.go
http.Handle("/", postInstallHandler(optionalAuthHandler(http.FileServer(box)))) registerControlHandlers() // this loop is used as an ability to change listening host and/or port for { address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) URL := fmt.Sprintf("http://%s", address)
</s> remove http.Handle("/install.html", preInstallHandler(http.FileServer(box))) </s> add </s> remove // TODO: move to registerInstallHandlers() http.HandleFunc("/control/install/get_addresses", preInstall(ensureGET(handleInstallGetAddresses))) http.HandleFunc("/control/install/configure", preInstall(ensurePOST(handleInstallConfigure))) </s> add
// add handlers for /install paths, we only need them when we're not configured yet if config.firstRun { http.Handle("/install.html", preInstallHandler(http.FileServer(box))) registerInstallHandlers() }
http.Handle("/", postInstallHandler(optionalAuthHandler(http.FileServer(box)))) registerControlHandlers() // add handlers for /install paths, we only need them when we're not configured yet if config.firstRun { http.Handle("/install.html", preInstallHandler(http.FileServer(box))) registerInstallHandlers() } // this loop is used as an ability to change listening host and/or port for { address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) URL := fmt.Sprintf("http://%s", address)
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Move installation of /install handlers into a separate optional function
https://github.com/AdguardTeam/AdGuardHome/commit/398312cd80537d49b3c8752425ab7fd8358c7bc0
app.go
} func registerControlHandlers() { http.HandleFunc("/control/status", postInstall(optionalAuth(ensureGET(handleStatus)))) http.HandleFunc("/control/enable_protection", postInstall(optionalAuth(ensurePOST(handleProtectionEnable)))) http.HandleFunc("/control/disable_protection", postInstall(optionalAuth(ensurePOST(handleProtectionDisable)))) http.HandleFunc("/control/querylog", postInstall(optionalAuth(ensureGET(dnsforward.HandleQueryLog)))) http.HandleFunc("/control/querylog_enable", postInstall(optionalAuth(ensurePOST(handleQueryLogEnable))))
</s> remove http.Handle("/install.html", preInstallHandler(http.FileServer(box))) </s> add </s> remove // TODO: move to registerInstallHandlers() http.HandleFunc("/control/install/get_addresses", preInstall(ensureGET(handleInstallGetAddresses))) http.HandleFunc("/control/install/configure", preInstall(ensurePOST(handleInstallConfigure))) </s> add
func registerInstallHandlers() { http.HandleFunc("/control/install/get_addresses", preInstall(ensureGET(handleInstallGetAddresses))) http.HandleFunc("/control/install/configure", preInstall(ensurePOST(handleInstallConfigure))) }
} func registerInstallHandlers() { http.HandleFunc("/control/install/get_addresses", preInstall(ensureGET(handleInstallGetAddresses))) http.HandleFunc("/control/install/configure", preInstall(ensurePOST(handleInstallConfigure))) } func registerControlHandlers() { http.HandleFunc("/control/status", postInstall(optionalAuth(ensureGET(handleStatus)))) http.HandleFunc("/control/enable_protection", postInstall(optionalAuth(ensurePOST(handleProtectionEnable)))) http.HandleFunc("/control/disable_protection", postInstall(optionalAuth(ensurePOST(handleProtectionDisable)))) http.HandleFunc("/control/querylog", postInstall(optionalAuth(ensureGET(dnsforward.HandleQueryLog)))) http.HandleFunc("/control/querylog_enable", postInstall(optionalAuth(ensurePOST(handleQueryLogEnable))))
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Move installation of /install handlers into a separate optional function
https://github.com/AdguardTeam/AdGuardHome/commit/398312cd80537d49b3c8752425ab7fd8358c7bc0
control.go
http.HandleFunc("/control/dhcp/status", postInstall(optionalAuth(ensureGET(handleDHCPStatus)))) http.HandleFunc("/control/dhcp/interfaces", postInstall(optionalAuth(ensureGET(handleDHCPInterfaces)))) http.HandleFunc("/control/dhcp/set_config", postInstall(optionalAuth(ensurePOST(handleDHCPSetConfig)))) http.HandleFunc("/control/dhcp/find_active_dhcp", postInstall(optionalAuth(ensurePOST(handleDHCPFindActiveServer)))) // TODO: move to registerInstallHandlers() http.HandleFunc("/control/install/get_addresses", preInstall(ensureGET(handleInstallGetAddresses))) http.HandleFunc("/control/install/configure", preInstall(ensurePOST(handleInstallConfigure))) }
</s> remove http.Handle("/install.html", preInstallHandler(http.FileServer(box))) </s> add
http.HandleFunc("/control/dhcp/status", postInstall(optionalAuth(ensureGET(handleDHCPStatus)))) http.HandleFunc("/control/dhcp/interfaces", postInstall(optionalAuth(ensureGET(handleDHCPInterfaces)))) http.HandleFunc("/control/dhcp/set_config", postInstall(optionalAuth(ensurePOST(handleDHCPSetConfig)))) http.HandleFunc("/control/dhcp/find_active_dhcp", postInstall(optionalAuth(ensurePOST(handleDHCPFindActiveServer)))) }
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep" ]
Move installation of /install handlers into a separate optional function
https://github.com/AdguardTeam/AdGuardHome/commit/398312cd80537d49b3c8752425ab7fd8358c7bc0
control.go
"upstreams": "Upstreams", "apply_btn": "Apply", "disabled_filtering_toast": "Disabled filtering", "enabled_filtering_toast": "Enabled filtering", "disabled_safe_browsing_toast": "Disabled safebrowsing", "enabled_safe_browsing_toast": "Enabled safebrowsing", "disabled_parental_toast": "Disabled parental control", "enabled_parental_toast": "Enabled parental control", "disabled_safe_search_toast": "Disabled safe search", "enabled_save_search_toast": "Enabled safe search", "enabled_table_header": "Enabled",
</s> remove "blocked_safebrowsing": "Blocked by Safebrowsing", "blocked_adult_websites": "Blocked Adult Websites", </s> add "blocked_safebrowsing": "Blocked by Safe Browsing", "blocked_adult_websites": "Blocked by Parental Control", </s> remove "parental_control": "Parental control", "safe_browsing": "Safe browsing", </s> add "parental_control": "Parental Control", "safe_browsing": "Safe Browsing",
"disabled_safe_browsing_toast": "Disabled Safe Browsing", "enabled_safe_browsing_toast": "Enabled Safe Browsing",
"upstreams": "Upstreams", "apply_btn": "Apply", "disabled_filtering_toast": "Disabled filtering", "enabled_filtering_toast": "Enabled filtering", "disabled_safe_browsing_toast": "Disabled Safe Browsing", "enabled_safe_browsing_toast": "Enabled Safe Browsing", "disabled_safe_browsing_toast": "Disabled Safe Browsing", "enabled_safe_browsing_toast": "Enabled Safe Browsing", "disabled_parental_toast": "Disabled parental control", "enabled_parental_toast": "Enabled parental control", "disabled_safe_search_toast": "Disabled safe search", "enabled_save_search_toast": "Enabled safe search", "enabled_table_header": "Enabled",
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: client: imp en i18n Merge in DNS/adguard-home from en-i18n-safe-browsing to master Squashed commit of the following: commit dd32a58c3761818a10386b4a1d9e6871da59c71e Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 17:31:35 2021 +0300 client: imp en i18n
https://github.com/AdguardTeam/AdGuardHome/commit/39c4999d2d3d78eb6a1de4fc29d464767965043e
client/src/__locales/en.json
"all_queries": "All queries", "show_blocked_responses": "Blocked", "show_whitelisted_responses": "Allowed", "show_processed_responses": "Processed", "blocked_safebrowsing": "Blocked by Safebrowsing", "blocked_adult_websites": "Blocked Adult Websites", "blocked_threats": "Blocked Threats", "allowed": "Allowed", "filtered": "Filtered", "rewritten": "Rewritten", "safe_search": "Safe search",
</s> remove "disabled_safe_browsing_toast": "Disabled safebrowsing", "enabled_safe_browsing_toast": "Enabled safebrowsing", </s> add "disabled_safe_browsing_toast": "Disabled Safe Browsing", "enabled_safe_browsing_toast": "Enabled Safe Browsing", </s> remove "parental_control": "Parental control", "safe_browsing": "Safe browsing", </s> add "parental_control": "Parental Control", "safe_browsing": "Safe Browsing",
"blocked_safebrowsing": "Blocked by Safe Browsing", "blocked_adult_websites": "Blocked by Parental Control",
"all_queries": "All queries", "show_blocked_responses": "Blocked", "show_whitelisted_responses": "Allowed", "show_processed_responses": "Processed", "blocked_safebrowsing": "Blocked by Safe Browsing", "blocked_adult_websites": "Blocked by Parental Control", "blocked_safebrowsing": "Blocked by Safe Browsing", "blocked_adult_websites": "Blocked by Parental Control", "blocked_threats": "Blocked Threats", "allowed": "Allowed", "filtered": "Filtered", "rewritten": "Rewritten", "safe_search": "Safe search",
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: client: imp en i18n Merge in DNS/adguard-home from en-i18n-safe-browsing to master Squashed commit of the following: commit dd32a58c3761818a10386b4a1d9e6871da59c71e Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 17:31:35 2021 +0300 client: imp en i18n
https://github.com/AdguardTeam/AdGuardHome/commit/39c4999d2d3d78eb6a1de4fc29d464767965043e
client/src/__locales/en.json
"filter_allowlist": "WARNING: This action also will exclude the rule \"{{disallowed_rule}}\" from the list of allowed clients.", "last_rule_in_allowlist": "Cannot disallow this client because excluding the rule \"{{disallowed_rule}}\" will DISABLE \"Allowed clients\" list.", "experimental": "Experimental", "use_saved_key": "Use the previously saved key", "parental_control": "Parental control", "safe_browsing": "Safe browsing", "served_from_cache": "{{value}} <i>(served from cache)</i>" }
</s> remove "disabled_safe_browsing_toast": "Disabled safebrowsing", "enabled_safe_browsing_toast": "Enabled safebrowsing", </s> add "disabled_safe_browsing_toast": "Disabled Safe Browsing", "enabled_safe_browsing_toast": "Enabled Safe Browsing", </s> remove "blocked_safebrowsing": "Blocked by Safebrowsing", "blocked_adult_websites": "Blocked Adult Websites", </s> add "blocked_safebrowsing": "Blocked by Safe Browsing", "blocked_adult_websites": "Blocked by Parental Control",
"parental_control": "Parental Control", "safe_browsing": "Safe Browsing",
"filter_allowlist": "WARNING: This action also will exclude the rule \"{{disallowed_rule}}\" from the list of allowed clients.", "last_rule_in_allowlist": "Cannot disallow this client because excluding the rule \"{{disallowed_rule}}\" will DISABLE \"Allowed clients\" list.", "experimental": "Experimental", "use_saved_key": "Use the previously saved key", "parental_control": "Parental Control", "safe_browsing": "Safe Browsing", "parental_control": "Parental Control", "safe_browsing": "Safe Browsing", "served_from_cache": "{{value}} <i>(served from cache)</i>" }
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep" ]
Pull request: client: imp en i18n Merge in DNS/adguard-home from en-i18n-safe-browsing to master Squashed commit of the following: commit dd32a58c3761818a10386b4a1d9e6871da59c71e Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 17:31:35 2021 +0300 client: imp en i18n
https://github.com/AdguardTeam/AdGuardHome/commit/39c4999d2d3d78eb6a1de4fc29d464767965043e
client/src/__locales/en.json
# Don't consider the HTTPS hostname since the enforced HTTPS redirection should # work if the SSL check skipped. See file docker/healthcheck.sh. /^bind_host:/ { host = $2 } /^bind_port:/ { port = $2 } END { if (match(host, ":")) {
</s> remove /^bind_port:/ { port = $2 } END { if (match(host, ":")) { print "http://[" host "]:" port } else { print "http://" host ":" port } } </s> add /^[[:space:]]+address:/ { if (is_http) print "http://" $2 } </s> remove err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err </s> add if config.HTTPConfig.Address.Port() != 0 { err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err } </s> remove } </s> add </s> remove return aghnet.CheckPort("tcp", netip.AddrPortFrom(config.BindHost, uint16(port))) == nil </s> add addrPort := netip.AddrPortFrom(config.HTTPConfig.Address.Addr(), uint16(port)) return aghnet.CheckPort("tcp", addrPort) == nil </s> remove port := config.BindPort </s> add port := int(config.HTTPConfig.Address.Port())
/^[^[:space:]]/ { is_http = /^http:/ }
# Don't consider the HTTPS hostname since the enforced HTTPS redirection should # work if the SSL check skipped. See file docker/healthcheck.sh. /^[^[:space:]]/ { is_http = /^http:/ } /^bind_port:/ { port = $2 } END { if (match(host, ":")) {
[ "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
docker/web-bind.awk
# Don't consider the HTTPS hostname since the enforced HTTPS redirection should # work if the SSL check skipped. See file docker/healthcheck.sh. /^bind_host:/ { host = $2 } /^bind_port:/ { port = $2 } END { if (match(host, ":")) { print "http://[" host "]:" port } else { print "http://" host ":" port } }
</s> remove /^bind_host:/ { host = $2 } </s> add /^[^[:space:]]/ { is_http = /^http:/ } </s> remove port := config.BindPort </s> add port := int(config.HTTPConfig.Address.Port()) </s> remove err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err </s> add if config.HTTPConfig.Address.Port() != 0 { err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err } </s> remove } </s> add </s> remove switch portInt { case 0, config.BindPort: </s> add switch reqPort { case 0, config.HTTPConfig.Address.Port():
/^[[:space:]]+address:/ { if (is_http) print "http://" $2 }
# Don't consider the HTTPS hostname since the enforced HTTPS redirection should # work if the SSL check skipped. See file docker/healthcheck.sh. /^bind_host:/ { host = $2 } /^[[:space:]]+address:/ { if (is_http) print "http://" $2 } /^[[:space:]]+address:/ { if (is_http) print "http://" $2 } /^[[:space:]]+address:/ { if (is_http) print "http://" $2 } /^[[:space:]]+address:/ { if (is_http) print "http://" $2 } /^[[:space:]]+address:/ { if (is_http) print "http://" $2 } /^[[:space:]]+address:/ { if (is_http) print "http://" $2 } /^[[:space:]]+address:/ { if (is_http) print "http://" $2 } /^[[:space:]]+address:/ { if (is_http) print "http://" $2 } /^[[:space:]]+address:/ { if (is_http) print "http://" $2 }
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
docker/web-bind.awk
DHCP bool `yaml:"dhcp"` HostsFile bool `yaml:"hosts"` } // configuration is loaded from YAML // field ordering is important -- yaml fields will mirror ordering from here type configuration struct { // Raw file data to avoid re-reading of configuration file // It's reset after config is parsed fileData []byte
</s> remove // field ordering is important -- yaml fields will mirror ordering from here </s> add // httpConfig is a block with HTTP configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. type httpConfig struct { // Address is the address to serve the web UI on. Address netip.AddrPort // SessionTTL for a web session. // An active session is automatically refreshed once a day. SessionTTL timeutil.Duration `yaml:"session_ttl"` } // dnsConfig is a block with DNS configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. </s> remove // BindHost is the address for the web interface server to listen on. BindHost netip.Addr `yaml:"bind_host"` // BindPort is the port for the web interface server to listen on. BindPort int `yaml:"bind_port"` </s> add // HTTPConfig is the block with http conf. HTTPConfig httpConfig `yaml:"http"` </s> remove if !conf.BindHost.IsValid() { return errors.Error("bind_host is not a valid ip address") </s> add if !conf.HTTPConfig.Address.IsValid() { return errors.Error("http.address is not a valid ip address") </s> remove return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(portInt))) </s> add return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, reqPort)) </s> remove // TTL for a web session (in hours) // An active session is automatically refreshed once a day. WebSessionTTLHours uint32 `yaml:"web_session_ttl"` </s> add
// configuration is loaded from YAML. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary.
DHCP bool `yaml:"dhcp"` HostsFile bool `yaml:"hosts"` } // configuration is loaded from YAML. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. // configuration is loaded from YAML. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. type configuration struct { // Raw file data to avoid re-reading of configuration file // It's reset after config is parsed fileData []byte
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/config.go
// Raw file data to avoid re-reading of configuration file // It's reset after config is parsed fileData []byte // BindHost is the address for the web interface server to listen on. BindHost netip.Addr `yaml:"bind_host"` // BindPort is the port for the web interface server to listen on. BindPort int `yaml:"bind_port"` // Users are the clients capable for accessing the web interface. Users []webUser `yaml:"users"` // AuthAttempts is the maximum number of failed login attempts a user // can do before being blocked. AuthAttempts uint `yaml:"auth_attempts"`
</s> remove // configuration is loaded from YAML // field ordering is important -- yaml fields will mirror ordering from here </s> add // configuration is loaded from YAML. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. </s> remove // field ordering is important -- yaml fields will mirror ordering from here </s> add // httpConfig is a block with HTTP configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. type httpConfig struct { // Address is the address to serve the web UI on. Address netip.AddrPort // SessionTTL for a web session. // An active session is automatically refreshed once a day. SessionTTL timeutil.Duration `yaml:"session_ttl"` } // dnsConfig is a block with DNS configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. </s> remove case config.BindPort: </s> add case config.HTTPConfig.Address.Port(): </s> remove // TTL for a web session (in hours) // An active session is automatically refreshed once a day. WebSessionTTLHours uint32 `yaml:"web_session_ttl"` </s> add </s> remove return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(portInt))) </s> add return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, reqPort))
// HTTPConfig is the block with http conf. HTTPConfig httpConfig `yaml:"http"`
// Raw file data to avoid re-reading of configuration file // It's reset after config is parsed fileData []byte // HTTPConfig is the block with http conf. HTTPConfig httpConfig `yaml:"http"` // HTTPConfig is the block with http conf. HTTPConfig httpConfig `yaml:"http"` // HTTPConfig is the block with http conf. HTTPConfig httpConfig `yaml:"http"` // HTTPConfig is the block with http conf. HTTPConfig httpConfig `yaml:"http"` // HTTPConfig is the block with http conf. HTTPConfig httpConfig `yaml:"http"` // Users are the clients capable for accessing the web interface. Users []webUser `yaml:"users"` // AuthAttempts is the maximum number of failed login attempts a user // can do before being blocked. AuthAttempts uint `yaml:"auth_attempts"`
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/config.go
Theme Theme `yaml:"theme"` // DebugPProf defines if the profiling HTTP handler will listen on :6060. DebugPProf bool `yaml:"debug_pprof"` // TTL for a web session (in hours) // An active session is automatically refreshed once a day. WebSessionTTLHours uint32 `yaml:"web_session_ttl"` DNS dnsConfig `yaml:"dns"` TLS tlsConfigSettings `yaml:"tls"` QueryLog queryLogConfig `yaml:"querylog"` Stats statsConfig `yaml:"statistics"`
</s> remove // field ordering is important -- yaml fields will mirror ordering from here </s> add // httpConfig is a block with HTTP configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. type httpConfig struct { // Address is the address to serve the web UI on. Address netip.AddrPort // SessionTTL for a web session. // An active session is automatically refreshed once a day. SessionTTL timeutil.Duration `yaml:"session_ttl"` } // dnsConfig is a block with DNS configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. </s> remove // BindHost is the address for the web interface server to listen on. BindHost netip.Addr `yaml:"bind_host"` // BindPort is the port for the web interface server to listen on. BindPort int `yaml:"bind_port"` </s> add // HTTPConfig is the block with http conf. HTTPConfig httpConfig `yaml:"http"` </s> remove // configuration is loaded from YAML // field ordering is important -- yaml fields will mirror ordering from here </s> add // configuration is loaded from YAML. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. </s> remove if !conf.BindHost.IsValid() { return errors.Error("bind_host is not a valid ip address") </s> add if !conf.HTTPConfig.Address.IsValid() { return errors.Error("http.address is not a valid ip address") </s> remove return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(portInt))) </s> add return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, reqPort))
Theme Theme `yaml:"theme"` // DebugPProf defines if the profiling HTTP handler will listen on :6060. DebugPProf bool `yaml:"debug_pprof"` DNS dnsConfig `yaml:"dns"` TLS tlsConfigSettings `yaml:"tls"` QueryLog queryLogConfig `yaml:"querylog"` Stats statsConfig `yaml:"statistics"`
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/config.go
SchemaVersion int `yaml:"schema_version"` // keeping last so that users will be less tempted to change it -- used when upgrading between versions } // field ordering is important -- yaml fields will mirror ordering from here type dnsConfig struct { BindHosts []netip.Addr `yaml:"bind_hosts"` Port int `yaml:"port"` // AnonymizeClientIP defines if clients' IP addresses should be anonymized
</s> remove // configuration is loaded from YAML // field ordering is important -- yaml fields will mirror ordering from here </s> add // configuration is loaded from YAML. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. </s> remove // TTL for a web session (in hours) // An active session is automatically refreshed once a day. WebSessionTTLHours uint32 `yaml:"web_session_ttl"` </s> add </s> remove portInt := req.Web.Port port := tcpPort(portInt) </s> add // TODO(a.garipov): Declare all port variables anywhere as uint16. reqPort := uint16(req.Web.Port) port := tcpPort(reqPort) </s> remove printWebAddrs(proto, bindhost.String(), port) </s> add printWebAddrs(proto, bindHost.String(), port) </s> remove HTTPPort int `json:"http_port"` </s> add HTTPPort uint16 `json:"http_port"`
// httpConfig is a block with HTTP configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. type httpConfig struct { // Address is the address to serve the web UI on. Address netip.AddrPort // SessionTTL for a web session. // An active session is automatically refreshed once a day. SessionTTL timeutil.Duration `yaml:"session_ttl"` } // dnsConfig is a block with DNS configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary.
SchemaVersion int `yaml:"schema_version"` // keeping last so that users will be less tempted to change it -- used when upgrading between versions } // httpConfig is a block with HTTP configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. type httpConfig struct { // Address is the address to serve the web UI on. Address netip.AddrPort // SessionTTL for a web session. // An active session is automatically refreshed once a day. SessionTTL timeutil.Duration `yaml:"session_ttl"` } // dnsConfig is a block with DNS configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. type dnsConfig struct { BindHosts []netip.Addr `yaml:"bind_hosts"` Port int `yaml:"port"` // AnonymizeClientIP defines if clients' IP addresses should be anonymized
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/config.go
// config is the global configuration structure. // // TODO(a.garipov, e.burkov): This global is awful and must be removed. var config = &configuration{ BindPort: 3000, BindHost: netip.IPv4Unspecified(), AuthAttempts: 5, AuthBlockMin: 15, WebSessionTTLHours: 30 * 24, DNS: dnsConfig{ BindHosts: []netip.Addr{netip.IPv4Unspecified()}, Port: defaultPortDNS, FilteringConfig: dnsforward.FilteringConfig{ ProtectionEnabled: true, // whether or not use any of filtering features
</s> remove // configuration is loaded from YAML // field ordering is important -- yaml fields will mirror ordering from here </s> add // configuration is loaded from YAML. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. </s> remove return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(portInt))) </s> add return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, reqPort)) </s> remove // BindHost is the address for the web interface server to listen on. BindHost netip.Addr `yaml:"bind_host"` // BindPort is the port for the web interface server to listen on. BindPort int `yaml:"bind_port"` </s> add // HTTPConfig is the block with http conf. HTTPConfig httpConfig `yaml:"http"` </s> remove // field ordering is important -- yaml fields will mirror ordering from here </s> add // httpConfig is a block with HTTP configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. type httpConfig struct { // Address is the address to serve the web UI on. Address netip.AddrPort // SessionTTL for a web session. // An active session is automatically refreshed once a day. SessionTTL timeutil.Duration `yaml:"session_ttl"` } // dnsConfig is a block with DNS configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. </s> remove if !conf.BindHost.IsValid() { return errors.Error("bind_host is not a valid ip address") </s> add if !conf.HTTPConfig.Address.IsValid() { return errors.Error("http.address is not a valid ip address")
AuthAttempts: 5, AuthBlockMin: 15, HTTPConfig: httpConfig{ Address: netip.AddrPortFrom(netip.IPv4Unspecified(), 3000), SessionTTL: timeutil.Duration{Duration: 30 * timeutil.Day}, },
// config is the global configuration structure. // // TODO(a.garipov, e.burkov): This global is awful and must be removed. var config = &configuration{ AuthAttempts: 5, AuthBlockMin: 15, HTTPConfig: httpConfig{ Address: netip.AddrPortFrom(netip.IPv4Unspecified(), 3000), SessionTTL: timeutil.Duration{Duration: 30 * timeutil.Day}, }, AuthAttempts: 5, AuthBlockMin: 15, HTTPConfig: httpConfig{ Address: netip.AddrPortFrom(netip.IPv4Unspecified(), 3000), SessionTTL: timeutil.Duration{Duration: 30 * timeutil.Day}, }, AuthAttempts: 5, AuthBlockMin: 15, HTTPConfig: httpConfig{ Address: netip.AddrPortFrom(netip.IPv4Unspecified(), 3000), SessionTTL: timeutil.Duration{Duration: 30 * timeutil.Day}, }, AuthAttempts: 5, AuthBlockMin: 15, HTTPConfig: httpConfig{ Address: netip.AddrPortFrom(netip.IPv4Unspecified(), 3000), SessionTTL: timeutil.Duration{Duration: 30 * timeutil.Day}, }, AuthAttempts: 5, AuthBlockMin: 15, HTTPConfig: httpConfig{ Address: netip.AddrPortFrom(netip.IPv4Unspecified(), 3000), SessionTTL: timeutil.Duration{Duration: 30 * timeutil.Day}, }, DNS: dnsConfig{ BindHosts: []netip.Addr{netip.IPv4Unspecified()}, Port: defaultPortDNS, FilteringConfig: dnsforward.FilteringConfig{ ProtectionEnabled: true, // whether or not use any of filtering features
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/config.go
// validateBindHosts returns error if any of binding hosts from configuration is // not a valid IP address. func validateBindHosts(conf *configuration) (err error) { if !conf.BindHost.IsValid() { return errors.Error("bind_host is not a valid ip address") } for i, addr := range conf.DNS.BindHosts { if !addr.IsValid() { return fmt.Errorf("dns.bind_hosts at index %d is not a valid ip address", i)
</s> remove // field ordering is important -- yaml fields will mirror ordering from here </s> add // httpConfig is a block with HTTP configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. type httpConfig struct { // Address is the address to serve the web UI on. Address netip.AddrPort // SessionTTL for a web session. // An active session is automatically refreshed once a day. SessionTTL timeutil.Duration `yaml:"session_ttl"` } // dnsConfig is a block with DNS configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. </s> remove addPorts(tcpPorts, tcpPort(config.BindPort)) </s> add addPorts(tcpPorts, tcpPort(config.HTTPConfig.Address.Port())) </s> remove return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(portInt))) </s> add return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, reqPort)) </s> remove // configuration is loaded from YAML // field ordering is important -- yaml fields will mirror ordering from here </s> add // configuration is loaded from YAML. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. </s> remove if opts.bindPort != 0 { config.BindPort = opts.bindPort </s> add bindAddr := opts.bindAddr if bindAddr != (netip.AddrPort{}) { config.HTTPConfig.Address = bindAddr
if !conf.HTTPConfig.Address.IsValid() { return errors.Error("http.address is not a valid ip address")
// validateBindHosts returns error if any of binding hosts from configuration is // not a valid IP address. func validateBindHosts(conf *configuration) (err error) { if !conf.HTTPConfig.Address.IsValid() { return errors.Error("http.address is not a valid ip address") if !conf.HTTPConfig.Address.IsValid() { return errors.Error("http.address is not a valid ip address") } for i, addr := range conf.DNS.BindHosts { if !addr.IsValid() { return fmt.Errorf("dns.bind_hosts at index %d is not a valid ip address", i)
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/config.go
return err } tcpPorts := aghalg.UniqChecker[tcpPort]{} addPorts(tcpPorts, tcpPort(config.BindPort)) udpPorts := aghalg.UniqChecker[udpPort]{} addPorts(udpPorts, udpPort(config.DNS.Port)) if config.TLS.Enabled {
</s> remove addPorts(tcpPorts, tcpPort(config.BindPort)) </s> add addPorts(tcpPorts, tcpPort(config.HTTPConfig.Address.Port())) </s> remove bindhost := config.BindHost if !bindhost.IsUnspecified() { printWebAddrs(proto, bindhost.String(), port) </s> add bindHost := config.HTTPConfig.Address.Addr() if !bindHost.IsUnspecified() { printWebAddrs(proto, bindHost.String(), port) </s> remove if opts.bindHost.IsValid() { config.BindHost = opts.bindHost </s> add return nil </s> remove port := req.DNS.Port </s> add port := uint16(req.DNS.Port) </s> remove if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { </s> add if tlsConfUsesPrivilegedPorts(tlsConf) || config.HTTPConfig.Address.Port() < 1024 || config.DNS.Port < 1024 {
addPorts(tcpPorts, tcpPort(config.HTTPConfig.Address.Port()))
return err } tcpPorts := aghalg.UniqChecker[tcpPort]{} addPorts(tcpPorts, tcpPort(config.HTTPConfig.Address.Port())) udpPorts := aghalg.UniqChecker[udpPort]{} addPorts(udpPorts, udpPort(config.DNS.Port)) if config.TLS.Enabled {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/config.go
Version string `json:"version"` Language string `json:"language"` DNSAddrs []string `json:"dns_addresses"` DNSPort int `json:"dns_port"` HTTPPort int `json:"http_port"` // ProtectionDisabledDuration is the duration of the protection pause in // milliseconds. ProtectionDisabledDuration int64 `json:"protection_disabled_duration"`
</s> remove // BindHost is the address for the web interface server to listen on. BindHost netip.Addr `yaml:"bind_host"` // BindPort is the port for the web interface server to listen on. BindPort int `yaml:"bind_port"` </s> add // HTTPConfig is the block with http conf. HTTPConfig httpConfig `yaml:"http"` </s> remove // field ordering is important -- yaml fields will mirror ordering from here </s> add // httpConfig is a block with HTTP configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. type httpConfig struct { // Address is the address to serve the web UI on. Address netip.AddrPort // SessionTTL for a web session. // An active session is automatically refreshed once a day. SessionTTL timeutil.Duration `yaml:"session_ttl"` } // dnsConfig is a block with DNS configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. </s> remove config.BindHost = req.Web.IP config.BindPort = req.Web.Port </s> add config.HTTPConfig.Address = netip.AddrPortFrom(req.Web.IP, uint16(req.Web.Port)) </s> remove return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(portInt))) </s> add return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, reqPort)) </s> remove BindPort: 3000, BindHost: netip.IPv4Unspecified(), AuthAttempts: 5, AuthBlockMin: 15, WebSessionTTLHours: 30 * 24, </s> add AuthAttempts: 5, AuthBlockMin: 15, HTTPConfig: httpConfig{ Address: netip.AddrPortFrom(netip.IPv4Unspecified(), 3000), SessionTTL: timeutil.Duration{Duration: 30 * timeutil.Day}, },
HTTPPort uint16 `json:"http_port"`
Version string `json:"version"` Language string `json:"language"` DNSAddrs []string `json:"dns_addresses"` DNSPort int `json:"dns_port"` HTTPPort uint16 `json:"http_port"` // ProtectionDisabledDuration is the duration of the protection pause in // milliseconds. ProtectionDisabledDuration int64 `json:"protection_disabled_duration"`
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/control.go
Version: version.Version(), Language: config.Language, DNSAddrs: dnsAddrs, DNSPort: config.DNS.Port, HTTPPort: config.BindPort, ProtectionDisabledDuration: protectionDisabledDuration, ProtectionEnabled: protectionEnabled, IsRunning: isRunning(), } }()
</s> remove BindHost: config.BindHost, BindPort: config.BindPort, </s> add BindHost: config.HTTPConfig.Address.Addr(), BindPort: int(config.HTTPConfig.Address.Port()), </s> remove port := req.DNS.Port </s> add port := uint16(req.DNS.Port) </s> remove BindPort: 3000, BindHost: netip.IPv4Unspecified(), AuthAttempts: 5, AuthBlockMin: 15, WebSessionTTLHours: 30 * 24, </s> add AuthAttempts: 5, AuthBlockMin: 15, HTTPConfig: httpConfig{ Address: netip.AddrPortFrom(netip.IPv4Unspecified(), 3000), SessionTTL: timeutil.Duration{Duration: 30 * timeutil.Day}, }, </s> remove portInt := req.Web.Port port := tcpPort(portInt) </s> add // TODO(a.garipov): Declare all port variables anywhere as uint16. reqPort := uint16(req.Web.Port) port := tcpPort(reqPort)
HTTPPort: config.HTTPConfig.Address.Port(),
Version: version.Version(), Language: config.Language, DNSAddrs: dnsAddrs, DNSPort: config.DNS.Port, HTTPPort: config.HTTPConfig.Address.Port(), ProtectionDisabledDuration: protectionDisabledDuration, ProtectionEnabled: protectionEnabled, IsRunning: isRunning(), } }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/control.go
// be set. func (req *checkConfReq) validateWeb(tcpPorts aghalg.UniqChecker[tcpPort]) (err error) { defer func() { err = errors.Annotate(err, "validating ports: %w") }() portInt := req.Web.Port port := tcpPort(portInt) addPorts(tcpPorts, port) if err = tcpPorts.Validate(); err != nil { // Reset the value for the port to 1 to make sure that validateDNS // doesn't throw the same error, unless the same TCP port is set there // as well.
</s> remove port := req.DNS.Port </s> add port := uint16(req.DNS.Port) </s> remove case config.BindPort: </s> add case config.HTTPConfig.Address.Port(): </s> remove if opts.bindPort != 0 { config.BindPort = opts.bindPort </s> add bindAddr := opts.bindAddr if bindAddr != (netip.AddrPort{}) { config.HTTPConfig.Address = bindAddr </s> remove err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err </s> add if config.HTTPConfig.Address.Port() != 0 { err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err } </s> remove port := config.BindPort </s> add port := int(config.HTTPConfig.Address.Port())
// TODO(a.garipov): Declare all port variables anywhere as uint16. reqPort := uint16(req.Web.Port) port := tcpPort(reqPort)
// be set. func (req *checkConfReq) validateWeb(tcpPorts aghalg.UniqChecker[tcpPort]) (err error) { defer func() { err = errors.Annotate(err, "validating ports: %w") }() // TODO(a.garipov): Declare all port variables anywhere as uint16. reqPort := uint16(req.Web.Port) port := tcpPort(reqPort) // TODO(a.garipov): Declare all port variables anywhere as uint16. reqPort := uint16(req.Web.Port) port := tcpPort(reqPort) addPorts(tcpPorts, port) if err = tcpPorts.Validate(); err != nil { // Reset the value for the port to 1 to make sure that validateDNS // doesn't throw the same error, unless the same TCP port is set there // as well.
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/controlinstall.go
return err } switch portInt { case 0, config.BindPort: return nil default: // Go on and check the port binding only if it's not zero or won't be // unbound after install. }
</s> remove return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(portInt))) </s> add return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, reqPort)) </s> remove case config.BindPort: </s> add case config.HTTPConfig.Address.Port(): </s> remove port := req.DNS.Port </s> add port := uint16(req.DNS.Port) </s> remove port := config.BindPort </s> add port := int(config.HTTPConfig.Address.Port()) </s> remove } </s> add
switch reqPort { case 0, config.HTTPConfig.Address.Port():
return err } switch reqPort { case 0, config.HTTPConfig.Address.Port(): switch reqPort { case 0, config.HTTPConfig.Address.Port(): return nil default: // Go on and check the port binding only if it's not zero or won't be // unbound after install. }
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/controlinstall.go
// Go on and check the port binding only if it's not zero or won't be // unbound after install. } return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(portInt))) } // validateDNS returns error if the DNS part of the initial configuration can't // be set. canAutofix is true if the port can be unbound by AdGuard Home // automatically.
</s> remove switch portInt { case 0, config.BindPort: </s> add switch reqPort { case 0, config.HTTPConfig.Address.Port(): </s> remove case config.BindPort: </s> add case config.HTTPConfig.Address.Port(): </s> remove // field ordering is important -- yaml fields will mirror ordering from here </s> add // httpConfig is a block with HTTP configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. type httpConfig struct { // Address is the address to serve the web UI on. Address netip.AddrPort // SessionTTL for a web session. // An active session is automatically refreshed once a day. SessionTTL timeutil.Duration `yaml:"session_ttl"` } // dnsConfig is a block with DNS configuration params. // // Field ordering is important, YAML fields better not to be reordered, if it's // not absolutely necessary. </s> remove portInt := req.Web.Port port := tcpPort(portInt) </s> add // TODO(a.garipov): Declare all port variables anywhere as uint16. reqPort := uint16(req.Web.Port) port := tcpPort(reqPort) </s> remove return aghnet.CheckPort("tcp", netip.AddrPortFrom(config.BindHost, uint16(port))) == nil </s> add addrPort := netip.AddrPortFrom(config.HTTPConfig.Address.Addr(), uint16(port)) return aghnet.CheckPort("tcp", addrPort) == nil
return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, reqPort))
// Go on and check the port binding only if it's not zero or won't be // unbound after install. } return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, reqPort)) } // validateDNS returns error if the DNS part of the initial configuration can't // be set. canAutofix is true if the port can be unbound by AdGuard Home // automatically.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/controlinstall.go
tcpPorts aghalg.UniqChecker[tcpPort], ) (canAutofix bool, err error) { defer func() { err = errors.Annotate(err, "validating ports: %w") }() port := req.DNS.Port switch port { case 0: return false, nil case config.BindPort: // Go on and only check the UDP port since the TCP one is already bound
</s> remove case config.BindPort: </s> add case config.HTTPConfig.Address.Port(): </s> remove switch portInt { case 0, config.BindPort: </s> add switch reqPort { case 0, config.HTTPConfig.Address.Port(): </s> remove portInt := req.Web.Port port := tcpPort(portInt) </s> add // TODO(a.garipov): Declare all port variables anywhere as uint16. reqPort := uint16(req.Web.Port) port := tcpPort(reqPort) </s> remove return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(portInt))) </s> add return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, reqPort)) </s> remove port := config.BindPort </s> add port := int(config.HTTPConfig.Address.Port())
port := uint16(req.DNS.Port)
tcpPorts aghalg.UniqChecker[tcpPort], ) (canAutofix bool, err error) { defer func() { err = errors.Annotate(err, "validating ports: %w") }() port := uint16(req.DNS.Port) switch port { case 0: return false, nil case config.BindPort: // Go on and only check the UDP port since the TCP one is already bound
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/controlinstall.go
port := req.DNS.Port switch port { case 0: return false, nil case config.BindPort: // Go on and only check the UDP port since the TCP one is already bound // by AdGuard Home for web interface. default: // Check TCP as well. addPorts(tcpPorts, tcpPort(port))
</s> remove port := req.DNS.Port </s> add port := uint16(req.DNS.Port) </s> remove switch portInt { case 0, config.BindPort: </s> add switch reqPort { case 0, config.HTTPConfig.Address.Port(): </s> remove return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(portInt))) </s> add return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, reqPort)) </s> remove portInt := req.Web.Port port := tcpPort(portInt) </s> add // TODO(a.garipov): Declare all port variables anywhere as uint16. reqPort := uint16(req.Web.Port) port := tcpPort(reqPort) </s> remove // BindHost is the address for the web interface server to listen on. BindHost netip.Addr `yaml:"bind_host"` // BindPort is the port for the web interface server to listen on. BindPort int `yaml:"bind_port"` </s> add // HTTPConfig is the block with http conf. HTTPConfig httpConfig `yaml:"http"`
case config.HTTPConfig.Address.Port():
port := req.DNS.Port switch port { case 0: return false, nil case config.HTTPConfig.Address.Port(): // Go on and only check the UDP port since the TCP one is already bound // by AdGuard Home for web interface. default: // Check TCP as well. addPorts(tcpPorts, tcpPort(port))
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/controlinstall.go
// copyInstallSettings copies the installation parameters between two // configuration structures. func copyInstallSettings(dst, src *configuration) { dst.BindHost = src.BindHost dst.BindPort = src.BindPort dst.DNS.BindHosts = src.DNS.BindHosts dst.DNS.Port = src.DNS.Port } // shutdownTimeout is the timeout for shutting HTTP server down operation.
</s> remove err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err </s> add if config.HTTPConfig.Address.Port() != 0 { err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err } </s> remove if opts.bindPort != 0 { config.BindPort = opts.bindPort </s> add bindAddr := opts.bindAddr if bindAddr != (netip.AddrPort{}) { config.HTTPConfig.Address = bindAddr </s> remove portInt := req.Web.Port port := tcpPort(portInt) </s> add // TODO(a.garipov): Declare all port variables anywhere as uint16. reqPort := uint16(req.Web.Port) port := tcpPort(reqPort) </s> remove config.BindHost = req.Web.IP config.BindPort = req.Web.Port </s> add config.HTTPConfig.Address = netip.AddrPortFrom(req.Web.IP, uint16(req.Web.Port)) </s> remove const currentSchemaVersion = 22 </s> add const currentSchemaVersion = 23
dst.HTTPConfig = src.HTTPConfig
// copyInstallSettings copies the installation parameters between two // configuration structures. func copyInstallSettings(dst, src *configuration) { dst.HTTPConfig = src.HTTPConfig dst.HTTPConfig = src.HTTPConfig dst.DNS.BindHosts = src.DNS.BindHosts dst.DNS.Port = src.DNS.Port } // shutdownTimeout is the timeout for shutting HTTP server down operation.
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/controlinstall.go
curConfig := &configuration{} copyInstallSettings(curConfig, config) Context.firstRun = false config.BindHost = req.Web.IP config.BindPort = req.Web.Port config.DNS.BindHosts = []netip.Addr{req.DNS.IP} config.DNS.Port = req.DNS.Port // TODO(e.burkov): StartMods() should be put in a separate goroutine at the // moment we'll allow setting up TLS in the initial configuration or the
</s> remove restartHTTP = config.BindHost != req.Web.IP || config.BindPort != req.Web.Port </s> add addrPort := config.HTTPConfig.Address restartHTTP = addrPort.Addr() != req.Web.IP || int(addrPort.Port()) != req.Web.Port </s> remove // Rewrite deprecated options. bindAddr := opts.bindAddr if bindAddr.IsValid() { config.BindHost = bindAddr.Addr() config.BindPort = int(bindAddr.Port()) </s> add if opts.bindPort != 0 { config.HTTPConfig.Address = netip.AddrPortFrom( config.HTTPConfig.Address.Addr(), uint16(opts.bindPort), ) </s> remove port := config.BindPort </s> add port := int(config.HTTPConfig.Address.Port()) </s> remove dst.BindHost = src.BindHost dst.BindPort = src.BindPort </s> add dst.HTTPConfig = src.HTTPConfig </s> remove portInt := req.Web.Port port := tcpPort(portInt) </s> add // TODO(a.garipov): Declare all port variables anywhere as uint16. reqPort := uint16(req.Web.Port) port := tcpPort(reqPort)
config.HTTPConfig.Address = netip.AddrPortFrom(req.Web.IP, uint16(req.Web.Port))
curConfig := &configuration{} copyInstallSettings(curConfig, config) Context.firstRun = false config.HTTPConfig.Address = netip.AddrPortFrom(req.Web.IP, uint16(req.Web.Port)) config.HTTPConfig.Address = netip.AddrPortFrom(req.Web.IP, uint16(req.Web.Port)) config.DNS.BindHosts = []netip.Addr{req.DNS.IP} config.DNS.Port = req.DNS.Port // TODO(e.burkov): StartMods() should be put in a separate goroutine at the // moment we'll allow setting up TLS in the initial configuration or the
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/controlinstall.go
if req.Web.Port == 0 || req.DNS.Port == 0 { return nil, false, errors.Error("ports cannot be 0") } restartHTTP = config.BindHost != req.Web.IP || config.BindPort != req.Web.Port if restartHTTP { err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(req.Web.Port))) if err != nil { return nil, false, fmt.Errorf( "checking address %s:%d: %w",
</s> remove if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { </s> add if tlsConfUsesPrivilegedPorts(tlsConf) || config.HTTPConfig.Address.Port() < 1024 || config.DNS.Port < 1024 { </s> remove err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err </s> add if config.HTTPConfig.Address.Port() != 0 { err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err } </s> remove // Rewrite deprecated options. bindAddr := opts.bindAddr if bindAddr.IsValid() { config.BindHost = bindAddr.Addr() config.BindPort = int(bindAddr.Port()) </s> add if opts.bindPort != 0 { config.HTTPConfig.Address = netip.AddrPortFrom( config.HTTPConfig.Address.Addr(), uint16(opts.bindPort), ) </s> remove if opts.bindPort != 0 { config.BindPort = opts.bindPort </s> add bindAddr := opts.bindAddr if bindAddr != (netip.AddrPort{}) { config.HTTPConfig.Address = bindAddr </s> remove return aghnet.CheckPort("tcp", netip.AddrPortFrom(config.BindHost, uint16(port))) == nil </s> add addrPort := netip.AddrPortFrom(config.HTTPConfig.Address.Addr(), uint16(port)) return aghnet.CheckPort("tcp", addrPort) == nil
addrPort := config.HTTPConfig.Address restartHTTP = addrPort.Addr() != req.Web.IP || int(addrPort.Port()) != req.Web.Port
if req.Web.Port == 0 || req.DNS.Port == 0 { return nil, false, errors.Error("ports cannot be 0") } addrPort := config.HTTPConfig.Address restartHTTP = addrPort.Addr() != req.Web.IP || int(addrPort.Port()) != req.Web.Port if restartHTTP { err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(req.Web.Port))) if err != nil { return nil, false, fmt.Errorf( "checking address %s:%d: %w",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/controlinstall.go
tlsConf := &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err) } }
</s> remove restartHTTP = config.BindHost != req.Web.IP || config.BindPort != req.Web.Port </s> add addrPort := config.HTTPConfig.Address restartHTTP = addrPort.Addr() != req.Web.IP || int(addrPort.Port()) != req.Web.Port </s> remove if opts.bindPort != 0 { config.BindPort = opts.bindPort </s> add bindAddr := opts.bindAddr if bindAddr != (netip.AddrPort{}) { config.HTTPConfig.Address = bindAddr </s> remove return aghnet.CheckPort("tcp", netip.AddrPortFrom(config.BindHost, uint16(port))) == nil </s> add addrPort := netip.AddrPortFrom(config.HTTPConfig.Address.Addr(), uint16(port)) return aghnet.CheckPort("tcp", addrPort) == nil </s> remove err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err </s> add if config.HTTPConfig.Address.Port() != 0 { err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err } </s> remove // Rewrite deprecated options. bindAddr := opts.bindAddr if bindAddr.IsValid() { config.BindHost = bindAddr.Addr() config.BindPort = int(bindAddr.Port()) </s> add if opts.bindPort != 0 { config.HTTPConfig.Address = netip.AddrPortFrom( config.HTTPConfig.Address.Addr(), uint16(opts.bindPort), )
if tlsConfUsesPrivilegedPorts(tlsConf) || config.HTTPConfig.Address.Port() < 1024 || config.DNS.Port < 1024 {
tlsConf := &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.HTTPConfig.Address.Port() < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err) } }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/controlupdate.go
} // setupBindOpts overrides bind host/port from the opts. func setupBindOpts(opts options) (err error) { if opts.bindPort != 0 { config.BindPort = opts.bindPort err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err
</s> remove err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err </s> add if config.HTTPConfig.Address.Port() != 0 { err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err } </s> remove // Rewrite deprecated options. bindAddr := opts.bindAddr if bindAddr.IsValid() { config.BindHost = bindAddr.Addr() config.BindPort = int(bindAddr.Port()) </s> add if opts.bindPort != 0 { config.HTTPConfig.Address = netip.AddrPortFrom( config.HTTPConfig.Address.Addr(), uint16(opts.bindPort), ) </s> remove } </s> add </s> remove portInt := req.Web.Port port := tcpPort(portInt) </s> add // TODO(a.garipov): Declare all port variables anywhere as uint16. reqPort := uint16(req.Web.Port) port := tcpPort(reqPort) </s> remove restartHTTP = config.BindHost != req.Web.IP || config.BindPort != req.Web.Port </s> add addrPort := config.HTTPConfig.Address restartHTTP = addrPort.Addr() != req.Web.IP || int(addrPort.Port()) != req.Web.Port
bindAddr := opts.bindAddr if bindAddr != (netip.AddrPort{}) { config.HTTPConfig.Address = bindAddr
} // setupBindOpts overrides bind host/port from the opts. func setupBindOpts(opts options) (err error) { bindAddr := opts.bindAddr if bindAddr != (netip.AddrPort{}) { config.HTTPConfig.Address = bindAddr bindAddr := opts.bindAddr if bindAddr != (netip.AddrPort{}) { config.HTTPConfig.Address = bindAddr err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/home.go
func setupBindOpts(opts options) (err error) { if opts.bindPort != 0 { config.BindPort = opts.bindPort err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err } } if opts.bindHost.IsValid() { config.BindHost = opts.bindHost
</s> remove if opts.bindPort != 0 { config.BindPort = opts.bindPort </s> add bindAddr := opts.bindAddr if bindAddr != (netip.AddrPort{}) { config.HTTPConfig.Address = bindAddr </s> remove // Rewrite deprecated options. bindAddr := opts.bindAddr if bindAddr.IsValid() { config.BindHost = bindAddr.Addr() config.BindPort = int(bindAddr.Port()) </s> add if opts.bindPort != 0 { config.HTTPConfig.Address = netip.AddrPortFrom( config.HTTPConfig.Address.Addr(), uint16(opts.bindPort), ) </s> remove } </s> add </s> remove if opts.bindHost.IsValid() { config.BindHost = opts.bindHost </s> add return nil </s> remove restartHTTP = config.BindHost != req.Web.IP || config.BindPort != req.Web.Port </s> add addrPort := config.HTTPConfig.Address restartHTTP = addrPort.Addr() != req.Web.IP || int(addrPort.Port()) != req.Web.Port
if config.HTTPConfig.Address.Port() != 0 { err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err }
func setupBindOpts(opts options) (err error) { if opts.bindPort != 0 { config.BindPort = opts.bindPort if config.HTTPConfig.Address.Port() != 0 { err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err } if config.HTTPConfig.Address.Port() != 0 { err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err } if config.HTTPConfig.Address.Port() != 0 { err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err } if config.HTTPConfig.Address.Port() != 0 { err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err } } } if opts.bindHost.IsValid() { config.BindHost = opts.bindHost
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/home.go
if err != nil { // Don't wrap the error, because it's informative enough as is. return err } } if opts.bindHost.IsValid() { config.BindHost = opts.bindHost }
</s> remove err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err </s> add if config.HTTPConfig.Address.Port() != 0 { err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err } </s> remove // Rewrite deprecated options. bindAddr := opts.bindAddr if bindAddr.IsValid() { config.BindHost = bindAddr.Addr() config.BindPort = int(bindAddr.Port()) </s> add if opts.bindPort != 0 { config.HTTPConfig.Address = netip.AddrPortFrom( config.HTTPConfig.Address.Addr(), uint16(opts.bindPort), ) </s> remove if opts.bindPort != 0 { config.BindPort = opts.bindPort </s> add bindAddr := opts.bindAddr if bindAddr != (netip.AddrPort{}) { config.HTTPConfig.Address = bindAddr </s> remove if opts.bindHost.IsValid() { config.BindHost = opts.bindHost </s> add return nil
if err != nil { // Don't wrap the error, because it's informative enough as is. return err } if opts.bindHost.IsValid() { config.BindHost = opts.bindHost }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/home.go
return err } } if opts.bindHost.IsValid() { config.BindHost = opts.bindHost } // Rewrite deprecated options. bindAddr := opts.bindAddr if bindAddr.IsValid() {
</s> remove // Rewrite deprecated options. bindAddr := opts.bindAddr if bindAddr.IsValid() { config.BindHost = bindAddr.Addr() config.BindPort = int(bindAddr.Port()) </s> add if opts.bindPort != 0 { config.HTTPConfig.Address = netip.AddrPortFrom( config.HTTPConfig.Address.Addr(), uint16(opts.bindPort), ) </s> remove } </s> add </s> remove if opts.bindPort != 0 { config.BindPort = opts.bindPort </s> add bindAddr := opts.bindAddr if bindAddr != (netip.AddrPort{}) { config.HTTPConfig.Address = bindAddr </s> remove err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err </s> add if config.HTTPConfig.Address.Port() != 0 { err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err }
return nil
return err } } return nil return nil } // Rewrite deprecated options. bindAddr := opts.bindAddr if bindAddr.IsValid() {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/home.go
if opts.bindHost.IsValid() { config.BindHost = opts.bindHost } // Rewrite deprecated options. bindAddr := opts.bindAddr if bindAddr.IsValid() { config.BindHost = bindAddr.Addr() config.BindPort = int(bindAddr.Port()) err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err
</s> remove err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err </s> add if config.HTTPConfig.Address.Port() != 0 { err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err } </s> remove } </s> add </s> remove if opts.bindHost.IsValid() { config.BindHost = opts.bindHost </s> add return nil </s> remove if opts.bindPort != 0 { config.BindPort = opts.bindPort </s> add bindAddr := opts.bindAddr if bindAddr != (netip.AddrPort{}) { config.HTTPConfig.Address = bindAddr </s> remove restartHTTP = config.BindHost != req.Web.IP || config.BindPort != req.Web.Port </s> add addrPort := config.HTTPConfig.Address restartHTTP = addrPort.Addr() != req.Web.IP || int(addrPort.Port()) != req.Web.Port
if opts.bindPort != 0 { config.HTTPConfig.Address = netip.AddrPortFrom( config.HTTPConfig.Address.Addr(), uint16(opts.bindPort), )
if opts.bindHost.IsValid() { config.BindHost = opts.bindHost } if opts.bindPort != 0 { config.HTTPConfig.Address = netip.AddrPortFrom( config.HTTPConfig.Address.Addr(), uint16(opts.bindPort), ) if opts.bindPort != 0 { config.HTTPConfig.Address = netip.AddrPortFrom( config.HTTPConfig.Address.Addr(), uint16(opts.bindPort), ) if opts.bindPort != 0 { config.HTTPConfig.Address = netip.AddrPortFrom( config.HTTPConfig.Address.Addr(), uint16(opts.bindPort), ) if opts.bindPort != 0 { config.HTTPConfig.Address = netip.AddrPortFrom( config.HTTPConfig.Address.Addr(), uint16(opts.bindPort), ) if opts.bindPort != 0 { config.HTTPConfig.Address = netip.AddrPortFrom( config.HTTPConfig.Address.Addr(), uint16(opts.bindPort), ) err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/home.go
return err } } return nil } // setupDNSFilteringConf sets up DNS filtering configuration settings.
</s> remove return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(portInt))) </s> add return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, reqPort)) </s> remove if opts.bindHost.IsValid() { config.BindHost = opts.bindHost </s> add return nil </s> remove } </s> add </s> remove return aghnet.CheckPort("tcp", netip.AddrPortFrom(config.BindHost, uint16(port))) == nil </s> add addrPort := netip.AddrPortFrom(config.HTTPConfig.Address.Addr(), uint16(port)) return aghnet.CheckPort("tcp", addrPort) == nil </s> remove err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err </s> add if config.HTTPConfig.Address.Port() != 0 { err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err }
if opts.bindHost.IsValid() { config.HTTPConfig.Address = netip.AddrPortFrom( opts.bindHost, config.HTTPConfig.Address.Port(), ) }
return err } } if opts.bindHost.IsValid() { config.HTTPConfig.Address = netip.AddrPortFrom( opts.bindHost, config.HTTPConfig.Address.Port(), ) } return nil } // setupDNSFilteringConf sets up DNS filtering configuration settings.
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/home.go
// checkPorts is a helper for ports validation in config. func checkPorts() (err error) { tcpPorts := aghalg.UniqChecker[tcpPort]{} addPorts(tcpPorts, tcpPort(config.BindPort)) udpPorts := aghalg.UniqChecker[udpPort]{} addPorts(udpPorts, udpPort(config.DNS.Port)) if config.TLS.Enabled {
</s> remove addPorts(tcpPorts, tcpPort(config.BindPort)) </s> add addPorts(tcpPorts, tcpPort(config.HTTPConfig.Address.Port())) </s> remove if !conf.BindHost.IsValid() { return errors.Error("bind_host is not a valid ip address") </s> add if !conf.HTTPConfig.Address.IsValid() { return errors.Error("http.address is not a valid ip address") </s> remove if opts.bindPort != 0 { config.BindPort = opts.bindPort </s> add bindAddr := opts.bindAddr if bindAddr != (netip.AddrPort{}) { config.HTTPConfig.Address = bindAddr </s> remove portInt := req.Web.Port port := tcpPort(portInt) </s> add // TODO(a.garipov): Declare all port variables anywhere as uint16. reqPort := uint16(req.Web.Port) port := tcpPort(reqPort) </s> remove err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err </s> add if config.HTTPConfig.Address.Port() != 0 { err = checkPorts() if err != nil { // Don't wrap the error, because it's informative enough as is. return err }
addPorts(tcpPorts, tcpPort(config.HTTPConfig.Address.Port()))
// checkPorts is a helper for ports validation in config. func checkPorts() (err error) { tcpPorts := aghalg.UniqChecker[tcpPort]{} addPorts(tcpPorts, tcpPort(config.HTTPConfig.Address.Port())) udpPorts := aghalg.UniqChecker[udpPort]{} addPorts(udpPorts, udpPort(config.DNS.Port)) if config.TLS.Enabled {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/home.go
} webConf := webConfig{ firstRun: Context.firstRun, BindHost: config.BindHost, BindPort: config.BindPort, ReadTimeout: readTimeout, ReadHeaderTimeout: readHdrTimeout, WriteTimeout: writeTimeout,
</s> remove HTTPPort: config.BindPort, </s> add HTTPPort: config.HTTPConfig.Address.Port(), </s> remove BindPort: 3000, BindHost: netip.IPv4Unspecified(), AuthAttempts: 5, AuthBlockMin: 15, WebSessionTTLHours: 30 * 24, </s> add AuthAttempts: 5, AuthBlockMin: 15, HTTPConfig: httpConfig{ Address: netip.AddrPortFrom(netip.IPv4Unspecified(), 3000), SessionTTL: timeutil.Duration{Duration: 30 * timeutil.Day}, }, </s> remove printWebAddrs(proto, addr.String(), config.BindPort) </s> add printWebAddrs(proto, addr.String(), port) </s> remove bindhost := config.BindHost if !bindhost.IsUnspecified() { printWebAddrs(proto, bindhost.String(), port) </s> add bindHost := config.HTTPConfig.Address.Addr() if !bindHost.IsUnspecified() { printWebAddrs(proto, bindHost.String(), port)
BindHost: config.HTTPConfig.Address.Addr(), BindPort: int(config.HTTPConfig.Address.Port()),
} webConf := webConfig{ firstRun: Context.firstRun, BindHost: config.HTTPConfig.Address.Addr(), BindPort: int(config.HTTPConfig.Address.Port()), BindHost: config.HTTPConfig.Address.Addr(), BindPort: int(config.HTTPConfig.Address.Port()), ReadTimeout: readTimeout, ReadHeaderTimeout: readHdrTimeout, WriteTimeout: writeTimeout,
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/home.go
} else { log.Info("authratelimiter is disabled") } sessionTTL := config.WebSessionTTLHours * 60 * 60 auth = InitAuth(sessFilename, config.Users, sessionTTL, rateLimiter) if auth == nil { return nil, errors.Error("initializing auth module failed") } config.Users = nil
</s> remove restartHTTP = config.BindHost != req.Web.IP || config.BindPort != req.Web.Port </s> add addrPort := config.HTTPConfig.Address restartHTTP = addrPort.Addr() != req.Web.IP || int(addrPort.Port()) != req.Web.Port </s> remove port := config.BindPort </s> add port := int(config.HTTPConfig.Address.Port()) </s> remove /^bind_port:/ { port = $2 } END { if (match(host, ":")) { print "http://[" host "]:" port } else { print "http://" host ":" port } } </s> add /^[[:space:]]+address:/ { if (is_http) print "http://" $2 } </s> remove if opts.bindHost.IsValid() { config.BindHost = opts.bindHost </s> add return nil </s> remove return aghnet.CheckPort("tcp", netip.AddrPortFrom(config.BindHost, uint16(port))) == nil </s> add addrPort := netip.AddrPortFrom(config.HTTPConfig.Address.Addr(), uint16(port)) return aghnet.CheckPort("tcp", addrPort) == nil
sessionTTL := config.HTTPConfig.SessionTTL.Seconds() auth = InitAuth(sessFilename, config.Users, uint32(sessionTTL), rateLimiter)
} else { log.Info("authratelimiter is disabled") } sessionTTL := config.HTTPConfig.SessionTTL.Seconds() auth = InitAuth(sessFilename, config.Users, uint32(sessionTTL), rateLimiter) sessionTTL := config.HTTPConfig.SessionTTL.Seconds() auth = InitAuth(sessFilename, config.Users, uint32(sessionTTL), rateLimiter) if auth == nil { return nil, errors.Error("initializing auth module failed") } config.Users = nil
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: home: http conf Updates #2860. Squashed commit of the following: commit 0d55a99d5c0b9f1d8c9497775dd69929e5091eaa Merge: 73a203ac8 d4a4bda64 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:25:36 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 73a203ac8acf083fa289015e1f301d05bf320ea7 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 16:21:48 2023 +0400 home: imp docs commit a4819ace94bfe4427f70f1b8341c9babc9234740 Author: Dimitry Kolyshev <[email protected]> Date: Thu Jun 29 11:45:30 2023 +0400 snap: imp script commit b0913c7ac5c6c46d6a73790fd57d8c5f9d7ace75 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 17:34:03 2023 +0400 all: docs commit 14820d6d56f958081d9f236277fd34f356bdab33 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:21:43 2023 +0400 home: imp tests commit 9db800d3ce39c36da7959e37b4a46736f4217e5c Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 13:17:34 2023 +0400 all: docs commit 9174a0ae710da51d85b4e1b1af79eda6a61dd3a2 Merge: ca8c4ae95 d88181343 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:19:01 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf # Conflicts: # CHANGELOG.md # internal/home/upgrade.go # internal/home/upgrade_test.go commit ca8c4ae954ece25d78ef2f873bb3ba71fa4b8fa9 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 10:07:15 2023 +0400 snap: imp script commit d84473f8e07b2c6e65023613eb4032fd01951521 Author: Dimitry Kolyshev <[email protected]> Date: Wed Jun 28 09:59:57 2023 +0400 snap: imp script commit 8a0808e42ddbff7d9d3345d758f91b14bb4453be Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 15:03:53 2023 +0400 home: http conf commit e8fbb89cc5748f9d8fa4be9e702756bd8b869de9 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 14:59:37 2023 +0400 home: imp code commit 46541aabc421118562d564675dfd7e594d2056aa Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:36:14 2023 +0400 snap: bind port commit cecda5fcfd8c473db42f235b4f586b2193086997 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 12:12:39 2023 +0400 docker: bind port commit 8d8945b70366c6b018616a32421c77eb281a6ea1 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:06:32 2023 +0400 home: imp code commit ae5e8c1c4333d7b752c08605d80e41f55ee50e59 Author: Dimitry Kolyshev <[email protected]> Date: Tue Jun 27 11:02:09 2023 +0400 home: imp code commit c9ee460f37e32941b84ea5fa94d21b186d6dd82b Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 17:11:10 2023 +0400 home: imp code commit 44c72445112ef38d6ec9c25b197c119edd6c959f Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:52:19 2023 +0400 all: docs commit e3bf5faeb748f347b1202a496788739ff9219ed0 Merge: 38cc0f639 e7e638443 Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:39:12 2023 +0400 Merge remote-tracking branch 'origin/master' into http-yaml-conf commit 38cc0f6399040f1fa39d9da31ad6db65a6bdd4cc Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:38:17 2023 +0400 snap: bind port commit 3b9cb9e8cc89a67e55cecc7a2040c150f8675b4c Author: Dimitry Kolyshev <[email protected]> Date: Mon Jun 26 11:25:03 2023 +0400 docker: bind port ... and 4 more commits
https://github.com/AdguardTeam/AdGuardHome/commit/39f5c50acd9da08dca22a0a3170f3f47446210df
internal/home/home.go