docstring_tokens
stringlengths
18
16.9k
code_tokens
stringlengths
75
1.81M
html_url
stringlengths
74
116
file_name
stringlengths
3
311
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> return <mask> } <mask> <mask> h.ServeHTTP(w, r) <mask> }) <mask> } <mask> <mask> // wrapIndexBeta returns handler that deals with new client. <mask> func (web *Web) wrapIndexBeta(http.Handler) (wrapped http.Handler) { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove // We don't use an agherr.Error to avoid the import cycle since aghtests // used to provide the utilities for testing which agherr (and any other // testable package) should be able to use. </s> add </s> remove defer agherr.Annotate("normalizing %q: %w", &err, hostname) </s> add defer func() { err = errors.Annotate(err, "normalizing %q: %w", hostname) }() </s> remove defer agherr.Annotate("invalid ip range: %w", &err) </s> add defer func() { err = errors.Annotate(err, "invalid ip range: %w") }() </s> remove defer agherr.Annotate("validating domain name %q: %w", &err, name) </s> add defer func() { err = errors.Annotate(err, "validating domain name %q: %w", name) }() </s> remove return nil, agherr.Error("invalid ip") </s> add return nil, errors.Error("invalid ip") </s> remove defer agherr.Annotate("validating label %q: %w", &err, label) </s> add defer func() { err = errors.Annotate(err, "validating label %q: %w", label) }()
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/middlewares.go
keep keep keep keep replace keep keep keep keep keep
<mask> "encoding/binary" <mask> "net" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" <mask> "github.com/AdguardTeam/golibs/cache" <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "errors" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> add "github.com/AdguardTeam/golibs/errors"
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/rdns.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> // workerLoop handles incoming IP addresses from ipChan and adds it into <mask> // clients. <mask> func (r *RDNS) workerLoop() { <mask> defer agherr.LogPanic("rdns") <mask> <mask> for ip := range r.ipCh { <mask> host, err := r.exchanger.Exchange(ip) <mask> if err != nil { <mask> log.Debug("rdns: resolving %q: %s", ip, err) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer f.Close() </s> add defer func() { derr := f.Close() if derr != nil { log.Error("etchostscontainer: closing file: %s", err) } }() </s> remove defer agherr.Annotate("invalid ip range: %w", &err) </s> add defer func() { err = errors.Annotate(err, "invalid ip range: %w") }() </s> remove defer agherr.Annotate("validating domain name %q: %w", &err, name) </s> add defer func() { err = errors.Annotate(err, "validating domain name %q: %w", name) }() </s> remove err := e.Encode(entry) </s> add err = e.Encode(entry) </s> remove defer agherr.Annotate("dhcpv4: adding static lease: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: adding static lease: %w") }() </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation)
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/rdns.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> import ( <mask> "bytes" <mask> "encoding/binary" <mask> "errors" <mask> "net" <mask> "sync" <mask> "testing" <mask> "time" <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/rdns_test.go
keep keep add keep keep keep keep keep
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghtest" <mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/AdguardTeam/golibs/cache" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/miekg/dns" <mask> "github.com/stretchr/testify/assert" <mask> ) <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors"
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/rdns_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> "2a00:1450:400c:c06::93": {"ipv6.domain"}, <mask> }, <mask> } <mask> errUpstream := &aghtest.TestErrUpstream{ <mask> Err: errors.New("1234"), <mask> } <mask> <mask> testCases := []struct { <mask> ups upstream.Upstream <mask> wantLog string </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove upstreamErr := agherr.Error("upstream error") </s> add upstreamErr := errors.Error("upstream error") </s> remove defer f.Close() </s> add defer func() { derr := f.Close() if derr != nil { log.Error("etchostscontainer: closing file: %s", err) } }() </s> remove outputName := filepath.Join(outdir, inputNameOnly) </s> add var name string name, err = tarGzFileUnpackOne(outDir, tarReader, hdr) </s> remove var files []string var err2 error var zr io.ReadCloser for _, zf := range r.File { zr, err = zf.Open() </s> add for _, zf := range zrc.File { var name string name, err = zipFileUnpackOne(outDir, zf) </s> remove defer agherr.Annotate("parsing %q: %w", &err, host) </s> add defer func() { err = errors.Annotate(err, "parsing %q: %w", host) }() </s> remove defer agherr.Annotate("invalid option string %q: %w", &err, s) </s> add defer func() { err = errors.Annotate(err, "invalid option string %q: %w", s) }()
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/rdns_test.go
keep keep keep replace keep keep keep keep keep
<mask> package home <mask> <mask> import ( <mask> "errors" <mask> "fmt" <mask> "io/fs" <mask> "os" <mask> "runtime" <mask> "strconv" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/service.go
keep add keep keep keep keep
<mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghos" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/kardianos/service" <mask> ) <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/service.go
keep keep keep keep replace keep keep keep keep keep
<mask> "crypto/x509" <mask> "encoding/base64" <mask> "encoding/json" <mask> "encoding/pem" <mask> "errors" <mask> "fmt" <mask> "net/http" <mask> "os" <mask> "path/filepath" <mask> "reflect" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/tls.go
keep keep keep add keep keep keep keep keep keep
<mask> "strings" <mask> "sync" <mask> "time" <mask> <mask> "github.com/AdguardTeam/golibs/log" <mask> "golang.org/x/sys/cpu" <mask> ) <mask> <mask> var tlsWebHandlersRegistered = false <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "errors" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/tls.go
keep keep keep keep replace keep keep keep keep keep
<mask> for _, cert := range certs { <mask> parsed, err := x509.ParseCertificate(cert.Bytes) <mask> if err != nil { <mask> data.WarningValidation = fmt.Sprintf("Failed to parse certificate: %s", err) <mask> return errors.New(data.WarningValidation) <mask> } <mask> parsedCerts = append(parsedCerts, parsed) <mask> } <mask> <mask> if len(parsedCerts) == 0 { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove err := e.Encode(entry) </s> add err = e.Encode(entry) </s> remove return nil, errors.New("couldn't find any legible interface") </s> add return nil, errors.Error("couldn't find any legible interface") </s> remove defer f.Close() fileReadCloser, err := aghio.LimitReadCloser(f, MaxFileSize) </s> add defer func() { derr := f.Close() if derr != nil { log.Error("glinet: closing file: %s", err) } }() fileReader, err := aghio.LimitReader(f, MaxFileSize)
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/tls.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> if len(parsedCerts) == 0 { <mask> data.WarningValidation = "You have specified an empty certificate" <mask> return errors.New(data.WarningValidation) <mask> } <mask> <mask> data.ValidCert = true <mask> <mask> // spew.Dump(parsedCerts) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove func (l *queryLog) flushToFile(buffer []*logEntry) error { </s> add func (l *queryLog) flushToFile(buffer []*logEntry) (err error) { </s> remove defer agherr.Annotate("normalizing %q: %w", &err, hostname) </s> add defer func() { err = errors.Annotate(err, "normalizing %q: %w", hostname) }() </s> remove if len(errors) != 0 { return agherr.Many("closing ipsets", errors...) </s> add if len(errs) != 0 { return errors.List("closing ipsets", errs...)
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/tls.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> if key == nil { <mask> data.WarningValidation = "No valid keys were found" <mask> return errors.New(data.WarningValidation) <mask> } <mask> <mask> // parse the decoded key <mask> _, keytype, err := parsePrivateKey(key.Bytes) <mask> if err != nil { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove return nil, "", errors.New("tls: found unknown private key type in PKCS#8 wrapping") </s> add return nil, "", errors.Error("tls: found unknown private key type in PKCS#8 wrapping") </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove } </s> add } else if err != nil { err = fmt.Errorf("tarReader.Next(): %w", err) </s> remove return nil, "", errors.New("tls: failed to parse private key") </s> add return nil, "", errors.Error("tls: failed to parse private key")
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/tls.go
keep keep keep keep replace keep keep keep keep keep
<mask> // parse the decoded key <mask> _, keytype, err := parsePrivateKey(key.Bytes) <mask> if err != nil { <mask> data.WarningValidation = fmt.Sprintf("Failed to parse private key: %s", err) <mask> return errors.New(data.WarningValidation) <mask> } <mask> <mask> data.ValidKey = true <mask> data.KeyType = keytype <mask> return nil </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove return nil, "", errors.New("tls: failed to parse private key") </s> add return nil, "", errors.Error("tls: failed to parse private key") </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove return nil, "", errors.New("tls: found unknown private key type in PKCS#8 wrapping") </s> add return nil, "", errors.Error("tls: found unknown private key type in PKCS#8 wrapping") </s> remove err := e.Encode(entry) </s> add err = e.Encode(entry)
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/tls.go
keep keep keep keep replace keep keep keep keep keep
<mask> return key, "RSA", nil <mask> case *ecdsa.PrivateKey: <mask> return key, "ECDSA", nil <mask> default: <mask> return nil, "", errors.New("tls: found unknown private key type in PKCS#8 wrapping") <mask> } <mask> } <mask> <mask> if key, err := x509.ParseECPrivateKey(der); err == nil { <mask> return key, "ECDSA", nil </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return nil, "", errors.New("tls: failed to parse private key") </s> add return nil, "", errors.Error("tls: failed to parse private key") </s> remove log.Debug("updater: created directory %q", outputName) </s> add fi := zf.FileInfo() name = fi.Name() if name == "" { return "", nil } </s> remove return agherr.Error("no client ip") </s> add return errors.Error("no client ip") </s> remove continue } else if header.Typeflag != tar.TypeReg { log.Debug("updater: %s: unknown file type %d, skipping", inputNameOnly, header.Typeflag) continue </s> add outputName := filepath.Join(outDir, name) if fi.IsDir() { if name == "AdGuardHome" { // Top-level AdGuardHome/. Skip it. // // TODO(a.garipov): See the similar todo in // tarGzFileUnpack. return "", nil </s> remove return agherr.Error("no host in question") </s> add return errors.Error("no host in question") </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation)
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/tls.go
keep keep keep keep replace keep keep keep keep keep
<mask> if key, err := x509.ParseECPrivateKey(der); err == nil { <mask> return key, "ECDSA", nil <mask> } <mask> <mask> return nil, "", errors.New("tls: failed to parse private key") <mask> } <mask> <mask> // unmarshalTLS handles base64-encoded certificates transparently <mask> func unmarshalTLS(r *http.Request) (tlsConfigSettings, error) { <mask> data := tlsConfigSettings{} </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return nil, "", errors.New("tls: found unknown private key type in PKCS#8 wrapping") </s> add return nil, "", errors.Error("tls: found unknown private key type in PKCS#8 wrapping") </s> remove return nil, agherr.Many(fmt.Sprintf("couldn't dial to %s", addr), dialErrs...) </s> add return nil, errors.List(fmt.Sprintf("couldn't dial to %s", addr), dialErrs...) </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove return nil, agherr.Error("invalid ip") </s> add return nil, errors.Error("invalid ip") </s> remove defer r.Close() </s> add defer func() { derr := r.Close() if derr != nil { log.Error("querylog: closing file: %s", err) } }()
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/tls.go
keep keep keep replace keep keep keep keep keep
<mask> package home <mask> <mask> import ( <mask> "errors" <mask> "fmt" <mask> "net/url" <mask> "os" <mask> "path" <mask> "path/filepath" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/upgrade.go
keep add keep keep keep keep keep
<mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/google/renameio/maybe" <mask> "golang.org/x/crypto/bcrypt" <mask> yaml "gopkg.in/yaml.v2" <mask> ) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> add "github.com/AdguardTeam/golibs/errors"
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/upgrade.go
keep keep keep add keep keep keep keep keep
<mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghio" <mask> "github.com/AdguardTeam/golibs/cache" <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> const ( <mask> defaultServer = "whois.arin.net" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> add "io"
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/whois.go
keep keep keep keep replace keep keep keep keep keep
<mask> // MaxConnReadSize is an upper limit in bytes for reading from net.Conn. <mask> const MaxConnReadSize = 64 * 1024 <mask> <mask> // Send request to a server and receive the response <mask> func (w *Whois) query(ctx context.Context, target, serverAddr string) (string, error) { <mask> addr, _, _ := net.SplitHostPort(serverAddr) <mask> if addr == "whois.arin.net" { <mask> target = "n + " + target <mask> } <mask> conn, err := w.dialContext(ctx, "tcp", serverAddr) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return string(data), nil </s> add return string(whoisData), nil </s> remove func (u *Updater) downloadPackageFile(url, filename string) error { resp, err := u.client.Get(url) </s> add func (u *Updater) downloadPackageFile(url, filename string) (err error) { var resp *http.Response resp, err = u.client.Get(url) </s> remove defer agherr.LogPanic("") </s> add defer log.OnPanic("") </s> remove defer conn.Close() </s> add defer func() { err = errors.WithDeferred(err, conn.Close()) }() </s> remove defer connReadCloser.Close() </s> add </s> remove func (u *Updater) VersionInfo(forceRecheck bool) (VersionInfo, error) { </s> add func (u *Updater) VersionInfo(forceRecheck bool) (vi VersionInfo, err error) {
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/whois.go
keep keep keep replace keep keep keep keep keep keep keep replace keep keep keep
<mask> if err != nil { <mask> return "", err <mask> } <mask> defer conn.Close() <mask> <mask> connReadCloser, err := aghio.LimitReadCloser(conn, MaxConnReadSize) <mask> if err != nil { <mask> return "", err <mask> } <mask> defer conn.Close() <mask> <mask> connReadCloser, err := aghio.LimitReadCloser(conn, MaxConnReadSize) <mask> if err != nil { <mask> return "", err <mask> } </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer connReadCloser.Close() </s> add </s> remove data, err := io.ReadAll(connReadCloser) </s> add var whoisData []byte whoisData, err = io.ReadAll(r) </s> remove return string(data), nil </s> add return string(whoisData), nil </s> remove break } </s> add func zipFileUnpackOne(outDir string, zf *zip.File) (name string, err error) { var rc io.ReadCloser rc, err = zf.Open() if err != nil { return "", fmt.Errorf("zip file Open(): %w", err) } defer func() { err = errors.WithDeferred(err, rc.Close()) }() </s> remove return nil, "", errors.New("tls: failed to parse private key") </s> add return nil, "", errors.Error("tls: failed to parse private key")
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/whois.go
keep keep keep keep replace keep keep keep keep keep
<mask> connReadCloser, err := aghio.LimitReadCloser(conn, MaxConnReadSize) <mask> if err != nil { <mask> return "", err <mask> } <mask> defer connReadCloser.Close() <mask> <mask> _ = conn.SetReadDeadline(time.Now().Add(time.Duration(w.timeoutMsec) * time.Millisecond)) <mask> _, err = conn.Write([]byte(target + "\r\n")) <mask> if err != nil { <mask> return "", err </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove connReadCloser, err := aghio.LimitReadCloser(conn, MaxConnReadSize) </s> add r, err := aghio.LimitReader(conn, MaxConnReadSize) </s> remove defer conn.Close() </s> add defer func() { err = errors.WithDeferred(err, conn.Close()) }() </s> remove _ = gzReader.Close() return files, err2 </s> add var wc io.WriteCloser wc, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) if err != nil { return "", fmt.Errorf("os.OpenFile(): %w", err) } defer func() { err = errors.WithDeferred(err, wc.Close()) }() _, err = io.Copy(wc, rc) if err != nil { return "", fmt.Errorf("io.Copy(): %w", err) } log.Tracef("created file %s", outputName) return name, nil </s> remove data, err := io.ReadAll(connReadCloser) </s> add var whoisData []byte whoisData, err = io.ReadAll(r) </s> remove var f io.WriteCloser f, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.FileMode(header.Mode&0o777)) if err != nil { err2 = fmt.Errorf("os.OpenFile(%s): %w", outputName, err) break } _, err = io.Copy(f, tarReader) if err != nil { _ = f.Close() err2 = fmt.Errorf("io.Copy(): %w", err) break } err = f.Close() if err != nil { err2 = fmt.Errorf("f.Close(): %w", err) break </s> add err = os.Mkdir(outputName, fi.Mode()) if err != nil && !errors.Is(err, os.ErrExist) { return "", fmt.Errorf("os.Mkdir(%q): %w", outputName, err) </s> remove func (w *Whois) query(ctx context.Context, target, serverAddr string) (string, error) { </s> add func (w *Whois) query(ctx context.Context, target, serverAddr string) (data string, err error) {
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/whois.go
keep keep keep replace keep keep keep keep replace keep
<mask> } <mask> <mask> // This use of ReadAll is now safe, because we limited the conn Reader. <mask> data, err := io.ReadAll(connReadCloser) <mask> if err != nil { <mask> return "", err <mask> } <mask> <mask> return string(data), nil <mask> } </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/whois.go
keep keep keep keep replace keep keep keep keep keep
<mask> // Package querylog provides query log functions and interfaces. <mask> package querylog <mask> <mask> import ( <mask> "errors" <mask> "fmt" <mask> "net" <mask> "os" <mask> "strings" <mask> "sync" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/qlog.go
keep keep add keep keep keep keep keep
<mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/miekg/dns" <mask> ) <mask> <mask> const ( </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors"
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/qlog.go
keep keep keep keep replace keep keep keep keep keep
<mask> "strings" <mask> "sync" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> // Timestamp not found errors. <mask> const ( </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove ErrTSNotFound agherr.Error = "ts not found" ErrTSTooLate agherr.Error = "ts too late" ErrTSTooEarly agherr.Error = "ts too early" </s> add ErrTSNotFound errors.Error = "ts not found" ErrTSTooLate errors.Error = "ts too late" ErrTSTooEarly errors.Error = "ts too early" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/qlogfile.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> ) <mask> <mask> // Timestamp not found errors. <mask> const ( <mask> ErrTSNotFound agherr.Error = "ts not found" <mask> ErrTSTooLate agherr.Error = "ts too late" <mask> ErrTSTooEarly agherr.Error = "ts too early" <mask> ) <mask> <mask> // TODO: Find a way to grow buffer instead of relying on this value when reading strings <mask> const maxEntrySize = 16 * 1024 <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove rDNSEmptyAnswerErr agherr.Error = "the answer section is empty" </s> add rDNSEmptyAnswerErr errors.Error = "the answer section is empty" </s> remove errBadAddrPassed agherr.Error = "the passed string is not a valid IP address" </s> add errBadAddrPassed errors.Error = "the passed string is not a valid IP address" </s> remove rDNSNotPTRErr agherr.Error = "the response is not a ptr" </s> add rDNSNotPTRErr errors.Error = "the response is not a ptr" </s> remove errFakeDial agherr.Error = "this error signals the successful dialFunc work" </s> add errFakeDial errors.Error = "this error signals the successful dialFunc work" </s> add "github.com/AdguardTeam/golibs/errors"
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/qlogfile.go
keep keep keep keep replace keep keep keep keep keep
<mask> package querylog <mask> <mask> import ( <mask> "encoding/binary" <mask> "errors" <mask> "fmt" <mask> "io" <mask> "math" <mask> "net" <mask> "os" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/qlogfile_test.go
keep add keep keep keep keep keep keep
<mask> "time" <mask> <mask> "github.com/stretchr/testify/assert" <mask> "github.com/stretchr/testify/require" <mask> ) <mask> <mask> // prepareTestFile prepares one test query log file with the specified lines <mask> // count. </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove func (l *queryLog) flushToFile(buffer []*logEntry) error { </s> add func (l *queryLog) flushToFile(buffer []*logEntry) (err error) { </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "errors" </s> add </s> add "github.com/AdguardTeam/golibs/errors"
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/qlogfile_test.go
keep replace keep keep keep keep replace keep
<mask> import ( <mask> "errors" <mask> "fmt" <mask> "io" <mask> "os" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/golibs/log" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/qlogreader.go
keep keep keep keep replace keep keep keep keep
<mask> } <mask> } <mask> <mask> if len(errs) > 0 { <mask> return agherr.Many("Error while closing QLogReader", errs...) <mask> } <mask> <mask> return nil <mask> } </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove if len(errors) != 0 { return agherr.Many("closing ipsets", errors...) </s> add if len(errs) != 0 { return errors.List("closing ipsets", errs...) </s> remove return agherr.Error("domain name is empty") </s> add return errors.Error("domain name is empty") </s> remove defer f.Close() fileReadCloser, err := aghio.LimitReadCloser(f, MaxFileSize) </s> add defer func() { derr := f.Close() if derr != nil { log.Error("glinet: closing file: %s", err) } }() fileReader, err := aghio.LimitReader(f, MaxFileSize) </s> remove defer r.Close() </s> add defer func() { derr := r.Close() if derr != nil { log.Error("querylog: closing file: %s", err) } }() </s> remove return agherr.Error("label is empty") </s> add return errors.Error("label is empty") </s> remove defer agherr.LogPanic("systemResolvers") </s> add defer log.OnPanic("systemResolvers")
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/qlogreader.go
keep keep keep keep replace keep keep keep keep keep
<mask> "net/http" <mask> "path/filepath" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/miekg/dns" <mask> ) <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/querylog.go
keep keep add keep keep keep keep keep keep
<mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/miekg/dns" <mask> ) <mask> <mask> // QueryLog - main interface <mask> type QueryLog interface { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors"
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/querylog.go
keep keep replace keep replace keep keep keep keep
<mask> switch { <mask> case p.Question == nil: <mask> return agherr.Error("question is nil") <mask> case len(p.Question.Question) != 1: <mask> return agherr.Error("more than one question") <mask> case len(p.Question.Question[0].Name) == 0: <mask> return agherr.Error("no host in question") <mask> case p.ClientIP == nil: <mask> return agherr.Error("no client ip") </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return agherr.Error("no host in question") </s> add return errors.Error("no host in question") </s> remove return agherr.Error("no client ip") </s> add return errors.Error("no client ip") </s> remove return agherr.Error("invalid name") </s> add return errors.Error("invalid name") </s> remove return agherr.Error("client is nil") </s> add return errors.Error("client is nil") </s> remove return agherr.Error("id required") </s> add return errors.Error("id required")
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/querylog.go
keep replace keep replace keep keep keep keep
<mask> case len(p.Question.Question[0].Name) == 0: <mask> return agherr.Error("no host in question") <mask> case p.ClientIP == nil: <mask> return agherr.Error("no client ip") <mask> default: <mask> return nil <mask> } <mask> } </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return agherr.Error("more than one question") </s> add return errors.Error("more than one question") </s> remove return agherr.Error("question is nil") </s> add return errors.Error("question is nil") </s> remove return agherr.Error("invalid name") </s> add return errors.Error("invalid name") </s> remove return agherr.Error("client is nil") </s> add return errors.Error("client is nil") </s> remove return agherr.Error("id required") </s> add return errors.Error("id required")
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/querylog.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> import ( <mask> "bytes" <mask> "encoding/json" <mask> "errors" <mask> "os" <mask> "time" <mask> <mask> "github.com/AdguardTeam/golibs/log" <mask> ) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/querylogfile.go
keep add keep keep keep keep keep keep
<mask> "time" <mask> <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> // flushLogBuffer flushes the current buffer to file and resets the current buffer <mask> func (l *queryLog) flushLogBuffer(fullFlush bool) error { <mask> if !l.conf.FileEnabled { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove func (l *queryLog) flushToFile(buffer []*logEntry) error { </s> add func (l *queryLog) flushToFile(buffer []*logEntry) (err error) { </s> add "github.com/AdguardTeam/golibs/errors" </s> remove func (u *Updater) VersionInfo(forceRecheck bool) (VersionInfo, error) { </s> add func (u *Updater) VersionInfo(forceRecheck bool) (vi VersionInfo, err error) { </s> remove err := e.Encode(entry) </s> add err = e.Encode(entry) </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove func (u *Updater) downloadPackageFile(url, filename string) error { resp, err := u.client.Get(url) </s> add func (u *Updater) downloadPackageFile(url, filename string) (err error) { var resp *http.Response resp, err = u.client.Get(url)
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/querylogfile.go
keep keep keep keep replace keep keep keep keep keep
<mask> return nil <mask> } <mask> <mask> // flushToFile saves the specified log entries to the query log file <mask> func (l *queryLog) flushToFile(buffer []*logEntry) error { <mask> if len(buffer) == 0 { <mask> log.Debug("querylog: there's nothing to write to a file") <mask> return nil <mask> } <mask> start := time.Now() </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove defer f.Close() </s> add defer func() { err = errors.WithDeferred(err, f.Close()) }() </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove return nil, agherr.Many(fmt.Sprintf("couldn't dial to %s", addr), dialErrs...) </s> add return nil, errors.List(fmt.Sprintf("couldn't dial to %s", addr), dialErrs...) </s> remove func tarGzFileUnpack(tarfile, outdir string) ([]string, error) { </s> add func tarGzFileUnpack(tarfile, outDir string) (files []string, err error) {
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/querylogfile.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> var b bytes.Buffer <mask> e := json.NewEncoder(&b) <mask> for _, entry := range buffer { <mask> err := e.Encode(entry) <mask> if err != nil { <mask> log.Error("Failed to marshal entry: %s", err) <mask> return err <mask> } <mask> } </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove var files []string var err2 error var zr io.ReadCloser for _, zf := range r.File { zr, err = zf.Open() </s> add for _, zf := range zrc.File { var name string name, err = zipFileUnpackOne(outDir, zf) </s> remove defer r.Close() </s> add defer func() { err = errors.WithDeferred(err, zrc.Close()) }() </s> remove err2 = fmt.Errorf("zip file Open(): %w", err) </s> add </s> remove defer f.Close() </s> add defer func() { derr := f.Close() if derr != nil { log.Error("etchostscontainer: closing file: %s", err) } }() </s> remove return nil, errors.New("couldn't find any legible interface") </s> add return nil, errors.Error("couldn't find any legible interface")
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/querylogfile.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> elapsed := time.Since(start) <mask> log.Debug("%d elements serialized via json in %v: %d kB, %v/entry, %v/entry", len(buffer), elapsed, b.Len()/1024, float64(b.Len())/float64(len(buffer)), elapsed/time.Duration(len(buffer))) <mask> <mask> var err error <mask> var zb bytes.Buffer <mask> filename := l.logFile <mask> zb = b <mask> <mask> l.fileWriteLock.Lock() </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove err := e.Encode(entry) </s> add err = e.Encode(entry) </s> remove func (u *Updater) downloadPackageFile(url, filename string) error { resp, err := u.client.Get(url) </s> add func (u *Updater) downloadPackageFile(url, filename string) (err error) { var resp *http.Response resp, err = u.client.Get(url) </s> remove var files []string var err2 error </s> add </s> remove defer r.Close() </s> add defer func() { err = errors.WithDeferred(err, zrc.Close()) }() </s> remove var files []string var err2 error var zr io.ReadCloser for _, zf := range r.File { zr, err = zf.Open() </s> add for _, zf := range zrc.File { var name string name, err = zipFileUnpackOne(outDir, zf) </s> remove var header *tar.Header header, err = tarReader.Next() if err == io.EOF { err2 = nil break } if err != nil { err2 = fmt.Errorf("tarReader.Next(): %w", err) </s> add var hdr *tar.Header hdr, err = tarReader.Next() if errors.Is(err, io.EOF) { err = nil
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/querylogfile.go
keep keep keep keep replace keep keep keep keep keep
<mask> if err != nil { <mask> log.Error("failed to create file \"%s\": %s", filename, err) <mask> return err <mask> } <mask> defer f.Close() <mask> <mask> n, err := f.Write(zb.Bytes()) <mask> if err != nil { <mask> log.Error("Couldn't write to file: %s", err) <mask> return err </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer f.Close() </s> add defer func() { derr := f.Close() if derr != nil { log.Error("etchostscontainer: closing file: %s", err) } }() </s> remove defer f.Close() fileReadCloser, err := aghio.LimitReadCloser(f, MaxFileSize) </s> add defer func() { derr := f.Close() if derr != nil { log.Error("glinet: closing file: %s", err) } }() fileReader, err := aghio.LimitReader(f, MaxFileSize) </s> remove defer r.Close() </s> add defer func() { derr := r.Close() if derr != nil { log.Error("querylog: closing file: %s", err) } }() </s> remove defer f.Close() </s> add defer func() { derr := f.Close() if derr != nil { log.Error("querylog: closing file: %s", derr) } }() </s> remove err := e.Encode(entry) </s> add err = e.Encode(entry) </s> remove err = f.Close() if err != nil { err2 = fmt.Errorf("f.Close(): %w", err) break } log.Tracef("created file %s", outputName) files = append(files, inputNameOnly) </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/querylogfile.go
keep keep keep keep replace keep keep keep keep keep
<mask> f, err := os.Open(l.logFile) <mask> if err != nil { <mask> return -1 <mask> } <mask> defer f.Close() <mask> <mask> buf := make([]byte, 500) <mask> r, err := f.Read(buf) <mask> if err != nil { <mask> return -1 </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer func() { _ = f.Close() }() </s> add defer func() { err = errors.WithDeferred(err, f.Close()) }() </s> remove defer f.Close() </s> add defer func() { err = errors.WithDeferred(err, f.Close()) }() </s> remove defer f.Close() fileReadCloser, err := aghio.LimitReadCloser(f, MaxFileSize) </s> add defer func() { derr := f.Close() if derr != nil { log.Error("glinet: closing file: %s", err) } }() fileReader, err := aghio.LimitReader(f, MaxFileSize) </s> remove connReadCloser, err := aghio.LimitReadCloser(conn, MaxConnReadSize) </s> add r, err := aghio.LimitReader(conn, MaxConnReadSize) </s> remove defer f.Close() </s> add defer func() { derr := f.Close() if derr != nil { log.Error("etchostscontainer: closing file: %s", err) } }() </s> remove defer r.Close() </s> add defer func() { err = errors.WithDeferred(err, zrc.Close()) }()
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/querylogfile.go
keep keep keep keep replace keep keep keep keep keep
<mask> log.Error("querylog: failed to open qlog reader: %s", err) <mask> <mask> return entries, oldest, 0 <mask> } <mask> defer r.Close() <mask> <mask> if params.olderThan.IsZero() { <mask> err = r.SeekStart() <mask> } else { <mask> err = r.SeekTS(params.olderThan.UnixNano()) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer f.Close() fileReadCloser, err := aghio.LimitReadCloser(f, MaxFileSize) </s> add defer func() { derr := f.Close() if derr != nil { log.Error("glinet: closing file: %s", err) } }() fileReader, err := aghio.LimitReader(f, MaxFileSize) </s> remove defer agherr.LogPanic("systemResolvers") </s> add defer log.OnPanic("systemResolvers") </s> remove defer f.Close() </s> add defer func() { err = errors.WithDeferred(err, f.Close()) }() </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove defer f.Close() </s> add defer func() { derr := f.Close() if derr != nil { log.Error("querylog: closing file: %s", derr) } }() </s> remove return nil, "", errors.New("tls: failed to parse private key") </s> add return nil, "", errors.Error("tls: failed to parse private key")
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/querylog/search.go
keep keep keep keep replace keep keep keep keep keep
<mask> import ( <mask> "bytes" <mask> "encoding/binary" <mask> "encoding/gob" <mask> "errors" <mask> "fmt" <mask> "net" <mask> "os" <mask> "sort" <mask> "sync" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/stats/unit.go
keep keep keep keep replace keep keep keep keep keep
<mask> "sort" <mask> "sync" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/golibs/log" <mask> bolt "go.etcd.io/bbolt" <mask> ) <mask> <mask> // TODO(a.garipov): Rewrite all of this. Add proper error handling and </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> add "github.com/AdguardTeam/golibs/errors"
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/stats/unit.go
keep keep keep keep replace keep keep keep keep keep
<mask> unitDel := 0 <mask> <mask> // TODO(a.garipov): See if this is actually necessary. Looks <mask> // like a rather bizarre solution. <mask> errStop := agherr.Error("stop iteration") <mask> forEachBkt := func(name []byte, _ *bolt.Bucket) (cberr error) { <mask> nameID := uint32(btoi(name)) <mask> if nameID < firstID { <mask> cberr = tx.DeleteBucket(name) <mask> if cberr != nil { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer agherr.Annotate("invalid option string %q: %w", &err, s) </s> add defer func() { err = errors.Annotate(err, "invalid option string %q: %w", s) }() </s> remove defer agherr.Annotate("validating domain name %q: %w", &err, name) </s> add defer func() { err = errors.Annotate(err, "validating domain name %q: %w", name) }() </s> remove return nil, agherr.Error("invalid ip") </s> add return nil, errors.Error("invalid ip") </s> remove defer agherr.Annotate("validating label %q: %w", &err, label) </s> add defer func() { err = errors.Annotate(err, "validating label %q: %w", label) }() </s> remove continue } else if header.Typeflag != tar.TypeReg { log.Debug("updater: %s: unknown file type %d, skipping", inputNameOnly, header.Typeflag) continue </s> add outputName := filepath.Join(outDir, name) if fi.IsDir() { if name == "AdGuardHome" { // Top-level AdGuardHome/. Skip it. // // TODO(a.garipov): See the similar todo in // tarGzFileUnpack. return "", nil </s> remove fi := zf.FileInfo() inputNameOnly := fi.Name() if inputNameOnly == "" { continue } outputName := filepath.Join(outdir, inputNameOnly) if fi.IsDir() { if inputNameOnly == "AdGuardHome" { // Top-level AdGuardHome/. Skip it. // // TODO(a.garipov): See the similar todo in // tarGzFileUnpack. continue } err = os.Mkdir(outputName, fi.Mode()) if err != nil && !errors.Is(err, os.ErrExist) { err2 = fmt.Errorf("os.Mkdir(%q): %w", outputName, err) break } log.Tracef("created directory %q", outputName) continue } var f io.WriteCloser f, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) if err != nil { err2 = fmt.Errorf("os.OpenFile(): %w", err) break } _, err = io.Copy(f, zr) if err != nil { _ = f.Close() err2 = fmt.Errorf("io.Copy(): %w", err) break </s> add if name != "" { files = append(files, name)
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/stats/unit.go
keep keep keep add keep keep keep keep keep
<mask> import ( <mask> "encoding/json" <mask> "fmt" <mask> "io" <mask> "strings" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghio" <mask> "github.com/AdguardTeam/golibs/errors" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> add "io" </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/check.go
keep keep add keep keep keep keep keep
<mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghio" <mask> ) <mask> <mask> // TODO(a.garipov): Make configurable. <mask> const versionCheckPeriod = 8 * time.Hour <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors"
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/check.go
keep keep keep keep replace keep keep keep keep keep
<mask> const MaxResponseSize = 64 * 1024 <mask> <mask> // VersionInfo downloads the latest version information. If forceRecheck is <mask> // false and there are cached results, those results are returned. <mask> func (u *Updater) VersionInfo(forceRecheck bool) (VersionInfo, error) { <mask> u.mu.Lock() <mask> defer u.mu.Unlock() <mask> <mask> now := time.Now() <mask> recheckTime := u.prevCheckTime.Add(versionCheckPeriod) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove func (u *Updater) downloadPackageFile(url, filename string) error { resp, err := u.client.Get(url) </s> add func (u *Updater) downloadPackageFile(url, filename string) (err error) { var resp *http.Response resp, err = u.client.Get(url) </s> remove func (w *Whois) query(ctx context.Context, target, serverAddr string) (string, error) { </s> add func (w *Whois) query(ctx context.Context, target, serverAddr string) (data string, err error) { </s> remove // All files are created inside 'outdir', subdirectories are not created </s> add // All files are created inside 'outDir', subdirectories are not created </s> remove // All files are created inside 'outdir', subdirectories are not created </s> add // All files are created inside outDir, subdirectories are not created </s> remove func tarGzFileUnpack(tarfile, outdir string) ([]string, error) { </s> add func tarGzFileUnpack(tarfile, outDir string) (files []string, err error) { </s> remove func zipFileUnpack(zipfile, outdir string) ([]string, error) { r, err := zip.OpenReader(zipfile) </s> add func zipFileUnpack(zipfile, outDir string) (files []string, err error) { zrc, err := zip.OpenReader(zipfile)
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/check.go
keep add keep keep keep keep
<mask> } <mask> <mask> vcu := u.versionCheckURL <mask> resp, err = u.client.Get(vcu) <mask> if err != nil { <mask> return VersionInfo{}, fmt.Errorf("updater: HTTP GET %s: %w", vcu, err) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove resp, err := u.client.Get(vcu) </s> add resp, err = u.client.Get(vcu) </s> remove defer resp.Body.Close() </s> add defer func() { err = errors.WithDeferred(err, resp.Body.Close()) }() </s> remove resp.Body, err = aghio.LimitReadCloser(resp.Body, MaxResponseSize) </s> add var r io.Reader r, err = aghio.LimitReader(resp.Body, MaxResponseSize) </s> remove body, err := io.ReadAll(resp.Body) </s> add body, err := io.ReadAll(r) </s> remove defer resp.Body.Close() </s> add </s> remove defer resp.Body.Close() </s> add defer func() { err = errors.WithDeferred(err, resp.Body.Close()) }()
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/check.go
keep replace keep keep keep replace
<mask> vcu := u.versionCheckURL <mask> resp, err := u.client.Get(vcu) <mask> if err != nil { <mask> return VersionInfo{}, fmt.Errorf("updater: HTTP GET %s: %w", vcu, err) <mask> } <mask> defer resp.Body.Close() </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> add var resp *http.Response </s> remove resp.Body, err = aghio.LimitReadCloser(resp.Body, MaxResponseSize) </s> add var r io.Reader r, err = aghio.LimitReader(resp.Body, MaxResponseSize) </s> remove body, err := io.ReadAll(resp.Body) </s> add body, err := io.ReadAll(r) </s> remove defer resp.Body.Close() </s> add </s> remove defer resp.Body.Close() </s> add defer func() { err = errors.WithDeferred(err, resp.Body.Close()) }()
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/check.go
keep replace keep keep keep replace
<mask> <mask> resp.Body, err = aghio.LimitReadCloser(resp.Body, MaxResponseSize) <mask> if err != nil { <mask> return VersionInfo{}, fmt.Errorf("updater: LimitReadCloser: %w", err) <mask> } <mask> defer resp.Body.Close() </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer resp.Body.Close() </s> add defer func() { err = errors.WithDeferred(err, resp.Body.Close()) }() </s> remove resp.Body, err = aghio.LimitReadCloser(resp.Body, MaxPackageFileSize) </s> add var r io.Reader r, err = aghio.LimitReader(resp.Body, MaxPackageFileSize) </s> remove defer resp.Body.Close() </s> add defer func() { err = errors.WithDeferred(err, resp.Body.Close()) }() </s> remove resp, err := u.client.Get(vcu) </s> add resp, err = u.client.Get(vcu) </s> remove defer resp.Body.Close() </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/check.go
keep keep keep keep replace keep keep keep keep keep
<mask> defer resp.Body.Close() <mask> <mask> // This use of ReadAll is safe, because we just limited the appropriate <mask> // ReadCloser. <mask> body, err := io.ReadAll(resp.Body) <mask> if err != nil { <mask> return VersionInfo{}, fmt.Errorf("updater: HTTP GET %s: %w", vcu, err) <mask> } <mask> <mask> u.prevCheckTime = time.Now() </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer resp.Body.Close() </s> add </s> remove body, err := io.ReadAll(resp.Body) </s> add body, err := io.ReadAll(r) </s> remove defer resp.Body.Close() </s> add </s> remove resp.Body, err = aghio.LimitReadCloser(resp.Body, MaxResponseSize) </s> add var r io.Reader r, err = aghio.LimitReader(resp.Body, MaxResponseSize) </s> remove defer fileReadCloser.Close() </s> add </s> remove defer resp.Body.Close() </s> add defer func() { err = errors.WithDeferred(err, resp.Body.Close()) }()
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/check.go
keep keep keep keep replace keep keep keep keep keep
<mask> import ( <mask> "archive/tar" <mask> "archive/zip" <mask> "compress/gzip" <mask> "errors" <mask> "fmt" <mask> "io" <mask> "net/http" <mask> "net/url" <mask> "os" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep keep add keep keep keep keep keep keep
<mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghio" <mask> "github.com/AdguardTeam/AdGuardHome/internal/version" <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> // Updater is the AdGuard Home updater. <mask> type Updater struct { <mask> client *http.Client </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> add "io"
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep keep keep replace replace keep keep keep replace keep keep keep keep
<mask> const MaxPackageFileSize = 32 * 1024 * 1024 <mask> <mask> // Download package file and save it to disk <mask> func (u *Updater) downloadPackageFile(url, filename string) error { <mask> resp, err := u.client.Get(url) <mask> if err != nil { <mask> return fmt.Errorf("http request failed: %w", err) <mask> } <mask> defer resp.Body.Close() <mask> <mask> resp.Body, err = aghio.LimitReadCloser(resp.Body, MaxPackageFileSize) <mask> if err != nil { <mask> return fmt.Errorf("http request failed: %w", err) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove resp.Body, err = aghio.LimitReadCloser(resp.Body, MaxPackageFileSize) </s> add var r io.Reader r, err = aghio.LimitReader(resp.Body, MaxPackageFileSize) </s> remove defer resp.Body.Close() </s> add </s> remove func (u *Updater) VersionInfo(forceRecheck bool) (VersionInfo, error) { </s> add func (u *Updater) VersionInfo(forceRecheck bool) (vi VersionInfo, err error) { </s> remove defer resp.Body.Close() </s> add defer func() { err = errors.WithDeferred(err, resp.Body.Close()) }() </s> remove func (w *Whois) query(ctx context.Context, target, serverAddr string) (string, error) { </s> add func (w *Whois) query(ctx context.Context, target, serverAddr string) (data string, err error) {
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep replace keep keep keep replace keep keep keep
<mask> <mask> resp.Body, err = aghio.LimitReadCloser(resp.Body, MaxPackageFileSize) <mask> if err != nil { <mask> return fmt.Errorf("http request failed: %w", err) <mask> } <mask> defer resp.Body.Close() <mask> <mask> log.Debug("updater: reading HTTP body") <mask> // This use of ReadAll is now safe, because we limited body's Reader. </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove body, err := io.ReadAll(resp.Body) </s> add body, err := io.ReadAll(r) </s> remove defer resp.Body.Close() </s> add </s> remove defer fileReadCloser.Close() </s> add </s> remove defer resp.Body.Close() </s> add defer func() { err = errors.WithDeferred(err, resp.Body.Close()) }() </s> remove data, err := io.ReadAll(connReadCloser) </s> add var whoisData []byte whoisData, err = io.ReadAll(r)
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep keep keep keep replace keep keep keep keep keep
<mask> defer resp.Body.Close() <mask> <mask> log.Debug("updater: reading HTTP body") <mask> // This use of ReadAll is now safe, because we limited body's Reader. <mask> body, err := io.ReadAll(resp.Body) <mask> if err != nil { <mask> return fmt.Errorf("io.ReadAll() failed: %w", err) <mask> } <mask> <mask> _ = os.Mkdir(u.updateDir, 0o755) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer resp.Body.Close() </s> add </s> remove body, err := io.ReadAll(resp.Body) </s> add body, err := io.ReadAll(r) </s> remove defer resp.Body.Close() </s> add </s> remove defer fileReadCloser.Close() </s> add </s> remove data, err := io.ReadAll(connReadCloser) </s> add var whoisData []byte whoisData, err = io.ReadAll(r) </s> remove bs, err := io.ReadAll(fileReadCloser) </s> add bs, err := io.ReadAll(fileReader)
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep replace keep replace keep
<mask> // Existing files are overwritten <mask> // All files are created inside 'outdir', subdirectories are not created <mask> // Return the list of files (not directories) written <mask> func tarGzFileUnpack(tarfile, outdir string) ([]string, error) { <mask> f, err := os.Open(tarfile) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove // All files are created inside 'outdir', subdirectories are not created </s> add // All files are created inside 'outDir', subdirectories are not created </s> remove func zipFileUnpack(zipfile, outdir string) ([]string, error) { r, err := zip.OpenReader(zipfile) </s> add func zipFileUnpack(zipfile, outDir string) (files []string, err error) { zrc, err := zip.OpenReader(zipfile) </s> remove _ = gzReader.Close() return files, err2 </s> add var wc io.WriteCloser wc, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) if err != nil { return "", fmt.Errorf("os.OpenFile(): %w", err) } defer func() { err = errors.WithDeferred(err, wc.Close()) }() _, err = io.Copy(wc, rc) if err != nil { return "", fmt.Errorf("io.Copy(): %w", err) } log.Tracef("created file %s", outputName) return name, nil </s> remove func (u *Updater) VersionInfo(forceRecheck bool) (VersionInfo, error) { </s> add func (u *Updater) VersionInfo(forceRecheck bool) (vi VersionInfo, err error) { </s> remove log.Debug("updater: created file %s", outputName) files = append(files, header.Name) </s> add log.Tracef("created directory %q", outputName) return "", nil
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> f, err := os.Open(tarfile) <mask> if err != nil { <mask> return nil, fmt.Errorf("os.Open(): %w", err) <mask> } <mask> defer func() { <mask> _ = f.Close() <mask> }() <mask> <mask> gzReader, err := gzip.NewReader(f) <mask> if err != nil { <mask> return nil, fmt.Errorf("gzip.NewReader(): %w", err) <mask> } </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> add defer func() { err = errors.WithDeferred(err, gzReader.Close()) }() </s> remove defer f.Close() </s> add defer func() { err = errors.WithDeferred(err, f.Close()) }() </s> remove var files []string var err2 error </s> add </s> remove defer f.Close() </s> add defer func() { derr := f.Close() if derr != nil { log.Error("querylog: closing file: %s", derr) } }() </s> remove func tarGzFileUnpack(tarfile, outdir string) ([]string, error) { </s> add func tarGzFileUnpack(tarfile, outDir string) (files []string, err error) { </s> remove defer f.Close() fileReadCloser, err := aghio.LimitReadCloser(f, MaxFileSize) </s> add defer func() { derr := f.Close() if derr != nil { log.Error("glinet: closing file: %s", err) } }() fileReader, err := aghio.LimitReader(f, MaxFileSize)
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep keep add keep keep keep keep keep
<mask> if err != nil { <mask> return nil, fmt.Errorf("gzip.NewReader(): %w", err) <mask> } <mask> <mask> tarReader := tar.NewReader(gzReader) <mask> for { <mask> var hdr *tar.Header <mask> hdr, err = tarReader.Next() </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove var files []string var err2 error </s> add </s> remove var header *tar.Header header, err = tarReader.Next() if err == io.EOF { err2 = nil break } if err != nil { err2 = fmt.Errorf("tarReader.Next(): %w", err) </s> add var hdr *tar.Header hdr, err = tarReader.Next() if errors.Is(err, io.EOF) { err = nil </s> remove defer func() { _ = f.Close() }() </s> add defer func() { err = errors.WithDeferred(err, f.Close()) }() </s> remove var files []string var err2 error var zr io.ReadCloser for _, zf := range r.File { zr, err = zf.Open() </s> add for _, zf := range zrc.File { var name string name, err = zipFileUnpackOne(outDir, zf) </s> remove defer r.Close() </s> add defer func() { err = errors.WithDeferred(err, zrc.Close()) }() </s> remove return nil, errors.New("couldn't find any legible interface") </s> add return nil, errors.Error("couldn't find any legible interface")
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep replace replace keep keep replace replace replace replace replace replace replace replace keep keep
<mask> <mask> var files []string <mask> var err2 error <mask> tarReader := tar.NewReader(gzReader) <mask> for { <mask> var header *tar.Header <mask> header, err = tarReader.Next() <mask> if err == io.EOF { <mask> err2 = nil <mask> break <mask> } <mask> if err != nil { <mask> err2 = fmt.Errorf("tarReader.Next(): %w", err) <mask> break <mask> } </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove var files []string var err2 error var zr io.ReadCloser for _, zf := range r.File { zr, err = zf.Open() </s> add for _, zf := range zrc.File { var name string name, err = zipFileUnpackOne(outDir, zf) </s> add defer func() { err = errors.WithDeferred(err, gzReader.Close()) }() </s> remove defer r.Close() </s> add defer func() { err = errors.WithDeferred(err, zrc.Close()) }() </s> remove } </s> add } else if err != nil { err = fmt.Errorf("tarReader.Next(): %w", err) </s> remove fi := zf.FileInfo() inputNameOnly := fi.Name() if inputNameOnly == "" { continue } outputName := filepath.Join(outdir, inputNameOnly) if fi.IsDir() { if inputNameOnly == "AdGuardHome" { // Top-level AdGuardHome/. Skip it. // // TODO(a.garipov): See the similar todo in // tarGzFileUnpack. continue } err = os.Mkdir(outputName, fi.Mode()) if err != nil && !errors.Is(err, os.ErrExist) { err2 = fmt.Errorf("os.Mkdir(%q): %w", outputName, err) break } log.Tracef("created directory %q", outputName) continue } var f io.WriteCloser f, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) if err != nil { err2 = fmt.Errorf("os.OpenFile(): %w", err) break } _, err = io.Copy(f, zr) if err != nil { _ = f.Close() err2 = fmt.Errorf("io.Copy(): %w", err) break </s> add if name != "" { files = append(files, name)
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep replace keep replace replace replace keep keep
<mask> break <mask> } <mask> <mask> _, inputNameOnly := filepath.Split(header.Name) <mask> if inputNameOnly == "" { <mask> continue <mask> } <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove var header *tar.Header header, err = tarReader.Next() if err == io.EOF { err2 = nil break } if err != nil { err2 = fmt.Errorf("tarReader.Next(): %w", err) </s> add var hdr *tar.Header hdr, err = tarReader.Next() if errors.Is(err, io.EOF) { err = nil </s> remove outputName := filepath.Join(outdir, inputNameOnly) </s> add var name string name, err = tarGzFileUnpackOne(outDir, tarReader, hdr) </s> remove fi := zf.FileInfo() inputNameOnly := fi.Name() if inputNameOnly == "" { continue } outputName := filepath.Join(outdir, inputNameOnly) if fi.IsDir() { if inputNameOnly == "AdGuardHome" { // Top-level AdGuardHome/. Skip it. // // TODO(a.garipov): See the similar todo in // tarGzFileUnpack. continue } err = os.Mkdir(outputName, fi.Mode()) if err != nil && !errors.Is(err, os.ErrExist) { err2 = fmt.Errorf("os.Mkdir(%q): %w", outputName, err) break } log.Tracef("created directory %q", outputName) continue } var f io.WriteCloser f, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) if err != nil { err2 = fmt.Errorf("os.OpenFile(): %w", err) break } _, err = io.Copy(f, zr) if err != nil { _ = f.Close() err2 = fmt.Errorf("io.Copy(): %w", err) break </s> add if name != "" { files = append(files, name) </s> remove err2 = fmt.Errorf("zip file Open(): %w", err) </s> add </s> remove log.Debug("updater: created directory %q", outputName) </s> add fi := zf.FileInfo() name = fi.Name() if name == "" { return "", nil }
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep keep keep keep replace keep replace replace replace replace replace replace replace replace replace replace keep keep
<mask> if inputNameOnly == "" { <mask> continue <mask> } <mask> <mask> outputName := filepath.Join(outdir, inputNameOnly) <mask> <mask> if header.Typeflag == tar.TypeDir { <mask> if inputNameOnly == "AdGuardHome" { <mask> // Top-level AdGuardHome/. Skip it. <mask> // <mask> // TODO(a.garipov): This whole package needs to <mask> // be rewritten and covered in more integration <mask> // tests. It has weird assumptions and file <mask> // mode issues. <mask> continue <mask> } <mask> <mask> err = os.Mkdir(outputName, os.FileMode(header.Mode&0o777)) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove _, inputNameOnly := filepath.Split(header.Name) if inputNameOnly == "" { continue </s> add break </s> remove continue } else if header.Typeflag != tar.TypeReg { log.Debug("updater: %s: unknown file type %d, skipping", inputNameOnly, header.Typeflag) continue </s> add outputName := filepath.Join(outDir, name) if fi.IsDir() { if name == "AdGuardHome" { // Top-level AdGuardHome/. Skip it. // // TODO(a.garipov): See the similar todo in // tarGzFileUnpack. return "", nil </s> remove fi := zf.FileInfo() inputNameOnly := fi.Name() if inputNameOnly == "" { continue } outputName := filepath.Join(outdir, inputNameOnly) if fi.IsDir() { if inputNameOnly == "AdGuardHome" { // Top-level AdGuardHome/. Skip it. // // TODO(a.garipov): See the similar todo in // tarGzFileUnpack. continue } err = os.Mkdir(outputName, fi.Mode()) if err != nil && !errors.Is(err, os.ErrExist) { err2 = fmt.Errorf("os.Mkdir(%q): %w", outputName, err) break } log.Tracef("created directory %q", outputName) continue } var f io.WriteCloser f, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) if err != nil { err2 = fmt.Errorf("os.OpenFile(): %w", err) break } _, err = io.Copy(f, zr) if err != nil { _ = f.Close() err2 = fmt.Errorf("io.Copy(): %w", err) break </s> add if name != "" { files = append(files, name) </s> remove } </s> add } else if err != nil { err = fmt.Errorf("tarReader.Next(): %w", err) </s> remove err = os.Mkdir(outputName, os.FileMode(header.Mode&0o777)) if err != nil && !errors.Is(err, os.ErrExist) { err2 = fmt.Errorf("os.Mkdir(%q): %w", outputName, err) </s> add return files, err }
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep keep keep replace replace replace keep replace replace keep
<mask> continue <mask> } <mask> <mask> err = os.Mkdir(outputName, os.FileMode(header.Mode&0o777)) <mask> if err != nil && !errors.Is(err, os.ErrExist) { <mask> err2 = fmt.Errorf("os.Mkdir(%q): %w", outputName, err) <mask> <mask> break <mask> } <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove var f io.WriteCloser f, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.FileMode(header.Mode&0o777)) if err != nil { err2 = fmt.Errorf("os.OpenFile(%s): %w", outputName, err) break } _, err = io.Copy(f, tarReader) if err != nil { _ = f.Close() err2 = fmt.Errorf("io.Copy(): %w", err) break } err = f.Close() if err != nil { err2 = fmt.Errorf("f.Close(): %w", err) break </s> add err = os.Mkdir(outputName, fi.Mode()) if err != nil && !errors.Is(err, os.ErrExist) { return "", fmt.Errorf("os.Mkdir(%q): %w", outputName, err) </s> remove fi := zf.FileInfo() inputNameOnly := fi.Name() if inputNameOnly == "" { continue } outputName := filepath.Join(outdir, inputNameOnly) if fi.IsDir() { if inputNameOnly == "AdGuardHome" { // Top-level AdGuardHome/. Skip it. // // TODO(a.garipov): See the similar todo in // tarGzFileUnpack. continue } err = os.Mkdir(outputName, fi.Mode()) if err != nil && !errors.Is(err, os.ErrExist) { err2 = fmt.Errorf("os.Mkdir(%q): %w", outputName, err) break } log.Tracef("created directory %q", outputName) continue } var f io.WriteCloser f, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) if err != nil { err2 = fmt.Errorf("os.OpenFile(): %w", err) break } _, err = io.Copy(f, zr) if err != nil { _ = f.Close() err2 = fmt.Errorf("io.Copy(): %w", err) break </s> add if name != "" { files = append(files, name) </s> remove if header.Typeflag == tar.TypeDir { if inputNameOnly == "AdGuardHome" { // Top-level AdGuardHome/. Skip it. // // TODO(a.garipov): This whole package needs to // be rewritten and covered in more integration // tests. It has weird assumptions and file // mode issues. continue } </s> add if name != "" { files = append(files, name) } } </s> remove } </s> add } else if err != nil { err = fmt.Errorf("tarReader.Next(): %w", err) </s> remove _, inputNameOnly := filepath.Split(header.Name) if inputNameOnly == "" { continue </s> add break
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep replace keep replace replace replace replace
<mask> <mask> log.Debug("updater: created directory %q", outputName) <mask> <mask> continue <mask> } else if header.Typeflag != tar.TypeReg { <mask> log.Debug("updater: %s: unknown file type %d, skipping", inputNameOnly, header.Typeflag) <mask> continue </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove var f io.WriteCloser f, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.FileMode(header.Mode&0o777)) if err != nil { err2 = fmt.Errorf("os.OpenFile(%s): %w", outputName, err) break } _, err = io.Copy(f, tarReader) if err != nil { _ = f.Close() err2 = fmt.Errorf("io.Copy(): %w", err) break } err = f.Close() if err != nil { err2 = fmt.Errorf("f.Close(): %w", err) break </s> add err = os.Mkdir(outputName, fi.Mode()) if err != nil && !errors.Is(err, os.ErrExist) { return "", fmt.Errorf("os.Mkdir(%q): %w", outputName, err) </s> remove break } </s> add func zipFileUnpackOne(outDir string, zf *zip.File) (name string, err error) { var rc io.ReadCloser rc, err = zf.Open() if err != nil { return "", fmt.Errorf("zip file Open(): %w", err) } defer func() { err = errors.WithDeferred(err, rc.Close()) }() </s> remove err = os.Mkdir(outputName, os.FileMode(header.Mode&0o777)) if err != nil && !errors.Is(err, os.ErrExist) { err2 = fmt.Errorf("os.Mkdir(%q): %w", outputName, err) </s> add return files, err } </s> remove log.Debug("updater: created file %s", outputName) files = append(files, header.Name) </s> add log.Tracef("created directory %q", outputName) return "", nil </s> remove _ = gzReader.Close() return files, err2 </s> add var wc io.WriteCloser wc, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) if err != nil { return "", fmt.Errorf("os.OpenFile(): %w", err) } defer func() { err = errors.WithDeferred(err, wc.Close()) }() _, err = io.Copy(wc, rc) if err != nil { return "", fmt.Errorf("io.Copy(): %w", err) } log.Tracef("created file %s", outputName) return name, nil
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep replace replace keep keep keep
<mask> log.Debug("updater: %s: unknown file type %d, skipping", inputNameOnly, header.Typeflag) <mask> continue <mask> } <mask> <mask> var f io.WriteCloser <mask> f, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.FileMode(header.Mode&0o777)) <mask> if err != nil { <mask> err2 = fmt.Errorf("os.OpenFile(%s): %w", outputName, err) <mask> break <mask> } <mask> _, err = io.Copy(f, tarReader) <mask> if err != nil { <mask> _ = f.Close() <mask> err2 = fmt.Errorf("io.Copy(): %w", err) <mask> break <mask> } <mask> err = f.Close() <mask> if err != nil { <mask> err2 = fmt.Errorf("f.Close(): %w", err) <mask> break <mask> } <mask> <mask> log.Debug("updater: created file %s", outputName) <mask> files = append(files, header.Name) <mask> } <mask> <mask> _ = gzReader.Close() </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove err = f.Close() if err != nil { err2 = fmt.Errorf("f.Close(): %w", err) break } log.Tracef("created file %s", outputName) files = append(files, inputNameOnly) </s> add </s> remove fi := zf.FileInfo() inputNameOnly := fi.Name() if inputNameOnly == "" { continue } outputName := filepath.Join(outdir, inputNameOnly) if fi.IsDir() { if inputNameOnly == "AdGuardHome" { // Top-level AdGuardHome/. Skip it. // // TODO(a.garipov): See the similar todo in // tarGzFileUnpack. continue } err = os.Mkdir(outputName, fi.Mode()) if err != nil && !errors.Is(err, os.ErrExist) { err2 = fmt.Errorf("os.Mkdir(%q): %w", outputName, err) break } log.Tracef("created directory %q", outputName) continue } var f io.WriteCloser f, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) if err != nil { err2 = fmt.Errorf("os.OpenFile(): %w", err) break } _, err = io.Copy(f, zr) if err != nil { _ = f.Close() err2 = fmt.Errorf("io.Copy(): %w", err) break </s> add if name != "" { files = append(files, name) </s> remove log.Debug("updater: created directory %q", outputName) </s> add fi := zf.FileInfo() name = fi.Name() if name == "" { return "", nil } </s> remove continue } else if header.Typeflag != tar.TypeReg { log.Debug("updater: %s: unknown file type %d, skipping", inputNameOnly, header.Typeflag) continue </s> add outputName := filepath.Join(outDir, name) if fi.IsDir() { if name == "AdGuardHome" { // Top-level AdGuardHome/. Skip it. // // TODO(a.garipov): See the similar todo in // tarGzFileUnpack. return "", nil </s> remove _ = gzReader.Close() return files, err2 </s> add var wc io.WriteCloser wc, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) if err != nil { return "", fmt.Errorf("os.OpenFile(): %w", err) } defer func() { err = errors.WithDeferred(err, wc.Close()) }() _, err = io.Copy(wc, rc) if err != nil { return "", fmt.Errorf("io.Copy(): %w", err) } log.Tracef("created file %s", outputName) return name, nil
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep keep keep keep replace replace keep keep keep keep replace keep keep keep keep
<mask> log.Debug("updater: created file %s", outputName) <mask> files = append(files, header.Name) <mask> } <mask> <mask> _ = gzReader.Close() <mask> return files, err2 <mask> } <mask> <mask> // Unpack all files from .zip file to the specified directory <mask> // Existing files are overwritten <mask> // All files are created inside 'outdir', subdirectories are not created <mask> // Return the list of files (not directories) written <mask> func zipFileUnpack(zipfile, outdir string) ([]string, error) { <mask> r, err := zip.OpenReader(zipfile) <mask> if err != nil { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove // All files are created inside 'outdir', subdirectories are not created </s> add // All files are created inside outDir, subdirectories are not created </s> remove func zipFileUnpack(zipfile, outdir string) ([]string, error) { r, err := zip.OpenReader(zipfile) </s> add func zipFileUnpack(zipfile, outDir string) (files []string, err error) { zrc, err := zip.OpenReader(zipfile) </s> remove func tarGzFileUnpack(tarfile, outdir string) ([]string, error) { </s> add func tarGzFileUnpack(tarfile, outDir string) (files []string, err error) { </s> remove log.Debug("updater: created file %s", outputName) files = append(files, header.Name) </s> add log.Tracef("created directory %q", outputName) return "", nil </s> remove _ = zr.Close() return files, err2 </s> add return files, err
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep keep keep replace replace keep keep keep replace
<mask> // Existing files are overwritten <mask> // All files are created inside 'outdir', subdirectories are not created <mask> // Return the list of files (not directories) written <mask> func zipFileUnpack(zipfile, outdir string) ([]string, error) { <mask> r, err := zip.OpenReader(zipfile) <mask> if err != nil { <mask> return nil, fmt.Errorf("zip.OpenReader(): %w", err) <mask> } <mask> defer r.Close() </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove // All files are created inside 'outdir', subdirectories are not created </s> add // All files are created inside 'outDir', subdirectories are not created </s> remove // All files are created inside 'outdir', subdirectories are not created </s> add // All files are created inside outDir, subdirectories are not created </s> remove func tarGzFileUnpack(tarfile, outdir string) ([]string, error) { </s> add func tarGzFileUnpack(tarfile, outDir string) (files []string, err error) { </s> remove _ = gzReader.Close() return files, err2 </s> add var wc io.WriteCloser wc, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) if err != nil { return "", fmt.Errorf("os.OpenFile(): %w", err) } defer func() { err = errors.WithDeferred(err, wc.Close()) }() _, err = io.Copy(wc, rc) if err != nil { return "", fmt.Errorf("io.Copy(): %w", err) } log.Tracef("created file %s", outputName) return name, nil </s> remove var files []string var err2 error var zr io.ReadCloser for _, zf := range r.File { zr, err = zf.Open() </s> add for _, zf := range zrc.File { var name string name, err = zipFileUnpackOne(outDir, zf)
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep replace replace replace replace replace keep replace
<mask> <mask> var files []string <mask> var err2 error <mask> var zr io.ReadCloser <mask> for _, zf := range r.File { <mask> zr, err = zf.Open() <mask> if err != nil { <mask> err2 = fmt.Errorf("zip file Open(): %w", err) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer r.Close() </s> add defer func() { err = errors.WithDeferred(err, zrc.Close()) }() </s> remove var files []string var err2 error </s> add </s> remove var header *tar.Header header, err = tarReader.Next() if err == io.EOF { err2 = nil break } if err != nil { err2 = fmt.Errorf("tarReader.Next(): %w", err) </s> add var hdr *tar.Header hdr, err = tarReader.Next() if errors.Is(err, io.EOF) { err = nil </s> remove break } </s> add func zipFileUnpackOne(outDir string, zf *zip.File) (name string, err error) { var rc io.ReadCloser rc, err = zf.Open() if err != nil { return "", fmt.Errorf("zip file Open(): %w", err) } defer func() { err = errors.WithDeferred(err, rc.Close()) }() </s> remove fi := zf.FileInfo() inputNameOnly := fi.Name() if inputNameOnly == "" { continue } outputName := filepath.Join(outdir, inputNameOnly) if fi.IsDir() { if inputNameOnly == "AdGuardHome" { // Top-level AdGuardHome/. Skip it. // // TODO(a.garipov): See the similar todo in // tarGzFileUnpack. continue } err = os.Mkdir(outputName, fi.Mode()) if err != nil && !errors.Is(err, os.ErrExist) { err2 = fmt.Errorf("os.Mkdir(%q): %w", outputName, err) break } log.Tracef("created directory %q", outputName) continue } var f io.WriteCloser f, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) if err != nil { err2 = fmt.Errorf("os.OpenFile(): %w", err) break } _, err = io.Copy(f, zr) if err != nil { _ = f.Close() err2 = fmt.Errorf("io.Copy(): %w", err) break </s> add if name != "" { files = append(files, name)
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
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 keep replace replace replace replace replace replace replace replace keep
<mask> <mask> fi := zf.FileInfo() <mask> inputNameOnly := fi.Name() <mask> if inputNameOnly == "" { <mask> continue <mask> } <mask> <mask> outputName := filepath.Join(outdir, inputNameOnly) <mask> <mask> if fi.IsDir() { <mask> if inputNameOnly == "AdGuardHome" { <mask> // Top-level AdGuardHome/. Skip it. <mask> // <mask> // TODO(a.garipov): See the similar todo in <mask> // tarGzFileUnpack. <mask> continue <mask> } <mask> <mask> err = os.Mkdir(outputName, fi.Mode()) <mask> if err != nil && !errors.Is(err, os.ErrExist) { <mask> err2 = fmt.Errorf("os.Mkdir(%q): %w", outputName, err) <mask> <mask> break <mask> } <mask> <mask> log.Tracef("created directory %q", outputName) <mask> <mask> continue <mask> } <mask> <mask> var f io.WriteCloser <mask> f, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) <mask> if err != nil { <mask> err2 = fmt.Errorf("os.OpenFile(): %w", err) <mask> break <mask> } <mask> _, err = io.Copy(f, zr) <mask> if err != nil { <mask> _ = f.Close() <mask> err2 = fmt.Errorf("io.Copy(): %w", err) <mask> break <mask> } <mask> err = f.Close() <mask> if err != nil { <mask> err2 = fmt.Errorf("f.Close(): %w", err) <mask> break <mask> } <mask> <mask> log.Tracef("created file %s", outputName) <mask> files = append(files, inputNameOnly) <mask> } </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove var f io.WriteCloser f, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.FileMode(header.Mode&0o777)) if err != nil { err2 = fmt.Errorf("os.OpenFile(%s): %w", outputName, err) break } _, err = io.Copy(f, tarReader) if err != nil { _ = f.Close() err2 = fmt.Errorf("io.Copy(): %w", err) break } err = f.Close() if err != nil { err2 = fmt.Errorf("f.Close(): %w", err) break </s> add err = os.Mkdir(outputName, fi.Mode()) if err != nil && !errors.Is(err, os.ErrExist) { return "", fmt.Errorf("os.Mkdir(%q): %w", outputName, err) </s> remove _, inputNameOnly := filepath.Split(header.Name) if inputNameOnly == "" { continue </s> add break </s> remove if header.Typeflag == tar.TypeDir { if inputNameOnly == "AdGuardHome" { // Top-level AdGuardHome/. Skip it. // // TODO(a.garipov): This whole package needs to // be rewritten and covered in more integration // tests. It has weird assumptions and file // mode issues. continue } </s> add if name != "" { files = append(files, name) } } </s> remove err = os.Mkdir(outputName, os.FileMode(header.Mode&0o777)) if err != nil && !errors.Is(err, os.ErrExist) { err2 = fmt.Errorf("os.Mkdir(%q): %w", outputName, err) </s> add return files, err } </s> remove } </s> add } else if err != nil { err = fmt.Errorf("tarReader.Next(): %w", err)
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> log.Tracef("created file %s", outputName) <mask> files = append(files, inputNameOnly) <mask> } <mask> <mask> _ = zr.Close() <mask> return files, err2 <mask> } <mask> <mask> // Copy file on disk <mask> func copyFile(src, dst string) error { <mask> d, e := os.ReadFile(src) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove err = f.Close() if err != nil { err2 = fmt.Errorf("f.Close(): %w", err) break } log.Tracef("created file %s", outputName) files = append(files, inputNameOnly) </s> add </s> remove log.Debug("updater: created file %s", outputName) files = append(files, header.Name) </s> add log.Tracef("created directory %q", outputName) return "", nil </s> remove _ = gzReader.Close() return files, err2 </s> add var wc io.WriteCloser wc, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) if err != nil { return "", fmt.Errorf("os.OpenFile(): %w", err) } defer func() { err = errors.WithDeferred(err, wc.Close()) }() _, err = io.Copy(wc, rc) if err != nil { return "", fmt.Errorf("io.Copy(): %w", err) } log.Tracef("created file %s", outputName) return name, nil </s> remove var f io.WriteCloser f, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.FileMode(header.Mode&0o777)) if err != nil { err2 = fmt.Errorf("os.OpenFile(%s): %w", outputName, err) break } _, err = io.Copy(f, tarReader) if err != nil { _ = f.Close() err2 = fmt.Errorf("io.Copy(): %w", err) break } err = f.Close() if err != nil { err2 = fmt.Errorf("f.Close(): %w", err) break </s> add err = os.Mkdir(outputName, fi.Mode()) if err != nil && !errors.Is(err, os.ErrExist) { return "", fmt.Errorf("os.Mkdir(%q): %w", outputName, err) </s> remove fi := zf.FileInfo() inputNameOnly := fi.Name() if inputNameOnly == "" { continue } outputName := filepath.Join(outdir, inputNameOnly) if fi.IsDir() { if inputNameOnly == "AdGuardHome" { // Top-level AdGuardHome/. Skip it. // // TODO(a.garipov): See the similar todo in // tarGzFileUnpack. continue } err = os.Mkdir(outputName, fi.Mode()) if err != nil && !errors.Is(err, os.ErrExist) { err2 = fmt.Errorf("os.Mkdir(%q): %w", outputName, err) break } log.Tracef("created directory %q", outputName) continue } var f io.WriteCloser f, err = os.OpenFile(outputName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) if err != nil { err2 = fmt.Errorf("os.OpenFile(): %w", err) break } _, err = io.Copy(f, zr) if err != nil { _ = f.Close() err2 = fmt.Errorf("io.Copy(): %w", err) break </s> add if name != "" { files = append(files, name) </s> remove if header.Typeflag == tar.TypeDir { if inputNameOnly == "AdGuardHome" { // Top-level AdGuardHome/. Skip it. // // TODO(a.garipov): This whole package needs to // be rewritten and covered in more integration // tests. It has weird assumptions and file // mode issues. continue } </s> add if name != "" { files = append(files, name) } }
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/updater/updater.go
keep keep add keep keep keep keep keep
<mask> log.Fatal(err) <mask> } <mask> <mask> URL := fmt.Sprintf("http://%s", address) <mask> log.Println("Go to " + URL) <mask> log.Fatal(http.ListenAndServe(address, nil)) <mask> } <mask> </s> Start DHCP on launch if it's enabled in config. </s> remove // implement </s> add </s> add "github.com/joomcode/errorx"
https://github.com/AdguardTeam/AdGuardHome/commit/03effab345e2bc9e77926a64acd426f71b5004cd
app.go
keep keep keep add keep keep keep keep
<mask> "net" <mask> "net/http" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/dhcpd" <mask> ) <mask> <mask> var dhcpServer = dhcpd.Server{} <mask> </s> Start DHCP on launch if it's enabled in config. </s> add err = startDHCPServer() if err != nil { log.Fatal(err) } </s> remove // implement </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/03effab345e2bc9e77926a64acd426f71b5004cd
dhcp.go
keep keep keep keep replace keep keep keep keep keep
<mask> return <mask> } <mask> } <mask> <mask> // implement <mask> func handleDHCPFindActiveServer(w http.ResponseWriter, r *http.Request) { <mask> found, err := dhcpd.CheckIfOtherDHCPServersPresent(config.DHCP.InterfaceName) <mask> result := map[string]interface{}{} <mask> if err != nil { <mask> result["error"] = err.Error() </s> Start DHCP on launch if it's enabled in config. </s> add err = startDHCPServer() if err != nil { log.Fatal(err) } </s> add "github.com/joomcode/errorx"
https://github.com/AdguardTeam/AdGuardHome/commit/03effab345e2bc9e77926a64acd426f71b5004cd
dhcp.go
replace replace replace replace replace replace replace replace
<mask> coverage: <mask> status: <mask> project: <mask> default: <mask> target: 40% <mask> threshold: null <mask> patch: false <mask> changes: false </s> Pull request: all: reformat yaml, add yaml formatting standard Merge in DNS/adguard-home from 2297-yaml to master Closes #2297. Squashed commit of the following: commit 85df3a38a14adb1965944ddf14b197c12a213057 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:52:22 2020 +0300 all: improve HACKING.md commit 079acdfe41cc12ab6aa13d7c28dcbf7b7b3c8380 Merge: 202ea078e 3045da174 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:50:34 2020 +0300 Merge branch 'master' into 2297-yaml commit 202ea078e29d88871a32ac6e668dfae6db802bab Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 12 20:25:42 2020 +0300 all: reformat yaml, add yaml formatting standard </s> remove # Comment to post when closing a stale issue. Set to `false` to disable closeComment: false </s> add # Comment to post when closing a stale issue. Set to `false` to disable. 'closeComment': false </s> remove test: runs-on: ${{ matrix.os }} env: GO111MODULE: on GOPROXY: https://goproxy.io strategy: fail-fast: false matrix: os: - ubuntu-latest - macOS-latest - windows-latest steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v2 with: go-version: ${{ env.GO_VERSION }} </s> add 'docker': 'runs-on': 'ubuntu-latest' 'needs': 'test' 'steps': - 'name': 'Checkout' 'uses': 'actions/checkout@v2' 'with': 'fetch-depth': 0 - 'name': 'Set up QEMU' 'uses': 'docker/setup-qemu-action@v1' - 'name': 'Set up Docker Buildx' 'uses': 'docker/setup-buildx-action@v1' - 'name': 'Docker Buildx (build)' 'run': 'make docker-multi-arch' </s> remove It operates as a DNS server that re-routes tracking domains to a "black hole," thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers -- both share a lot of common code. grade: stable confinement: strict publish: false license: GPL-3.0 extra_files: - source: scripts/snap/local/adguard-home-web.sh destination: adguard-home-web.sh mode: 0755 - source: scripts/snap/gui/adguard-home-web.desktop destination: meta/gui/adguard-home-web.desktop mode: 0644 - source: scripts/snap/gui/adguard-home-web.png destination: meta/gui/adguard-home-web.png mode: 0644 apps: adguard-home: command: AdGuardHome -w $SNAP_DATA --no-check-update plugs: # Add the "netrwork-bind" plug to bind to interfaces. - network-bind # Add the "netrwork-control" plug to be able to bind to ports below # 1024 (cap_net_bind_service) and also to bind to a particular # interface using SO_BINDTODEVICE (cap_net_raw). - network-control daemon: simple adguard-home-web: command: adguard-home-web.sh plugs: [ desktop ] </s> add It operates as a DNS server that re-routes tracking domains to a "black hole," thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers -- both share a lot of common code. 'grade': 'stable' 'confinement': 'strict' 'publish': false 'license': 'GPL-3.0' 'extra_files': - 'source': 'scripts/snap/local/adguard-home-web.sh' 'destination': 'adguard-home-web.sh' 'mode': 0755 - 'source': 'scripts/snap/gui/adguard-home-web.desktop' 'destination': 'meta/gui/adguard-home-web.desktop' 'mode': 0644 - 'source': 'scripts/snap/gui/adguard-home-web.png' 'destination': 'meta/gui/adguard-home-web.png' 'mode': 0644 'apps': 'adguard-home': 'command': 'AdGuardHome -w $SNAP_DATA --no-check-update' 'plugs': # Add the "netrwork-bind" plug to bind to interfaces. - 'network-bind' # Add the "netrwork-control" plug to be able to bind to ports below # 1024 (cap_net_bind_service) and also to bind to a particular # interface using SO_BINDTODEVICE (cap_net_raw). - 'network-control' 'daemon': 'simple' 'adguard-home-web': 'command': 'adguard-home-web.sh' 'plugs': - 'desktop' </s> remove # Number of days of inactivity before an issue becomes stale daysUntilStale: 60 # Number of days of inactivity before a stale issue is closed daysUntilClose: 7 # Issues with these labels will never be considered stale exemptLabels: - 'bug' - 'enhancement' - 'feature request' - 'localization' # Label to use when marking an issue as stale staleLabel: 'wontfix' # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > </s> add # Number of days of inactivity before an issue becomes stale. 'daysUntilStale': 60 # Number of days of inactivity before a stale issue is closed. 'daysUntilClose': 7 # Issues with these labels will never be considered stale. 'exemptLabels': - 'bug' - 'enhancement' - 'feature request' - 'localization' # Label to use when marking an issue as stale. 'staleLabel': 'wontfix' # Comment to post when marking an issue as stale. Set to `false` to disable. 'markComment': > </s> remove jobs: </s> add 'jobs': 'test': 'runs-on': '${{ matrix.os }}' 'env': 'GO111MODULE': 'on' 'GOPROXY': 'https://goproxy.io' 'strategy': 'fail-fast': false 'matrix': 'os': - 'ubuntu-latest' - 'macOS-latest' - 'windows-latest' 'steps': - 'name': 'Checkout' 'uses': 'actions/checkout@v2' 'with': 'fetch-depth': 0 - 'name': 'Set up Go' 'uses': 'actions/setup-go@v2' 'with': 'go-version': '${{ env.GO_VERSION }}' - 'name': 'Set up Node' 'uses': 'actions/setup-node@v1' 'with': 'node-version': '${{ env.NODE_VERSION }}' - 'name': 'Set up Go modules cache' 'uses': 'actions/cache@v2' 'with': 'path': '~/go/pkg/mod' 'key': "${{ runner.os }}-go-${{ hashFiles('go.sum') }}" 'restore-keys': '${{ runner.os }}-go-' - 'name': 'Get npm cache directory' 'id': 'npm-cache' 'run': 'echo "::set-output name=dir::$(npm config get cache)"' - 'name': 'Set up npm cache' 'uses': 'actions/cache@v2' 'with': 'path': '${{ steps.npm-cache.outputs.dir }}' 'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}" 'restore-keys': '${{ runner.os }}-node-' - 'name': 'Run make ci' 'shell': 'bash' 'run': 'make ci' - 'name': 'Upload coverage' 'uses': 'codecov/codecov-action@v1' 'if': "success() && matrix.os == 'ubuntu-latest'" 'with': 'token': '${{ secrets.CODECOV_TOKEN }}' 'file': './coverage.txt' 'app': 'runs-on': 'ubuntu-latest' 'needs': 'test' 'steps': - 'name': 'Checkout' 'uses': 'actions/checkout@v2' 'with': 'fetch-depth': 0 - 'name': 'Set up Go' 'uses': 'actions/setup-go@v2' 'with': 'go-version': '${{ env.GO_VERSION }}' - 'name': 'Set up Node' 'uses': 'actions/setup-node@v1' 'with': 'node-version': '${{ env.NODE_VERSION }}' - 'name': 'Set up Go modules cache' 'uses': 'actions/cache@v2' 'with': 'path': '~/go/pkg/mod' 'key': "${{ runner.os }}-go-${{ hashFiles('go.sum') }}" 'restore-keys': '${{ runner.os }}-go-' - 'name': 'Get npm cache directory' 'id': 'npm-cache' 'run': 'echo "::set-output name=dir::$(npm config get cache)"' - 'name': 'Set up node_modules cache' 'uses': 'actions/cache@v2' 'with': 'path': '${{ steps.npm-cache.outputs.dir }}' 'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}" 'restore-keys': '${{ runner.os }}-node-' - 'name': 'Set up Snapcraft' 'run': 'sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft' - 'name': 'Set up GoReleaser' 'run': 'curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR="$(go env GOPATH)/bin" sh' - 'name': 'Run snapshot build' 'run': 'make release' </s> remove name: golangci-lint on: push: tags: - v* branches: - '*' pull_request: jobs: golangci: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: golangci-lint uses: golangci/golangci-lint-action@v2.3.0 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.32 eslint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install modules run: npm --prefix client ci - name: Run ESLint run: npm --prefix client run lint notify: needs: [golangci,eslint] # Secrets are not passed to workflows that are triggered by a pull request from a fork if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} runs-on: ubuntu-latest steps: - name: Conclusion uses: technote-space/workflow-conclusion-action@v1 - name: Send Slack notif uses: 8398a7/action-slack@v3 with: status: ${{ env.WORKFLOW_CONCLUSION }} fields: repo,message,commit,author env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} </s> add 'name': 'golangci-lint' 'on': 'push': 'tags': - 'v*' 'branches': - '*' 'pull_request': 'jobs': 'golangci': 'runs-on': 'ubuntu-latest' 'steps': - 'uses': 'actions/checkout@v2' - 'name': 'golangci-lint' 'uses': 'golangci/golangci-lint-action@v2.3.0' 'with': # This field is required. Don't set the patch version to always use # the latest patch version. 'version': 'v1.32' 'eslint': 'runs-on': 'ubuntu-latest' 'steps': - 'uses': 'actions/checkout@v2' - 'name': 'Install modules' 'run': 'npm --prefix client ci' - 'name': 'Run ESLint' 'run': 'npm --prefix client run lint' 'notify': 'needs': - 'golangci' - 'eslint' # Secrets are not passed to workflows that are triggered by a pull request # from a fork. 'if': "${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}" 'runs-on': 'ubuntu-latest' 'steps': - 'name': 'Conclusion' 'uses': 'technote-space/workflow-conclusion-action@v1' - 'name': 'Send Slack notif' 'uses': '8398a7/action-slack@v3' 'with': 'status': '${{ env.WORKFLOW_CONCLUSION }}' 'fields': 'repo, message, commit, author' 'env': 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}' 'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}'
https://github.com/AdguardTeam/AdGuardHome/commit/046ec13fdc5ec008fd4ac9b77cc943a96be2605c
.codecov.yml
replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep replace replace
<mask> # Number of days of inactivity before an issue becomes stale <mask> daysUntilStale: 60 <mask> # Number of days of inactivity before a stale issue is closed <mask> daysUntilClose: 7 <mask> # Issues with these labels will never be considered stale <mask> exemptLabels: <mask> - 'bug' <mask> - 'enhancement' <mask> - 'feature request' <mask> - 'localization' <mask> # Label to use when marking an issue as stale <mask> staleLabel: 'wontfix' <mask> # Comment to post when marking an issue as stale. Set to `false` to disable <mask> markComment: > <mask> This issue has been automatically marked as stale because it has not had <mask> recent activity. It will be closed if no further activity occurs. Thank you <mask> for your contributions. <mask> # Comment to post when closing a stale issue. Set to `false` to disable <mask> closeComment: false </s> Pull request: all: reformat yaml, add yaml formatting standard Merge in DNS/adguard-home from 2297-yaml to master Closes #2297. Squashed commit of the following: commit 85df3a38a14adb1965944ddf14b197c12a213057 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:52:22 2020 +0300 all: improve HACKING.md commit 079acdfe41cc12ab6aa13d7c28dcbf7b7b3c8380 Merge: 202ea078e 3045da174 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:50:34 2020 +0300 Merge branch 'master' into 2297-yaml commit 202ea078e29d88871a32ac6e668dfae6db802bab Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 12 20:25:42 2020 +0300 all: reformat yaml, add yaml formatting standard </s> remove exclude: # structcheck cannot detect usages while they're there - .parentalServer. is unused - .safeBrowsingServer. is unused # errcheck - Error return value of .s.closeConn. is not checked - Error return value of ..*.Shutdown. # goconst - string .forcesafesearch.google.com. has 3 occurrences # gosec: Profiling endpoint is automatically exposed on /debug/pprof - G108 # gosec: Subprocess launched with function call as argument or cmd arguments - G204 # gosec: Potential DoS vulnerability via decompression bomb - G110 # gosec: Expect WriteFile permissions to be 0600 or less - G306 </s> add 'exclude': # structcheck cannot detect usages while they're there - '.parentalServer. is unused' - '.safeBrowsingServer. is unused' # errcheck - 'Error return value of .s.closeConn. is not checked' - 'Error return value of ..*.Shutdown.' # goconst - 'string .forcesafesearch.google.com. has 3 occurrences' # gosec: Profiling endpoint is automatically exposed on /debug/pprof - 'G108' # gosec: Subprocess launched with function call as argument or cmd arguments - 'G204' # gosec: Potential DoS vulnerability via decompression bomb - 'G110' # gosec: Expect WriteFile permissions to be 0600 or less - 'G306' </s> remove It operates as a DNS server that re-routes tracking domains to a "black hole," thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers -- both share a lot of common code. grade: stable confinement: strict publish: false license: GPL-3.0 extra_files: - source: scripts/snap/local/adguard-home-web.sh destination: adguard-home-web.sh mode: 0755 - source: scripts/snap/gui/adguard-home-web.desktop destination: meta/gui/adguard-home-web.desktop mode: 0644 - source: scripts/snap/gui/adguard-home-web.png destination: meta/gui/adguard-home-web.png mode: 0644 apps: adguard-home: command: AdGuardHome -w $SNAP_DATA --no-check-update plugs: # Add the "netrwork-bind" plug to bind to interfaces. - network-bind # Add the "netrwork-control" plug to be able to bind to ports below # 1024 (cap_net_bind_service) and also to bind to a particular # interface using SO_BINDTODEVICE (cap_net_raw). - network-control daemon: simple adguard-home-web: command: adguard-home-web.sh plugs: [ desktop ] </s> add It operates as a DNS server that re-routes tracking domains to a "black hole," thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers -- both share a lot of common code. 'grade': 'stable' 'confinement': 'strict' 'publish': false 'license': 'GPL-3.0' 'extra_files': - 'source': 'scripts/snap/local/adguard-home-web.sh' 'destination': 'adguard-home-web.sh' 'mode': 0755 - 'source': 'scripts/snap/gui/adguard-home-web.desktop' 'destination': 'meta/gui/adguard-home-web.desktop' 'mode': 0644 - 'source': 'scripts/snap/gui/adguard-home-web.png' 'destination': 'meta/gui/adguard-home-web.png' 'mode': 0644 'apps': 'adguard-home': 'command': 'AdGuardHome -w $SNAP_DATA --no-check-update' 'plugs': # Add the "netrwork-bind" plug to bind to interfaces. - 'network-bind' # Add the "netrwork-control" plug to be able to bind to ports below # 1024 (cap_net_bind_service) and also to bind to a particular # interface using SO_BINDTODEVICE (cap_net_raw). - 'network-control' 'daemon': 'simple' 'adguard-home-web': 'command': 'adguard-home-web.sh' 'plugs': - 'desktop' </s> remove issues: </s> add 'issues': </s> remove skip-files: - ".*generated.*" - dnsfilter/rule_to_regexp.go - util/pprof.go - ".*_test.go" - client/.* - build/.* - dist/.* </s> add 'skip-files': - '.*generated.*' - 'dnsfilter/rule_to_regexp.go' - 'util/pprof.go' - '.*_test.go' - 'client/.*' - 'build/.*' - 'dist/.*' </s> remove linters: enable: - deadcode - errcheck - govet - ineffassign - staticcheck - unused - varcheck - bodyclose - depguard - dupl - gocyclo - goimports - golint - gosec - misspell - stylecheck - unconvert disable-all: true fast: true </s> add 'linters': 'enable': - 'bodyclose' - 'deadcode' - 'depguard' - 'dupl' - 'errcheck' - 'gocyclo' - 'goimports' - 'golint' - 'gosec' - 'govet' - 'ineffassign' - 'misspell' - 'staticcheck' - 'stylecheck' - 'unconvert' - 'unused' - 'varcheck' 'disable-all': true 'fast': true
https://github.com/AdguardTeam/AdGuardHome/commit/046ec13fdc5ec008fd4ac9b77cc943a96be2605c
.github/stale.yml
replace keep replace replace replace keep keep keep keep keep
<mask> name: build <mask> <mask> env: <mask> GO_VERSION: 1.14 <mask> NODE_VERSION: 13 <mask> <mask> on: <mask> push: <mask> branches: <mask> - '*' </s> Pull request: all: reformat yaml, add yaml formatting standard Merge in DNS/adguard-home from 2297-yaml to master Closes #2297. Squashed commit of the following: commit 85df3a38a14adb1965944ddf14b197c12a213057 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:52:22 2020 +0300 all: improve HACKING.md commit 079acdfe41cc12ab6aa13d7c28dcbf7b7b3c8380 Merge: 202ea078e 3045da174 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:50:34 2020 +0300 Merge branch 'master' into 2297-yaml commit 202ea078e29d88871a32ac6e668dfae6db802bab Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 12 20:25:42 2020 +0300 all: reformat yaml, add yaml formatting standard </s> remove on: push: branches: - '*' tags: - v* pull_request: </s> add 'on': 'push': 'branches': - '*' 'tags': - 'v*' 'pull_request': </s> remove name: golangci-lint on: push: tags: - v* branches: - '*' pull_request: jobs: golangci: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: golangci-lint uses: golangci/golangci-lint-action@v2.3.0 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.32 eslint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install modules run: npm --prefix client ci - name: Run ESLint run: npm --prefix client run lint notify: needs: [golangci,eslint] # Secrets are not passed to workflows that are triggered by a pull request from a fork if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} runs-on: ubuntu-latest steps: - name: Conclusion uses: technote-space/workflow-conclusion-action@v1 - name: Send Slack notif uses: 8398a7/action-slack@v3 with: status: ${{ env.WORKFLOW_CONCLUSION }} fields: repo,message,commit,author env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} </s> add 'name': 'golangci-lint' 'on': 'push': 'tags': - 'v*' 'branches': - '*' 'pull_request': 'jobs': 'golangci': 'runs-on': 'ubuntu-latest' 'steps': - 'uses': 'actions/checkout@v2' - 'name': 'golangci-lint' 'uses': 'golangci/golangci-lint-action@v2.3.0' 'with': # This field is required. Don't set the patch version to always use # the latest patch version. 'version': 'v1.32' 'eslint': 'runs-on': 'ubuntu-latest' 'steps': - 'uses': 'actions/checkout@v2' - 'name': 'Install modules' 'run': 'npm --prefix client ci' - 'name': 'Run ESLint' 'run': 'npm --prefix client run lint' 'notify': 'needs': - 'golangci' - 'eslint' # Secrets are not passed to workflows that are triggered by a pull request # from a fork. 'if': "${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}" 'runs-on': 'ubuntu-latest' 'steps': - 'name': 'Conclusion' 'uses': 'technote-space/workflow-conclusion-action@v1' - 'name': 'Send Slack notif' 'uses': '8398a7/action-slack@v3' 'with': 'status': '${{ env.WORKFLOW_CONCLUSION }}' 'fields': 'repo, message, commit, author' 'env': 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}' 'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}' </s> remove - name: Set up Node uses: actions/setup-node@v1 with: node-version: ${{ env.NODE_VERSION }} - name: Set up Go modules cache uses: actions/cache@v2 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }} restore-keys: | ${{ runner.os }}-go- - name: Get npm cache directory id: npm-cache run: | echo "::set-output name=dir::$(npm config get cache)" - name: Set up npm cache uses: actions/cache@v2 with: path: ${{ steps.npm-cache.outputs.dir }} key: ${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - name: Run make ci shell: bash run: | make ci - name: Upload coverage uses: codecov/codecov-action@v1 if: success() && matrix.os == 'ubuntu-latest' with: token: ${{ secrets.CODECOV_TOKEN }} file: ./coverage.txt app: runs-on: ubuntu-latest needs: test steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v2 with: go-version: ${{ env.GO_VERSION }} - name: Set up Node uses: actions/setup-node@v1 with: node-version: ${{ env.NODE_VERSION }} - name: Set up Go modules cache uses: actions/cache@v2 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }} restore-keys: | ${{ runner.os }}-go- - name: Get npm cache directory id: npm-cache run: | echo "::set-output name=dir::$(npm config get cache)" - name: Set up node_modules cache uses: actions/cache@v2 with: path: ${{ steps.npm-cache.outputs.dir }} key: ${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - name: Set up Snapcraft run: | sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft - name: Set up GoReleaser run: | curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR="$(go env GOPATH)/bin" sh - name: Run snapshot build run: | make release docker: runs-on: ubuntu-latest needs: test steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Docker Buildx (build) run: | make docker-multi-arch notify: needs: [app, docker] # Secrets are not passed to workflows that are triggered by a pull request from a fork if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} runs-on: ubuntu-latest steps: - name: Conclusion uses: technote-space/workflow-conclusion-action@v1 - name: Send Slack notif uses: 8398a7/action-slack@v3 with: status: ${{ env.WORKFLOW_CONCLUSION }} fields: repo,message,commit,author env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} </s> add 'notify': 'needs': - 'app' - 'docker' # Secrets are not passed to workflows that are triggered by a pull request # from a fork. 'if': "${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}" 'runs-on': 'ubuntu-latest' 'steps': - 'name': 'Conclusion' 'uses': 'technote-space/workflow-conclusion-action@v1' - 'name': 'Send Slack notif' 'uses': '8398a7/action-slack@v3' 'with': 'status': '${{ env.WORKFLOW_CONCLUSION }}' 'fields': 'repo, message, commit, author' 'env': 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}' 'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}' </s> remove test: runs-on: ${{ matrix.os }} env: GO111MODULE: on GOPROXY: https://goproxy.io strategy: fail-fast: false matrix: os: - ubuntu-latest - macOS-latest - windows-latest steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v2 with: go-version: ${{ env.GO_VERSION }} </s> add 'docker': 'runs-on': 'ubuntu-latest' 'needs': 'test' 'steps': - 'name': 'Checkout' 'uses': 'actions/checkout@v2' 'with': 'fetch-depth': 0 - 'name': 'Set up QEMU' 'uses': 'docker/setup-qemu-action@v1' - 'name': 'Set up Docker Buildx' 'uses': 'docker/setup-buildx-action@v1' - 'name': 'Docker Buildx (build)' 'run': 'make docker-multi-arch' </s> remove archives: - # Archive name template. # Defaults: # - if format is `tar.gz`, `tar.xz`, `gz` or `zip`: # - `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}` # - if format is `binary`: # - `{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}` name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}" wrap_in_directory: "AdGuardHome" format_overrides: - goos: windows format: zip - goos: darwin format: zip files: - LICENSE.txt - README.md </s> add 'archives': - # Archive name template. # Defaults: # - if format is `tar.gz`, `tar.xz`, `gz` or `zip`: # - `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}` # - if format is `binary`: # - `{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}` 'name_template': '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}' 'wrap_in_directory': 'AdGuardHome' 'format_overrides': - 'goos': 'windows' 'format': 'zip' - 'goos': 'darwin' 'format': 'zip' 'files': - 'LICENSE.txt' - 'README.md'
https://github.com/AdguardTeam/AdGuardHome/commit/046ec13fdc5ec008fd4ac9b77cc943a96be2605c
.github/workflows/build.yml
keep keep keep replace replace replace replace replace replace replace keep replace
<mask> GO_VERSION: 1.14 <mask> NODE_VERSION: 13 <mask> <mask> on: <mask> push: <mask> branches: <mask> - '*' <mask> tags: <mask> - v* <mask> pull_request: <mask> <mask> jobs: </s> Pull request: all: reformat yaml, add yaml formatting standard Merge in DNS/adguard-home from 2297-yaml to master Closes #2297. Squashed commit of the following: commit 85df3a38a14adb1965944ddf14b197c12a213057 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:52:22 2020 +0300 all: improve HACKING.md commit 079acdfe41cc12ab6aa13d7c28dcbf7b7b3c8380 Merge: 202ea078e 3045da174 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:50:34 2020 +0300 Merge branch 'master' into 2297-yaml commit 202ea078e29d88871a32ac6e668dfae6db802bab Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 12 20:25:42 2020 +0300 all: reformat yaml, add yaml formatting standard </s> remove env: GO_VERSION: 1.14 NODE_VERSION: 13 </s> add 'env': 'GO_VERSION': '1.14' 'NODE_VERSION': '13' </s> remove name: build </s> add 'name': 'build' </s> remove name: golangci-lint on: push: tags: - v* branches: - '*' pull_request: jobs: golangci: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: golangci-lint uses: golangci/golangci-lint-action@v2.3.0 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.32 eslint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install modules run: npm --prefix client ci - name: Run ESLint run: npm --prefix client run lint notify: needs: [golangci,eslint] # Secrets are not passed to workflows that are triggered by a pull request from a fork if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} runs-on: ubuntu-latest steps: - name: Conclusion uses: technote-space/workflow-conclusion-action@v1 - name: Send Slack notif uses: 8398a7/action-slack@v3 with: status: ${{ env.WORKFLOW_CONCLUSION }} fields: repo,message,commit,author env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} </s> add 'name': 'golangci-lint' 'on': 'push': 'tags': - 'v*' 'branches': - '*' 'pull_request': 'jobs': 'golangci': 'runs-on': 'ubuntu-latest' 'steps': - 'uses': 'actions/checkout@v2' - 'name': 'golangci-lint' 'uses': 'golangci/golangci-lint-action@v2.3.0' 'with': # This field is required. Don't set the patch version to always use # the latest patch version. 'version': 'v1.32' 'eslint': 'runs-on': 'ubuntu-latest' 'steps': - 'uses': 'actions/checkout@v2' - 'name': 'Install modules' 'run': 'npm --prefix client ci' - 'name': 'Run ESLint' 'run': 'npm --prefix client run lint' 'notify': 'needs': - 'golangci' - 'eslint' # Secrets are not passed to workflows that are triggered by a pull request # from a fork. 'if': "${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}" 'runs-on': 'ubuntu-latest' 'steps': - 'name': 'Conclusion' 'uses': 'technote-space/workflow-conclusion-action@v1' - 'name': 'Send Slack notif' 'uses': '8398a7/action-slack@v3' 'with': 'status': '${{ env.WORKFLOW_CONCLUSION }}' 'fields': 'repo, message, commit, author' 'env': 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}' 'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}' </s> remove test: runs-on: ${{ matrix.os }} env: GO111MODULE: on GOPROXY: https://goproxy.io strategy: fail-fast: false matrix: os: - ubuntu-latest - macOS-latest - windows-latest steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v2 with: go-version: ${{ env.GO_VERSION }} </s> add 'docker': 'runs-on': 'ubuntu-latest' 'needs': 'test' 'steps': - 'name': 'Checkout' 'uses': 'actions/checkout@v2' 'with': 'fetch-depth': 0 - 'name': 'Set up QEMU' 'uses': 'docker/setup-qemu-action@v1' - 'name': 'Set up Docker Buildx' 'uses': 'docker/setup-buildx-action@v1' - 'name': 'Docker Buildx (build)' 'run': 'make docker-multi-arch' </s> remove builds: - main: ./main.go ldflags: - -s -w -X main.version={{.Version}} -X main.channel={{.Env.CHANNEL}} -X main.goarm={{.Env.GOARM}} env: - CGO_ENABLED=0 goos: - darwin - linux - freebsd - windows goarch: - 386 - amd64 - arm - arm64 - mips - mipsle - mips64 - mips64le goarm: - 5 - 6 - 7 gomips: - softfloat ignore: - goos: freebsd goarch: mips - goos: freebsd goarch: mipsle </s> add 'builds': - 'main': './main.go' 'ldflags': - '-s -w -X main.version={{.Version}} -X main.channel={{.Env.CHANNEL}} -X main.goarm={{.Env.GOARM}}' 'env': - 'CGO_ENABLED=0' 'goos': - 'darwin' - 'linux' - 'freebsd' - 'windows' 'goarch': - '386' - 'amd64' - 'arm' - 'arm64' - 'mips' - 'mipsle' - 'mips64' - 'mips64le' 'goarm': - '5' - '6' - '7' 'gomips': - 'softfloat' 'ignore': - 'goos': 'freebsd' 'goarch': 'mips' - 'goos': 'freebsd' 'goarch': 'mipsle'
https://github.com/AdguardTeam/AdGuardHome/commit/046ec13fdc5ec008fd4ac9b77cc943a96be2605c
.github/workflows/build.yml
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 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
<mask> pull_request: <mask> <mask> jobs: <mask> <mask> test: <mask> runs-on: ${{ matrix.os }} <mask> env: <mask> GO111MODULE: on <mask> GOPROXY: https://goproxy.io <mask> strategy: <mask> fail-fast: false <mask> matrix: <mask> os: <mask> - ubuntu-latest <mask> - macOS-latest <mask> - windows-latest <mask> steps: <mask> - <mask> name: Checkout <mask> uses: actions/checkout@v2 <mask> with: <mask> fetch-depth: 0 <mask> - <mask> name: Set up Go <mask> uses: actions/setup-go@v2 <mask> with: <mask> go-version: ${{ env.GO_VERSION }} <mask> <mask> - <mask> name: Set up Node <mask> uses: actions/setup-node@v1 <mask> with: <mask> node-version: ${{ env.NODE_VERSION }} <mask> - <mask> name: Set up Go modules cache <mask> uses: actions/cache@v2 <mask> with: <mask> path: ~/go/pkg/mod <mask> key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }} <mask> restore-keys: | <mask> ${{ runner.os }}-go- <mask> - <mask> name: Get npm cache directory <mask> id: npm-cache <mask> run: | <mask> echo "::set-output name=dir::$(npm config get cache)" <mask> - <mask> name: Set up npm cache <mask> uses: actions/cache@v2 <mask> with: <mask> path: ${{ steps.npm-cache.outputs.dir }} <mask> key: ${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }} <mask> restore-keys: | <mask> ${{ runner.os }}-node- <mask> - <mask> name: Run make ci <mask> shell: bash <mask> run: | <mask> make ci <mask> - <mask> name: Upload coverage <mask> uses: codecov/codecov-action@v1 <mask> if: success() && matrix.os == 'ubuntu-latest' <mask> with: <mask> token: ${{ secrets.CODECOV_TOKEN }} <mask> file: ./coverage.txt <mask> <mask> app: <mask> runs-on: ubuntu-latest <mask> needs: test <mask> steps: <mask> - <mask> name: Checkout <mask> uses: actions/checkout@v2 <mask> with: <mask> fetch-depth: 0 <mask> - <mask> name: Set up Go <mask> uses: actions/setup-go@v2 <mask> with: <mask> go-version: ${{ env.GO_VERSION }} <mask> - <mask> name: Set up Node <mask> uses: actions/setup-node@v1 <mask> with: <mask> node-version: ${{ env.NODE_VERSION }} <mask> - <mask> name: Set up Go modules cache <mask> uses: actions/cache@v2 <mask> with: <mask> path: ~/go/pkg/mod <mask> key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }} <mask> restore-keys: | <mask> ${{ runner.os }}-go- <mask> - <mask> name: Get npm cache directory <mask> id: npm-cache <mask> run: | <mask> echo "::set-output name=dir::$(npm config get cache)" <mask> - <mask> name: Set up node_modules cache <mask> uses: actions/cache@v2 <mask> with: <mask> path: ${{ steps.npm-cache.outputs.dir }} <mask> key: ${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }} <mask> restore-keys: | <mask> ${{ runner.os }}-node- <mask> - <mask> name: Set up Snapcraft <mask> run: | <mask> sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft <mask> - <mask> name: Set up GoReleaser <mask> run: | <mask> curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR="$(go env GOPATH)/bin" sh <mask> - <mask> name: Run snapshot build <mask> run: | <mask> make release <mask> <mask> docker: <mask> runs-on: ubuntu-latest <mask> needs: test <mask> steps: <mask> - <mask> name: Checkout <mask> uses: actions/checkout@v2 <mask> with: <mask> fetch-depth: 0 <mask> - <mask> name: Set up QEMU <mask> uses: docker/setup-qemu-action@v1 <mask> - <mask> name: Set up Docker Buildx <mask> uses: docker/setup-buildx-action@v1 <mask> - <mask> name: Docker Buildx (build) <mask> run: | <mask> make docker-multi-arch <mask> <mask> notify: <mask> needs: [app, docker] <mask> # Secrets are not passed to workflows that are triggered by a pull request from a fork <mask> if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} <mask> runs-on: ubuntu-latest <mask> steps: <mask> - <mask> name: Conclusion <mask> uses: technote-space/workflow-conclusion-action@v1 <mask> - <mask> name: Send Slack notif <mask> uses: 8398a7/action-slack@v3 <mask> with: <mask> status: ${{ env.WORKFLOW_CONCLUSION }} <mask> fields: repo,message,commit,author <mask> env: <mask> GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} <mask> SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} </s> Pull request: all: reformat yaml, add yaml formatting standard Merge in DNS/adguard-home from 2297-yaml to master Closes #2297. Squashed commit of the following: commit 85df3a38a14adb1965944ddf14b197c12a213057 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:52:22 2020 +0300 all: improve HACKING.md commit 079acdfe41cc12ab6aa13d7c28dcbf7b7b3c8380 Merge: 202ea078e 3045da174 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:50:34 2020 +0300 Merge branch 'master' into 2297-yaml commit 202ea078e29d88871a32ac6e668dfae6db802bab Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 12 20:25:42 2020 +0300 all: reformat yaml, add yaml formatting standard </s> remove name: golangci-lint on: push: tags: - v* branches: - '*' pull_request: jobs: golangci: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: golangci-lint uses: golangci/golangci-lint-action@v2.3.0 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.32 eslint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install modules run: npm --prefix client ci - name: Run ESLint run: npm --prefix client run lint notify: needs: [golangci,eslint] # Secrets are not passed to workflows that are triggered by a pull request from a fork if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} runs-on: ubuntu-latest steps: - name: Conclusion uses: technote-space/workflow-conclusion-action@v1 - name: Send Slack notif uses: 8398a7/action-slack@v3 with: status: ${{ env.WORKFLOW_CONCLUSION }} fields: repo,message,commit,author env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} </s> add 'name': 'golangci-lint' 'on': 'push': 'tags': - 'v*' 'branches': - '*' 'pull_request': 'jobs': 'golangci': 'runs-on': 'ubuntu-latest' 'steps': - 'uses': 'actions/checkout@v2' - 'name': 'golangci-lint' 'uses': 'golangci/golangci-lint-action@v2.3.0' 'with': # This field is required. Don't set the patch version to always use # the latest patch version. 'version': 'v1.32' 'eslint': 'runs-on': 'ubuntu-latest' 'steps': - 'uses': 'actions/checkout@v2' - 'name': 'Install modules' 'run': 'npm --prefix client ci' - 'name': 'Run ESLint' 'run': 'npm --prefix client run lint' 'notify': 'needs': - 'golangci' - 'eslint' # Secrets are not passed to workflows that are triggered by a pull request # from a fork. 'if': "${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}" 'runs-on': 'ubuntu-latest' 'steps': - 'name': 'Conclusion' 'uses': 'technote-space/workflow-conclusion-action@v1' - 'name': 'Send Slack notif' 'uses': '8398a7/action-slack@v3' 'with': 'status': '${{ env.WORKFLOW_CONCLUSION }}' 'fields': 'repo, message, commit, author' 'env': 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}' 'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}' </s> remove jobs: </s> add 'jobs': 'test': 'runs-on': '${{ matrix.os }}' 'env': 'GO111MODULE': 'on' 'GOPROXY': 'https://goproxy.io' 'strategy': 'fail-fast': false 'matrix': 'os': - 'ubuntu-latest' - 'macOS-latest' - 'windows-latest' 'steps': - 'name': 'Checkout' 'uses': 'actions/checkout@v2' 'with': 'fetch-depth': 0 - 'name': 'Set up Go' 'uses': 'actions/setup-go@v2' 'with': 'go-version': '${{ env.GO_VERSION }}' - 'name': 'Set up Node' 'uses': 'actions/setup-node@v1' 'with': 'node-version': '${{ env.NODE_VERSION }}' - 'name': 'Set up Go modules cache' 'uses': 'actions/cache@v2' 'with': 'path': '~/go/pkg/mod' 'key': "${{ runner.os }}-go-${{ hashFiles('go.sum') }}" 'restore-keys': '${{ runner.os }}-go-' - 'name': 'Get npm cache directory' 'id': 'npm-cache' 'run': 'echo "::set-output name=dir::$(npm config get cache)"' - 'name': 'Set up npm cache' 'uses': 'actions/cache@v2' 'with': 'path': '${{ steps.npm-cache.outputs.dir }}' 'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}" 'restore-keys': '${{ runner.os }}-node-' - 'name': 'Run make ci' 'shell': 'bash' 'run': 'make ci' - 'name': 'Upload coverage' 'uses': 'codecov/codecov-action@v1' 'if': "success() && matrix.os == 'ubuntu-latest'" 'with': 'token': '${{ secrets.CODECOV_TOKEN }}' 'file': './coverage.txt' 'app': 'runs-on': 'ubuntu-latest' 'needs': 'test' 'steps': - 'name': 'Checkout' 'uses': 'actions/checkout@v2' 'with': 'fetch-depth': 0 - 'name': 'Set up Go' 'uses': 'actions/setup-go@v2' 'with': 'go-version': '${{ env.GO_VERSION }}' - 'name': 'Set up Node' 'uses': 'actions/setup-node@v1' 'with': 'node-version': '${{ env.NODE_VERSION }}' - 'name': 'Set up Go modules cache' 'uses': 'actions/cache@v2' 'with': 'path': '~/go/pkg/mod' 'key': "${{ runner.os }}-go-${{ hashFiles('go.sum') }}" 'restore-keys': '${{ runner.os }}-go-' - 'name': 'Get npm cache directory' 'id': 'npm-cache' 'run': 'echo "::set-output name=dir::$(npm config get cache)"' - 'name': 'Set up node_modules cache' 'uses': 'actions/cache@v2' 'with': 'path': '${{ steps.npm-cache.outputs.dir }}' 'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}" 'restore-keys': '${{ runner.os }}-node-' - 'name': 'Set up Snapcraft' 'run': 'sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft' - 'name': 'Set up GoReleaser' 'run': 'curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR="$(go env GOPATH)/bin" sh' - 'name': 'Run snapshot build' 'run': 'make release' </s> remove on: push: branches: - '*' tags: - v* pull_request: </s> add 'on': 'push': 'branches': - '*' 'tags': - 'v*' 'pull_request': </s> remove snapcrafts: - name: adguard-home base: core18 name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' summary: Network-wide ads & trackers blocking DNS server description: | AdGuard Home is a network-wide software for blocking ads & tracking. After you set it up, it'll cover ALL your home devices, and you don't need any client-side software for that. </s> add 'snapcrafts': - 'name': 'adguard-home' 'base': 'core18' 'name_template': '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' 'summary': 'Network-wide ads & trackers blocking DNS server' 'description': | AdGuard Home is a network-wide software for blocking ads & tracking. After you set it up, it'll cover ALL your home devices, and you don't need any client-side software for that. </s> remove env: GO_VERSION: 1.14 NODE_VERSION: 13 </s> add 'env': 'GO_VERSION': '1.14' 'NODE_VERSION': '13'
https://github.com/AdguardTeam/AdGuardHome/commit/046ec13fdc5ec008fd4ac9b77cc943a96be2605c
.github/workflows/build.yml
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
<mask> name: golangci-lint <mask> on: <mask> push: <mask> tags: <mask> - v* <mask> branches: <mask> - '*' <mask> pull_request: <mask> jobs: <mask> golangci: <mask> runs-on: ubuntu-latest <mask> steps: <mask> - uses: actions/checkout@v2 <mask> - name: golangci-lint <mask> uses: golangci/golangci-lint-action@v2.3.0 <mask> with: <mask> # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. <mask> version: v1.32 <mask> <mask> eslint: <mask> runs-on: ubuntu-latest <mask> steps: <mask> - uses: actions/checkout@v2 <mask> - name: Install modules <mask> run: npm --prefix client ci <mask> - name: Run ESLint <mask> run: npm --prefix client run lint <mask> <mask> <mask> notify: <mask> needs: [golangci,eslint] <mask> # Secrets are not passed to workflows that are triggered by a pull request from a fork <mask> if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} <mask> runs-on: ubuntu-latest <mask> steps: <mask> - <mask> name: Conclusion <mask> uses: technote-space/workflow-conclusion-action@v1 <mask> - <mask> name: Send Slack notif <mask> uses: 8398a7/action-slack@v3 <mask> with: <mask> status: ${{ env.WORKFLOW_CONCLUSION }} <mask> fields: repo,message,commit,author <mask> env: <mask> GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} <mask> SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} </s> Pull request: all: reformat yaml, add yaml formatting standard Merge in DNS/adguard-home from 2297-yaml to master Closes #2297. Squashed commit of the following: commit 85df3a38a14adb1965944ddf14b197c12a213057 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:52:22 2020 +0300 all: improve HACKING.md commit 079acdfe41cc12ab6aa13d7c28dcbf7b7b3c8380 Merge: 202ea078e 3045da174 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:50:34 2020 +0300 Merge branch 'master' into 2297-yaml commit 202ea078e29d88871a32ac6e668dfae6db802bab Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 12 20:25:42 2020 +0300 all: reformat yaml, add yaml formatting standard </s> remove - name: Set up Node uses: actions/setup-node@v1 with: node-version: ${{ env.NODE_VERSION }} - name: Set up Go modules cache uses: actions/cache@v2 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }} restore-keys: | ${{ runner.os }}-go- - name: Get npm cache directory id: npm-cache run: | echo "::set-output name=dir::$(npm config get cache)" - name: Set up npm cache uses: actions/cache@v2 with: path: ${{ steps.npm-cache.outputs.dir }} key: ${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - name: Run make ci shell: bash run: | make ci - name: Upload coverage uses: codecov/codecov-action@v1 if: success() && matrix.os == 'ubuntu-latest' with: token: ${{ secrets.CODECOV_TOKEN }} file: ./coverage.txt app: runs-on: ubuntu-latest needs: test steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v2 with: go-version: ${{ env.GO_VERSION }} - name: Set up Node uses: actions/setup-node@v1 with: node-version: ${{ env.NODE_VERSION }} - name: Set up Go modules cache uses: actions/cache@v2 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }} restore-keys: | ${{ runner.os }}-go- - name: Get npm cache directory id: npm-cache run: | echo "::set-output name=dir::$(npm config get cache)" - name: Set up node_modules cache uses: actions/cache@v2 with: path: ${{ steps.npm-cache.outputs.dir }} key: ${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - name: Set up Snapcraft run: | sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft - name: Set up GoReleaser run: | curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR="$(go env GOPATH)/bin" sh - name: Run snapshot build run: | make release docker: runs-on: ubuntu-latest needs: test steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Docker Buildx (build) run: | make docker-multi-arch notify: needs: [app, docker] # Secrets are not passed to workflows that are triggered by a pull request from a fork if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} runs-on: ubuntu-latest steps: - name: Conclusion uses: technote-space/workflow-conclusion-action@v1 - name: Send Slack notif uses: 8398a7/action-slack@v3 with: status: ${{ env.WORKFLOW_CONCLUSION }} fields: repo,message,commit,author env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} </s> add 'notify': 'needs': - 'app' - 'docker' # Secrets are not passed to workflows that are triggered by a pull request # from a fork. 'if': "${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}" 'runs-on': 'ubuntu-latest' 'steps': - 'name': 'Conclusion' 'uses': 'technote-space/workflow-conclusion-action@v1' - 'name': 'Send Slack notif' 'uses': '8398a7/action-slack@v3' 'with': 'status': '${{ env.WORKFLOW_CONCLUSION }}' 'fields': 'repo, message, commit, author' 'env': 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}' 'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}' </s> remove test: runs-on: ${{ matrix.os }} env: GO111MODULE: on GOPROXY: https://goproxy.io strategy: fail-fast: false matrix: os: - ubuntu-latest - macOS-latest - windows-latest steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v2 with: go-version: ${{ env.GO_VERSION }} </s> add 'docker': 'runs-on': 'ubuntu-latest' 'needs': 'test' 'steps': - 'name': 'Checkout' 'uses': 'actions/checkout@v2' 'with': 'fetch-depth': 0 - 'name': 'Set up QEMU' 'uses': 'docker/setup-qemu-action@v1' - 'name': 'Set up Docker Buildx' 'uses': 'docker/setup-buildx-action@v1' - 'name': 'Docker Buildx (build)' 'run': 'make docker-multi-arch' </s> remove on: push: branches: - '*' tags: - v* pull_request: </s> add 'on': 'push': 'branches': - '*' 'tags': - 'v*' 'pull_request': </s> remove jobs: </s> add 'jobs': 'test': 'runs-on': '${{ matrix.os }}' 'env': 'GO111MODULE': 'on' 'GOPROXY': 'https://goproxy.io' 'strategy': 'fail-fast': false 'matrix': 'os': - 'ubuntu-latest' - 'macOS-latest' - 'windows-latest' 'steps': - 'name': 'Checkout' 'uses': 'actions/checkout@v2' 'with': 'fetch-depth': 0 - 'name': 'Set up Go' 'uses': 'actions/setup-go@v2' 'with': 'go-version': '${{ env.GO_VERSION }}' - 'name': 'Set up Node' 'uses': 'actions/setup-node@v1' 'with': 'node-version': '${{ env.NODE_VERSION }}' - 'name': 'Set up Go modules cache' 'uses': 'actions/cache@v2' 'with': 'path': '~/go/pkg/mod' 'key': "${{ runner.os }}-go-${{ hashFiles('go.sum') }}" 'restore-keys': '${{ runner.os }}-go-' - 'name': 'Get npm cache directory' 'id': 'npm-cache' 'run': 'echo "::set-output name=dir::$(npm config get cache)"' - 'name': 'Set up npm cache' 'uses': 'actions/cache@v2' 'with': 'path': '${{ steps.npm-cache.outputs.dir }}' 'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}" 'restore-keys': '${{ runner.os }}-node-' - 'name': 'Run make ci' 'shell': 'bash' 'run': 'make ci' - 'name': 'Upload coverage' 'uses': 'codecov/codecov-action@v1' 'if': "success() && matrix.os == 'ubuntu-latest'" 'with': 'token': '${{ secrets.CODECOV_TOKEN }}' 'file': './coverage.txt' 'app': 'runs-on': 'ubuntu-latest' 'needs': 'test' 'steps': - 'name': 'Checkout' 'uses': 'actions/checkout@v2' 'with': 'fetch-depth': 0 - 'name': 'Set up Go' 'uses': 'actions/setup-go@v2' 'with': 'go-version': '${{ env.GO_VERSION }}' - 'name': 'Set up Node' 'uses': 'actions/setup-node@v1' 'with': 'node-version': '${{ env.NODE_VERSION }}' - 'name': 'Set up Go modules cache' 'uses': 'actions/cache@v2' 'with': 'path': '~/go/pkg/mod' 'key': "${{ runner.os }}-go-${{ hashFiles('go.sum') }}" 'restore-keys': '${{ runner.os }}-go-' - 'name': 'Get npm cache directory' 'id': 'npm-cache' 'run': 'echo "::set-output name=dir::$(npm config get cache)"' - 'name': 'Set up node_modules cache' 'uses': 'actions/cache@v2' 'with': 'path': '${{ steps.npm-cache.outputs.dir }}' 'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}" 'restore-keys': '${{ runner.os }}-node-' - 'name': 'Set up Snapcraft' 'run': 'sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft' - 'name': 'Set up GoReleaser' 'run': 'curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR="$(go env GOPATH)/bin" sh' - 'name': 'Run snapshot build' 'run': 'make release' </s> remove env: GO_VERSION: 1.14 NODE_VERSION: 13 </s> add 'env': 'GO_VERSION': '1.14' 'NODE_VERSION': '13' </s> remove It operates as a DNS server that re-routes tracking domains to a "black hole," thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers -- both share a lot of common code. grade: stable confinement: strict publish: false license: GPL-3.0 extra_files: - source: scripts/snap/local/adguard-home-web.sh destination: adguard-home-web.sh mode: 0755 - source: scripts/snap/gui/adguard-home-web.desktop destination: meta/gui/adguard-home-web.desktop mode: 0644 - source: scripts/snap/gui/adguard-home-web.png destination: meta/gui/adguard-home-web.png mode: 0644 apps: adguard-home: command: AdGuardHome -w $SNAP_DATA --no-check-update plugs: # Add the "netrwork-bind" plug to bind to interfaces. - network-bind # Add the "netrwork-control" plug to be able to bind to ports below # 1024 (cap_net_bind_service) and also to bind to a particular # interface using SO_BINDTODEVICE (cap_net_raw). - network-control daemon: simple adguard-home-web: command: adguard-home-web.sh plugs: [ desktop ] </s> add It operates as a DNS server that re-routes tracking domains to a "black hole," thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers -- both share a lot of common code. 'grade': 'stable' 'confinement': 'strict' 'publish': false 'license': 'GPL-3.0' 'extra_files': - 'source': 'scripts/snap/local/adguard-home-web.sh' 'destination': 'adguard-home-web.sh' 'mode': 0755 - 'source': 'scripts/snap/gui/adguard-home-web.desktop' 'destination': 'meta/gui/adguard-home-web.desktop' 'mode': 0644 - 'source': 'scripts/snap/gui/adguard-home-web.png' 'destination': 'meta/gui/adguard-home-web.png' 'mode': 0644 'apps': 'adguard-home': 'command': 'AdGuardHome -w $SNAP_DATA --no-check-update' 'plugs': # Add the "netrwork-bind" plug to bind to interfaces. - 'network-bind' # Add the "netrwork-control" plug to be able to bind to ports below # 1024 (cap_net_bind_service) and also to bind to a particular # interface using SO_BINDTODEVICE (cap_net_raw). - 'network-control' 'daemon': 'simple' 'adguard-home-web': 'command': 'adguard-home-web.sh' 'plugs': - 'desktop'
https://github.com/AdguardTeam/AdGuardHome/commit/046ec13fdc5ec008fd4ac9b77cc943a96be2605c
.github/workflows/lint.yml
keep replace keep replace keep keep keep keep
<mask> # options for analysis running <mask> run: <mask> # default concurrency is a available CPU number <mask> concurrency: 4 <mask> <mask> # timeout for analysis, e.g. 30s, 5m, default is 1m <mask> deadline: 2m <mask> </s> Pull request: all: reformat yaml, add yaml formatting standard Merge in DNS/adguard-home from 2297-yaml to master Closes #2297. Squashed commit of the following: commit 85df3a38a14adb1965944ddf14b197c12a213057 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:52:22 2020 +0300 all: improve HACKING.md commit 079acdfe41cc12ab6aa13d7c28dcbf7b7b3c8380 Merge: 202ea078e 3045da174 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:50:34 2020 +0300 Merge branch 'master' into 2297-yaml commit 202ea078e29d88871a32ac6e668dfae6db802bab Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 12 20:25:42 2020 +0300 all: reformat yaml, add yaml formatting standard </s> remove deadline: 2m </s> add 'deadline': '2m' </s> remove issues: </s> add 'issues': </s> remove linters-settings: errcheck: </s> add 'linters-settings': 'errcheck': </s> remove exclude: # structcheck cannot detect usages while they're there - .parentalServer. is unused - .safeBrowsingServer. is unused # errcheck - Error return value of .s.closeConn. is not checked - Error return value of ..*.Shutdown. # goconst - string .forcesafesearch.google.com. has 3 occurrences # gosec: Profiling endpoint is automatically exposed on /debug/pprof - G108 # gosec: Subprocess launched with function call as argument or cmd arguments - G204 # gosec: Potential DoS vulnerability via decompression bomb - G110 # gosec: Expect WriteFile permissions to be 0600 or less - G306 </s> add 'exclude': # structcheck cannot detect usages while they're there - '.parentalServer. is unused' - '.safeBrowsingServer. is unused' # errcheck - 'Error return value of .s.closeConn. is not checked' - 'Error return value of ..*.Shutdown.' # goconst - 'string .forcesafesearch.google.com. has 3 occurrences' # gosec: Profiling endpoint is automatically exposed on /debug/pprof - 'G108' # gosec: Subprocess launched with function call as argument or cmd arguments - 'G204' # gosec: Potential DoS vulnerability via decompression bomb - 'G110' # gosec: Expect WriteFile permissions to be 0600 or less - 'G306' </s> remove It operates as a DNS server that re-routes tracking domains to a "black hole," thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers -- both share a lot of common code. grade: stable confinement: strict publish: false license: GPL-3.0 extra_files: - source: scripts/snap/local/adguard-home-web.sh destination: adguard-home-web.sh mode: 0755 - source: scripts/snap/gui/adguard-home-web.desktop destination: meta/gui/adguard-home-web.desktop mode: 0644 - source: scripts/snap/gui/adguard-home-web.png destination: meta/gui/adguard-home-web.png mode: 0644 apps: adguard-home: command: AdGuardHome -w $SNAP_DATA --no-check-update plugs: # Add the "netrwork-bind" plug to bind to interfaces. - network-bind # Add the "netrwork-control" plug to be able to bind to ports below # 1024 (cap_net_bind_service) and also to bind to a particular # interface using SO_BINDTODEVICE (cap_net_raw). - network-control daemon: simple adguard-home-web: command: adguard-home-web.sh plugs: [ desktop ] </s> add It operates as a DNS server that re-routes tracking domains to a "black hole," thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers -- both share a lot of common code. 'grade': 'stable' 'confinement': 'strict' 'publish': false 'license': 'GPL-3.0' 'extra_files': - 'source': 'scripts/snap/local/adguard-home-web.sh' 'destination': 'adguard-home-web.sh' 'mode': 0755 - 'source': 'scripts/snap/gui/adguard-home-web.desktop' 'destination': 'meta/gui/adguard-home-web.desktop' 'mode': 0644 - 'source': 'scripts/snap/gui/adguard-home-web.png' 'destination': 'meta/gui/adguard-home-web.png' 'mode': 0644 'apps': 'adguard-home': 'command': 'AdGuardHome -w $SNAP_DATA --no-check-update' 'plugs': # Add the "netrwork-bind" plug to bind to interfaces. - 'network-bind' # Add the "netrwork-control" plug to be able to bind to ports below # 1024 (cap_net_bind_service) and also to bind to a particular # interface using SO_BINDTODEVICE (cap_net_raw). - 'network-control' 'daemon': 'simple' 'adguard-home-web': 'command': 'adguard-home-web.sh' 'plugs': - 'desktop'
https://github.com/AdguardTeam/AdGuardHome/commit/046ec13fdc5ec008fd4ac9b77cc943a96be2605c
.golangci.yml
keep keep keep keep replace keep keep keep keep keep
<mask> # default concurrency is a available CPU number <mask> concurrency: 4 <mask> <mask> # timeout for analysis, e.g. 30s, 5m, default is 1m <mask> deadline: 2m <mask> <mask> # which files to skip: they will be analyzed, but issues from them <mask> # won't be reported. Default value is empty list, but there is <mask> # no need to include all autogenerated files, we confidently recognize <mask> # autogenerated files. If it's not please let us know. </s> Pull request: all: reformat yaml, add yaml formatting standard Merge in DNS/adguard-home from 2297-yaml to master Closes #2297. Squashed commit of the following: commit 85df3a38a14adb1965944ddf14b197c12a213057 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:52:22 2020 +0300 all: improve HACKING.md commit 079acdfe41cc12ab6aa13d7c28dcbf7b7b3c8380 Merge: 202ea078e 3045da174 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:50:34 2020 +0300 Merge branch 'master' into 2297-yaml commit 202ea078e29d88871a32ac6e668dfae6db802bab Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 12 20:25:42 2020 +0300 all: reformat yaml, add yaml formatting standard </s> remove skip-files: - ".*generated.*" - dnsfilter/rule_to_regexp.go - util/pprof.go - ".*_test.go" - client/.* - build/.* - dist/.* </s> add 'skip-files': - '.*generated.*' - 'dnsfilter/rule_to_regexp.go' - 'util/pprof.go' - '.*_test.go' - 'client/.*' - 'build/.*' - 'dist/.*' </s> remove concurrency: 4 </s> add 'concurrency': 4 </s> remove run: </s> add 'run': </s> remove exclude: # structcheck cannot detect usages while they're there - .parentalServer. is unused - .safeBrowsingServer. is unused # errcheck - Error return value of .s.closeConn. is not checked - Error return value of ..*.Shutdown. # goconst - string .forcesafesearch.google.com. has 3 occurrences # gosec: Profiling endpoint is automatically exposed on /debug/pprof - G108 # gosec: Subprocess launched with function call as argument or cmd arguments - G204 # gosec: Potential DoS vulnerability via decompression bomb - G110 # gosec: Expect WriteFile permissions to be 0600 or less - G306 </s> add 'exclude': # structcheck cannot detect usages while they're there - '.parentalServer. is unused' - '.safeBrowsingServer. is unused' # errcheck - 'Error return value of .s.closeConn. is not checked' - 'Error return value of ..*.Shutdown.' # goconst - 'string .forcesafesearch.google.com. has 3 occurrences' # gosec: Profiling endpoint is automatically exposed on /debug/pprof - 'G108' # gosec: Subprocess launched with function call as argument or cmd arguments - 'G204' # gosec: Potential DoS vulnerability via decompression bomb - 'G110' # gosec: Expect WriteFile permissions to be 0600 or less - 'G306' </s> remove issues: </s> add 'issues': </s> remove # Number of days of inactivity before an issue becomes stale daysUntilStale: 60 # Number of days of inactivity before a stale issue is closed daysUntilClose: 7 # Issues with these labels will never be considered stale exemptLabels: - 'bug' - 'enhancement' - 'feature request' - 'localization' # Label to use when marking an issue as stale staleLabel: 'wontfix' # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > </s> add # Number of days of inactivity before an issue becomes stale. 'daysUntilStale': 60 # Number of days of inactivity before a stale issue is closed. 'daysUntilClose': 7 # Issues with these labels will never be considered stale. 'exemptLabels': - 'bug' - 'enhancement' - 'feature request' - 'localization' # Label to use when marking an issue as stale. 'staleLabel': 'wontfix' # Comment to post when marking an issue as stale. Set to `false` to disable. 'markComment': >
https://github.com/AdguardTeam/AdGuardHome/commit/046ec13fdc5ec008fd4ac9b77cc943a96be2605c
.golangci.yml
keep keep keep keep replace replace replace replace replace replace replace replace replace keep keep replace replace keep keep keep
<mask> # which files to skip: they will be analyzed, but issues from them <mask> # won't be reported. Default value is empty list, but there is <mask> # no need to include all autogenerated files, we confidently recognize <mask> # autogenerated files. If it's not please let us know. <mask> skip-files: <mask> - ".*generated.*" <mask> - dnsfilter/rule_to_regexp.go <mask> - util/pprof.go <mask> - ".*_test.go" <mask> - client/.* <mask> - build/.* <mask> - dist/.* <mask> <mask> <mask> # all available settings of specific linters <mask> linters-settings: <mask> errcheck: <mask> # [deprecated] comma-separated list of pairs of the form pkg:regex <mask> # the regex is used to ignore names within pkg. (default "fmt:.*"). <mask> # see https://github.com/kisielk/errcheck#the-deprecated-method for details </s> Pull request: all: reformat yaml, add yaml formatting standard Merge in DNS/adguard-home from 2297-yaml to master Closes #2297. Squashed commit of the following: commit 85df3a38a14adb1965944ddf14b197c12a213057 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:52:22 2020 +0300 all: improve HACKING.md commit 079acdfe41cc12ab6aa13d7c28dcbf7b7b3c8380 Merge: 202ea078e 3045da174 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:50:34 2020 +0300 Merge branch 'master' into 2297-yaml commit 202ea078e29d88871a32ac6e668dfae6db802bab Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 12 20:25:42 2020 +0300 all: reformat yaml, add yaml formatting standard </s> remove deadline: 2m </s> add 'deadline': '2m' </s> remove ignore: fmt:.*,net:SetReadDeadline,net/http:^Write gocyclo: min-complexity: 20 lll: line-length: 200 </s> add 'ignore': 'fmt:.*,net:SetReadDeadline,net/http:^Write' 'gocyclo': 'min-complexity': 20 'lll': 'line-length': 200 </s> remove concurrency: 4 </s> add 'concurrency': 4 </s> remove exclude: # structcheck cannot detect usages while they're there - .parentalServer. is unused - .safeBrowsingServer. is unused # errcheck - Error return value of .s.closeConn. is not checked - Error return value of ..*.Shutdown. # goconst - string .forcesafesearch.google.com. has 3 occurrences # gosec: Profiling endpoint is automatically exposed on /debug/pprof - G108 # gosec: Subprocess launched with function call as argument or cmd arguments - G204 # gosec: Potential DoS vulnerability via decompression bomb - G110 # gosec: Expect WriteFile permissions to be 0600 or less - G306 </s> add 'exclude': # structcheck cannot detect usages while they're there - '.parentalServer. is unused' - '.safeBrowsingServer. is unused' # errcheck - 'Error return value of .s.closeConn. is not checked' - 'Error return value of ..*.Shutdown.' # goconst - 'string .forcesafesearch.google.com. has 3 occurrences' # gosec: Profiling endpoint is automatically exposed on /debug/pprof - 'G108' # gosec: Subprocess launched with function call as argument or cmd arguments - 'G204' # gosec: Potential DoS vulnerability via decompression bomb - 'G110' # gosec: Expect WriteFile permissions to be 0600 or less - 'G306' </s> remove # Number of days of inactivity before an issue becomes stale daysUntilStale: 60 # Number of days of inactivity before a stale issue is closed daysUntilClose: 7 # Issues with these labels will never be considered stale exemptLabels: - 'bug' - 'enhancement' - 'feature request' - 'localization' # Label to use when marking an issue as stale staleLabel: 'wontfix' # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > </s> add # Number of days of inactivity before an issue becomes stale. 'daysUntilStale': 60 # Number of days of inactivity before a stale issue is closed. 'daysUntilClose': 7 # Issues with these labels will never be considered stale. 'exemptLabels': - 'bug' - 'enhancement' - 'feature request' - 'localization' # Label to use when marking an issue as stale. 'staleLabel': 'wontfix' # Comment to post when marking an issue as stale. Set to `false` to disable. 'markComment': >
https://github.com/AdguardTeam/AdGuardHome/commit/046ec13fdc5ec008fd4ac9b77cc943a96be2605c
.golangci.yml
keep keep keep keep replace replace replace replace replace keep 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
<mask> errcheck: <mask> # [deprecated] comma-separated list of pairs of the form pkg:regex <mask> # the regex is used to ignore names within pkg. (default "fmt:.*"). <mask> # see https://github.com/kisielk/errcheck#the-deprecated-method for details <mask> ignore: fmt:.*,net:SetReadDeadline,net/http:^Write <mask> gocyclo: <mask> min-complexity: 20 <mask> lll: <mask> line-length: 200 <mask> <mask> linters: <mask> enable: <mask> - deadcode <mask> - errcheck <mask> - govet <mask> - ineffassign <mask> - staticcheck <mask> - unused <mask> - varcheck <mask> - bodyclose <mask> - depguard <mask> - dupl <mask> - gocyclo <mask> - goimports <mask> - golint <mask> - gosec <mask> - misspell <mask> - stylecheck <mask> - unconvert <mask> disable-all: true <mask> fast: true <mask> <mask> issues: <mask> # List of regexps of issue texts to exclude, empty list by default. <mask> # But independently from this option we use default exclude patterns, </s> Pull request: all: reformat yaml, add yaml formatting standard Merge in DNS/adguard-home from 2297-yaml to master Closes #2297. Squashed commit of the following: commit 85df3a38a14adb1965944ddf14b197c12a213057 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:52:22 2020 +0300 all: improve HACKING.md commit 079acdfe41cc12ab6aa13d7c28dcbf7b7b3c8380 Merge: 202ea078e 3045da174 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:50:34 2020 +0300 Merge branch 'master' into 2297-yaml commit 202ea078e29d88871a32ac6e668dfae6db802bab Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 12 20:25:42 2020 +0300 all: reformat yaml, add yaml formatting standard </s> remove linters-settings: errcheck: </s> add 'linters-settings': 'errcheck': </s> remove issues: </s> add 'issues': </s> remove exclude: # structcheck cannot detect usages while they're there - .parentalServer. is unused - .safeBrowsingServer. is unused # errcheck - Error return value of .s.closeConn. is not checked - Error return value of ..*.Shutdown. # goconst - string .forcesafesearch.google.com. has 3 occurrences # gosec: Profiling endpoint is automatically exposed on /debug/pprof - G108 # gosec: Subprocess launched with function call as argument or cmd arguments - G204 # gosec: Potential DoS vulnerability via decompression bomb - G110 # gosec: Expect WriteFile permissions to be 0600 or less - G306 </s> add 'exclude': # structcheck cannot detect usages while they're there - '.parentalServer. is unused' - '.safeBrowsingServer. is unused' # errcheck - 'Error return value of .s.closeConn. is not checked' - 'Error return value of ..*.Shutdown.' # goconst - 'string .forcesafesearch.google.com. has 3 occurrences' # gosec: Profiling endpoint is automatically exposed on /debug/pprof - 'G108' # gosec: Subprocess launched with function call as argument or cmd arguments - 'G204' # gosec: Potential DoS vulnerability via decompression bomb - 'G110' # gosec: Expect WriteFile permissions to be 0600 or less - 'G306' </s> remove skip-files: - ".*generated.*" - dnsfilter/rule_to_regexp.go - util/pprof.go - ".*_test.go" - client/.* - build/.* - dist/.* </s> add 'skip-files': - '.*generated.*' - 'dnsfilter/rule_to_regexp.go' - 'util/pprof.go' - '.*_test.go' - 'client/.*' - 'build/.*' - 'dist/.*' </s> remove name: golangci-lint on: push: tags: - v* branches: - '*' pull_request: jobs: golangci: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: golangci-lint uses: golangci/golangci-lint-action@v2.3.0 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.32 eslint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install modules run: npm --prefix client ci - name: Run ESLint run: npm --prefix client run lint notify: needs: [golangci,eslint] # Secrets are not passed to workflows that are triggered by a pull request from a fork if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} runs-on: ubuntu-latest steps: - name: Conclusion uses: technote-space/workflow-conclusion-action@v1 - name: Send Slack notif uses: 8398a7/action-slack@v3 with: status: ${{ env.WORKFLOW_CONCLUSION }} fields: repo,message,commit,author env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} </s> add 'name': 'golangci-lint' 'on': 'push': 'tags': - 'v*' 'branches': - '*' 'pull_request': 'jobs': 'golangci': 'runs-on': 'ubuntu-latest' 'steps': - 'uses': 'actions/checkout@v2' - 'name': 'golangci-lint' 'uses': 'golangci/golangci-lint-action@v2.3.0' 'with': # This field is required. Don't set the patch version to always use # the latest patch version. 'version': 'v1.32' 'eslint': 'runs-on': 'ubuntu-latest' 'steps': - 'uses': 'actions/checkout@v2' - 'name': 'Install modules' 'run': 'npm --prefix client ci' - 'name': 'Run ESLint' 'run': 'npm --prefix client run lint' 'notify': 'needs': - 'golangci' - 'eslint' # Secrets are not passed to workflows that are triggered by a pull request # from a fork. 'if': "${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}" 'runs-on': 'ubuntu-latest' 'steps': - 'name': 'Conclusion' 'uses': 'technote-space/workflow-conclusion-action@v1' - 'name': 'Send Slack notif' 'uses': '8398a7/action-slack@v3' 'with': 'status': '${{ env.WORKFLOW_CONCLUSION }}' 'fields': 'repo, message, commit, author' 'env': 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}' 'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}'
https://github.com/AdguardTeam/AdGuardHome/commit/046ec13fdc5ec008fd4ac9b77cc943a96be2605c
.golangci.yml
keep keep keep keep replace keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace
<mask> - unconvert <mask> disable-all: true <mask> fast: true <mask> <mask> issues: <mask> # List of regexps of issue texts to exclude, empty list by default. <mask> # But independently from this option we use default exclude patterns, <mask> # it can be disabled by `exclude-use-default: false`. To list all <mask> # excluded by default patterns execute `golangci-lint run --help` <mask> exclude: <mask> # structcheck cannot detect usages while they're there <mask> - .parentalServer. is unused <mask> - .safeBrowsingServer. is unused <mask> # errcheck <mask> - Error return value of .s.closeConn. is not checked <mask> - Error return value of ..*.Shutdown. <mask> # goconst <mask> - string .forcesafesearch.google.com. has 3 occurrences <mask> # gosec: Profiling endpoint is automatically exposed on /debug/pprof <mask> - G108 <mask> # gosec: Subprocess launched with function call as argument or cmd arguments <mask> - G204 <mask> # gosec: Potential DoS vulnerability via decompression bomb <mask> - G110 <mask> # gosec: Expect WriteFile permissions to be 0600 or less <mask> - G306 </s> Pull request: all: reformat yaml, add yaml formatting standard Merge in DNS/adguard-home from 2297-yaml to master Closes #2297. Squashed commit of the following: commit 85df3a38a14adb1965944ddf14b197c12a213057 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:52:22 2020 +0300 all: improve HACKING.md commit 079acdfe41cc12ab6aa13d7c28dcbf7b7b3c8380 Merge: 202ea078e 3045da174 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:50:34 2020 +0300 Merge branch 'master' into 2297-yaml commit 202ea078e29d88871a32ac6e668dfae6db802bab Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 12 20:25:42 2020 +0300 all: reformat yaml, add yaml formatting standard </s> remove linters: enable: - deadcode - errcheck - govet - ineffassign - staticcheck - unused - varcheck - bodyclose - depguard - dupl - gocyclo - goimports - golint - gosec - misspell - stylecheck - unconvert disable-all: true fast: true </s> add 'linters': 'enable': - 'bodyclose' - 'deadcode' - 'depguard' - 'dupl' - 'errcheck' - 'gocyclo' - 'goimports' - 'golint' - 'gosec' - 'govet' - 'ineffassign' - 'misspell' - 'staticcheck' - 'stylecheck' - 'unconvert' - 'unused' - 'varcheck' 'disable-all': true 'fast': true </s> remove skip-files: - ".*generated.*" - dnsfilter/rule_to_regexp.go - util/pprof.go - ".*_test.go" - client/.* - build/.* - dist/.* </s> add 'skip-files': - '.*generated.*' - 'dnsfilter/rule_to_regexp.go' - 'util/pprof.go' - '.*_test.go' - 'client/.*' - 'build/.*' - 'dist/.*' </s> remove # Number of days of inactivity before an issue becomes stale daysUntilStale: 60 # Number of days of inactivity before a stale issue is closed daysUntilClose: 7 # Issues with these labels will never be considered stale exemptLabels: - 'bug' - 'enhancement' - 'feature request' - 'localization' # Label to use when marking an issue as stale staleLabel: 'wontfix' # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > </s> add # Number of days of inactivity before an issue becomes stale. 'daysUntilStale': 60 # Number of days of inactivity before a stale issue is closed. 'daysUntilClose': 7 # Issues with these labels will never be considered stale. 'exemptLabels': - 'bug' - 'enhancement' - 'feature request' - 'localization' # Label to use when marking an issue as stale. 'staleLabel': 'wontfix' # Comment to post when marking an issue as stale. Set to `false` to disable. 'markComment': > </s> remove name: golangci-lint on: push: tags: - v* branches: - '*' pull_request: jobs: golangci: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: golangci-lint uses: golangci/golangci-lint-action@v2.3.0 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.32 eslint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install modules run: npm --prefix client ci - name: Run ESLint run: npm --prefix client run lint notify: needs: [golangci,eslint] # Secrets are not passed to workflows that are triggered by a pull request from a fork if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} runs-on: ubuntu-latest steps: - name: Conclusion uses: technote-space/workflow-conclusion-action@v1 - name: Send Slack notif uses: 8398a7/action-slack@v3 with: status: ${{ env.WORKFLOW_CONCLUSION }} fields: repo,message,commit,author env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} </s> add 'name': 'golangci-lint' 'on': 'push': 'tags': - 'v*' 'branches': - '*' 'pull_request': 'jobs': 'golangci': 'runs-on': 'ubuntu-latest' 'steps': - 'uses': 'actions/checkout@v2' - 'name': 'golangci-lint' 'uses': 'golangci/golangci-lint-action@v2.3.0' 'with': # This field is required. Don't set the patch version to always use # the latest patch version. 'version': 'v1.32' 'eslint': 'runs-on': 'ubuntu-latest' 'steps': - 'uses': 'actions/checkout@v2' - 'name': 'Install modules' 'run': 'npm --prefix client ci' - 'name': 'Run ESLint' 'run': 'npm --prefix client run lint' 'notify': 'needs': - 'golangci' - 'eslint' # Secrets are not passed to workflows that are triggered by a pull request # from a fork. 'if': "${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}" 'runs-on': 'ubuntu-latest' 'steps': - 'name': 'Conclusion' 'uses': 'technote-space/workflow-conclusion-action@v1' - 'name': 'Send Slack notif' 'uses': '8398a7/action-slack@v3' 'with': 'status': '${{ env.WORKFLOW_CONCLUSION }}' 'fields': 'repo, message, commit, author' 'env': 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}' 'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}' </s> remove deadline: 2m </s> add 'deadline': '2m'
https://github.com/AdguardTeam/AdGuardHome/commit/046ec13fdc5ec008fd4ac9b77cc943a96be2605c
.golangci.yml
replace keep replace replace replace keep keep keep keep keep
<mask> project_name: AdGuardHome <mask> <mask> env: <mask> - GO111MODULE=on <mask> - GOPROXY=https://goproxy.io <mask> <mask> before: <mask> hooks: <mask> - go mod download <mask> - go generate ./... </s> Pull request: all: reformat yaml, add yaml formatting standard Merge in DNS/adguard-home from 2297-yaml to master Closes #2297. Squashed commit of the following: commit 85df3a38a14adb1965944ddf14b197c12a213057 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:52:22 2020 +0300 all: improve HACKING.md commit 079acdfe41cc12ab6aa13d7c28dcbf7b7b3c8380 Merge: 202ea078e 3045da174 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:50:34 2020 +0300 Merge branch 'master' into 2297-yaml commit 202ea078e29d88871a32ac6e668dfae6db802bab Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 12 20:25:42 2020 +0300 all: reformat yaml, add yaml formatting standard </s> remove before: hooks: - go mod download - go generate ./... </s> add 'before': 'hooks': - 'go mod download' - 'go generate ./...' </s> remove builds: - main: ./main.go ldflags: - -s -w -X main.version={{.Version}} -X main.channel={{.Env.CHANNEL}} -X main.goarm={{.Env.GOARM}} env: - CGO_ENABLED=0 goos: - darwin - linux - freebsd - windows goarch: - 386 - amd64 - arm - arm64 - mips - mipsle - mips64 - mips64le goarm: - 5 - 6 - 7 gomips: - softfloat ignore: - goos: freebsd goarch: mips - goos: freebsd goarch: mipsle </s> add 'builds': - 'main': './main.go' 'ldflags': - '-s -w -X main.version={{.Version}} -X main.channel={{.Env.CHANNEL}} -X main.goarm={{.Env.GOARM}}' 'env': - 'CGO_ENABLED=0' 'goos': - 'darwin' - 'linux' - 'freebsd' - 'windows' 'goarch': - '386' - 'amd64' - 'arm' - 'arm64' - 'mips' - 'mipsle' - 'mips64' - 'mips64le' 'goarm': - '5' - '6' - '7' 'gomips': - 'softfloat' 'ignore': - 'goos': 'freebsd' 'goarch': 'mips' - 'goos': 'freebsd' 'goarch': 'mipsle' </s> remove linters: enable: - deadcode - errcheck - govet - ineffassign - staticcheck - unused - varcheck - bodyclose - depguard - dupl - gocyclo - goimports - golint - gosec - misspell - stylecheck - unconvert disable-all: true fast: true </s> add 'linters': 'enable': - 'bodyclose' - 'deadcode' - 'depguard' - 'dupl' - 'errcheck' - 'gocyclo' - 'goimports' - 'golint' - 'gosec' - 'govet' - 'ineffassign' - 'misspell' - 'staticcheck' - 'stylecheck' - 'unconvert' - 'unused' - 'varcheck' 'disable-all': true 'fast': true </s> remove test: runs-on: ${{ matrix.os }} env: GO111MODULE: on GOPROXY: https://goproxy.io strategy: fail-fast: false matrix: os: - ubuntu-latest - macOS-latest - windows-latest steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v2 with: go-version: ${{ env.GO_VERSION }} </s> add 'docker': 'runs-on': 'ubuntu-latest' 'needs': 'test' 'steps': - 'name': 'Checkout' 'uses': 'actions/checkout@v2' 'with': 'fetch-depth': 0 - 'name': 'Set up QEMU' 'uses': 'docker/setup-qemu-action@v1' - 'name': 'Set up Docker Buildx' 'uses': 'docker/setup-buildx-action@v1' - 'name': 'Docker Buildx (build)' 'run': 'make docker-multi-arch' </s> remove It operates as a DNS server that re-routes tracking domains to a "black hole," thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers -- both share a lot of common code. grade: stable confinement: strict publish: false license: GPL-3.0 extra_files: - source: scripts/snap/local/adguard-home-web.sh destination: adguard-home-web.sh mode: 0755 - source: scripts/snap/gui/adguard-home-web.desktop destination: meta/gui/adguard-home-web.desktop mode: 0644 - source: scripts/snap/gui/adguard-home-web.png destination: meta/gui/adguard-home-web.png mode: 0644 apps: adguard-home: command: AdGuardHome -w $SNAP_DATA --no-check-update plugs: # Add the "netrwork-bind" plug to bind to interfaces. - network-bind # Add the "netrwork-control" plug to be able to bind to ports below # 1024 (cap_net_bind_service) and also to bind to a particular # interface using SO_BINDTODEVICE (cap_net_raw). - network-control daemon: simple adguard-home-web: command: adguard-home-web.sh plugs: [ desktop ] </s> add It operates as a DNS server that re-routes tracking domains to a "black hole," thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers -- both share a lot of common code. 'grade': 'stable' 'confinement': 'strict' 'publish': false 'license': 'GPL-3.0' 'extra_files': - 'source': 'scripts/snap/local/adguard-home-web.sh' 'destination': 'adguard-home-web.sh' 'mode': 0755 - 'source': 'scripts/snap/gui/adguard-home-web.desktop' 'destination': 'meta/gui/adguard-home-web.desktop' 'mode': 0644 - 'source': 'scripts/snap/gui/adguard-home-web.png' 'destination': 'meta/gui/adguard-home-web.png' 'mode': 0644 'apps': 'adguard-home': 'command': 'AdGuardHome -w $SNAP_DATA --no-check-update' 'plugs': # Add the "netrwork-bind" plug to bind to interfaces. - 'network-bind' # Add the "netrwork-control" plug to be able to bind to ports below # 1024 (cap_net_bind_service) and also to bind to a particular # interface using SO_BINDTODEVICE (cap_net_raw). - 'network-control' 'daemon': 'simple' 'adguard-home-web': 'command': 'adguard-home-web.sh' 'plugs': - 'desktop'
https://github.com/AdguardTeam/AdGuardHome/commit/046ec13fdc5ec008fd4ac9b77cc943a96be2605c
.goreleaser.yml
keep keep keep replace replace replace replace 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 keep keep keep keep
<mask> - GO111MODULE=on <mask> - GOPROXY=https://goproxy.io <mask> <mask> before: <mask> hooks: <mask> - go mod download <mask> - go generate ./... <mask> <mask> builds: <mask> - main: ./main.go <mask> ldflags: <mask> - -s -w -X main.version={{.Version}} -X main.channel={{.Env.CHANNEL}} -X main.goarm={{.Env.GOARM}} <mask> env: <mask> - CGO_ENABLED=0 <mask> goos: <mask> - darwin <mask> - linux <mask> - freebsd <mask> - windows <mask> goarch: <mask> - 386 <mask> - amd64 <mask> - arm <mask> - arm64 <mask> - mips <mask> - mipsle <mask> - mips64 <mask> - mips64le <mask> goarm: <mask> - 5 <mask> - 6 <mask> - 7 <mask> gomips: <mask> - softfloat <mask> ignore: <mask> - goos: freebsd <mask> goarch: mips <mask> - goos: freebsd <mask> goarch: mipsle <mask> <mask> archives: <mask> - # Archive name template. <mask> # Defaults: </s> Pull request: all: reformat yaml, add yaml formatting standard Merge in DNS/adguard-home from 2297-yaml to master Closes #2297. Squashed commit of the following: commit 85df3a38a14adb1965944ddf14b197c12a213057 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:52:22 2020 +0300 all: improve HACKING.md commit 079acdfe41cc12ab6aa13d7c28dcbf7b7b3c8380 Merge: 202ea078e 3045da174 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:50:34 2020 +0300 Merge branch 'master' into 2297-yaml commit 202ea078e29d88871a32ac6e668dfae6db802bab Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 12 20:25:42 2020 +0300 all: reformat yaml, add yaml formatting standard </s> remove archives: - # Archive name template. # Defaults: # - if format is `tar.gz`, `tar.xz`, `gz` or `zip`: # - `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}` # - if format is `binary`: # - `{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}` name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}" wrap_in_directory: "AdGuardHome" format_overrides: - goos: windows format: zip - goos: darwin format: zip files: - LICENSE.txt - README.md </s> add 'archives': - # Archive name template. # Defaults: # - if format is `tar.gz`, `tar.xz`, `gz` or `zip`: # - `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}` # - if format is `binary`: # - `{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}` 'name_template': '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}' 'wrap_in_directory': 'AdGuardHome' 'format_overrides': - 'goos': 'windows' 'format': 'zip' - 'goos': 'darwin' 'format': 'zip' 'files': - 'LICENSE.txt' - 'README.md' </s> remove env: - GO111MODULE=on - GOPROXY=https://goproxy.io </s> add 'env': - 'GO111MODULE=on' - 'GOPROXY=https://goproxy.io' </s> remove linters: enable: - deadcode - errcheck - govet - ineffassign - staticcheck - unused - varcheck - bodyclose - depguard - dupl - gocyclo - goimports - golint - gosec - misspell - stylecheck - unconvert disable-all: true fast: true </s> add 'linters': 'enable': - 'bodyclose' - 'deadcode' - 'depguard' - 'dupl' - 'errcheck' - 'gocyclo' - 'goimports' - 'golint' - 'gosec' - 'govet' - 'ineffassign' - 'misspell' - 'staticcheck' - 'stylecheck' - 'unconvert' - 'unused' - 'varcheck' 'disable-all': true 'fast': true </s> remove project_name: AdGuardHome </s> add 'project_name': 'AdGuardHome' </s> remove skip-files: - ".*generated.*" - dnsfilter/rule_to_regexp.go - util/pprof.go - ".*_test.go" - client/.* - build/.* - dist/.* </s> add 'skip-files': - '.*generated.*' - 'dnsfilter/rule_to_regexp.go' - 'util/pprof.go' - '.*_test.go' - 'client/.*' - 'build/.*' - 'dist/.*'
https://github.com/AdguardTeam/AdGuardHome/commit/046ec13fdc5ec008fd4ac9b77cc943a96be2605c
.goreleaser.yml
keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep replace replace replace replace replace replace replace replace replace keep keep keep keep
<mask> - goos: freebsd <mask> goarch: mipsle <mask> <mask> archives: <mask> - # Archive name template. <mask> # Defaults: <mask> # - if format is `tar.gz`, `tar.xz`, `gz` or `zip`: <mask> # - `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}` <mask> # - if format is `binary`: <mask> # - `{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}` <mask> name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}" <mask> wrap_in_directory: "AdGuardHome" <mask> format_overrides: <mask> - goos: windows <mask> format: zip <mask> - goos: darwin <mask> format: zip <mask> files: <mask> - LICENSE.txt <mask> - README.md <mask> <mask> snapcrafts: <mask> - name: adguard-home <mask> base: core18 <mask> name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' <mask> summary: Network-wide ads & trackers blocking DNS server <mask> description: | <mask> AdGuard Home is a network-wide software for blocking ads & tracking. After <mask> you set it up, it'll cover ALL your home devices, and you don't need any <mask> client-side software for that. <mask> <mask> It operates as a DNS server that re-routes tracking domains to a "black hole," <mask> thus preventing your devices from connecting to those servers. It's based <mask> on software we use for our public AdGuard DNS servers -- both share a lot </s> Pull request: all: reformat yaml, add yaml formatting standard Merge in DNS/adguard-home from 2297-yaml to master Closes #2297. Squashed commit of the following: commit 85df3a38a14adb1965944ddf14b197c12a213057 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:52:22 2020 +0300 all: improve HACKING.md commit 079acdfe41cc12ab6aa13d7c28dcbf7b7b3c8380 Merge: 202ea078e 3045da174 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:50:34 2020 +0300 Merge branch 'master' into 2297-yaml commit 202ea078e29d88871a32ac6e668dfae6db802bab Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 12 20:25:42 2020 +0300 all: reformat yaml, add yaml formatting standard </s> remove It operates as a DNS server that re-routes tracking domains to a "black hole," thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers -- both share a lot of common code. grade: stable confinement: strict publish: false license: GPL-3.0 extra_files: - source: scripts/snap/local/adguard-home-web.sh destination: adguard-home-web.sh mode: 0755 - source: scripts/snap/gui/adguard-home-web.desktop destination: meta/gui/adguard-home-web.desktop mode: 0644 - source: scripts/snap/gui/adguard-home-web.png destination: meta/gui/adguard-home-web.png mode: 0644 apps: adguard-home: command: AdGuardHome -w $SNAP_DATA --no-check-update plugs: # Add the "netrwork-bind" plug to bind to interfaces. - network-bind # Add the "netrwork-control" plug to be able to bind to ports below # 1024 (cap_net_bind_service) and also to bind to a particular # interface using SO_BINDTODEVICE (cap_net_raw). - network-control daemon: simple adguard-home-web: command: adguard-home-web.sh plugs: [ desktop ] </s> add It operates as a DNS server that re-routes tracking domains to a "black hole," thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers -- both share a lot of common code. 'grade': 'stable' 'confinement': 'strict' 'publish': false 'license': 'GPL-3.0' 'extra_files': - 'source': 'scripts/snap/local/adguard-home-web.sh' 'destination': 'adguard-home-web.sh' 'mode': 0755 - 'source': 'scripts/snap/gui/adguard-home-web.desktop' 'destination': 'meta/gui/adguard-home-web.desktop' 'mode': 0644 - 'source': 'scripts/snap/gui/adguard-home-web.png' 'destination': 'meta/gui/adguard-home-web.png' 'mode': 0644 'apps': 'adguard-home': 'command': 'AdGuardHome -w $SNAP_DATA --no-check-update' 'plugs': # Add the "netrwork-bind" plug to bind to interfaces. - 'network-bind' # Add the "netrwork-control" plug to be able to bind to ports below # 1024 (cap_net_bind_service) and also to bind to a particular # interface using SO_BINDTODEVICE (cap_net_raw). - 'network-control' 'daemon': 'simple' 'adguard-home-web': 'command': 'adguard-home-web.sh' 'plugs': - 'desktop' </s> remove builds: - main: ./main.go ldflags: - -s -w -X main.version={{.Version}} -X main.channel={{.Env.CHANNEL}} -X main.goarm={{.Env.GOARM}} env: - CGO_ENABLED=0 goos: - darwin - linux - freebsd - windows goarch: - 386 - amd64 - arm - arm64 - mips - mipsle - mips64 - mips64le goarm: - 5 - 6 - 7 gomips: - softfloat ignore: - goos: freebsd goarch: mips - goos: freebsd goarch: mipsle </s> add 'builds': - 'main': './main.go' 'ldflags': - '-s -w -X main.version={{.Version}} -X main.channel={{.Env.CHANNEL}} -X main.goarm={{.Env.GOARM}}' 'env': - 'CGO_ENABLED=0' 'goos': - 'darwin' - 'linux' - 'freebsd' - 'windows' 'goarch': - '386' - 'amd64' - 'arm' - 'arm64' - 'mips' - 'mipsle' - 'mips64' - 'mips64le' 'goarm': - '5' - '6' - '7' 'gomips': - 'softfloat' 'ignore': - 'goos': 'freebsd' 'goarch': 'mips' - 'goos': 'freebsd' 'goarch': 'mipsle' </s> remove # Number of days of inactivity before an issue becomes stale daysUntilStale: 60 # Number of days of inactivity before a stale issue is closed daysUntilClose: 7 # Issues with these labels will never be considered stale exemptLabels: - 'bug' - 'enhancement' - 'feature request' - 'localization' # Label to use when marking an issue as stale staleLabel: 'wontfix' # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > </s> add # Number of days of inactivity before an issue becomes stale. 'daysUntilStale': 60 # Number of days of inactivity before a stale issue is closed. 'daysUntilClose': 7 # Issues with these labels will never be considered stale. 'exemptLabels': - 'bug' - 'enhancement' - 'feature request' - 'localization' # Label to use when marking an issue as stale. 'staleLabel': 'wontfix' # Comment to post when marking an issue as stale. Set to `false` to disable. 'markComment': > </s> remove # Comment to post when closing a stale issue. Set to `false` to disable closeComment: false </s> add # Comment to post when closing a stale issue. Set to `false` to disable. 'closeComment': false </s> remove name: golangci-lint on: push: tags: - v* branches: - '*' pull_request: jobs: golangci: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: golangci-lint uses: golangci/golangci-lint-action@v2.3.0 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.32 eslint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install modules run: npm --prefix client ci - name: Run ESLint run: npm --prefix client run lint notify: needs: [golangci,eslint] # Secrets are not passed to workflows that are triggered by a pull request from a fork if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} runs-on: ubuntu-latest steps: - name: Conclusion uses: technote-space/workflow-conclusion-action@v1 - name: Send Slack notif uses: 8398a7/action-slack@v3 with: status: ${{ env.WORKFLOW_CONCLUSION }} fields: repo,message,commit,author env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} </s> add 'name': 'golangci-lint' 'on': 'push': 'tags': - 'v*' 'branches': - '*' 'pull_request': 'jobs': 'golangci': 'runs-on': 'ubuntu-latest' 'steps': - 'uses': 'actions/checkout@v2' - 'name': 'golangci-lint' 'uses': 'golangci/golangci-lint-action@v2.3.0' 'with': # This field is required. Don't set the patch version to always use # the latest patch version. 'version': 'v1.32' 'eslint': 'runs-on': 'ubuntu-latest' 'steps': - 'uses': 'actions/checkout@v2' - 'name': 'Install modules' 'run': 'npm --prefix client ci' - 'name': 'Run ESLint' 'run': 'npm --prefix client run lint' 'notify': 'needs': - 'golangci' - 'eslint' # Secrets are not passed to workflows that are triggered by a pull request # from a fork. 'if': "${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}" 'runs-on': 'ubuntu-latest' 'steps': - 'name': 'Conclusion' 'uses': 'technote-space/workflow-conclusion-action@v1' - 'name': 'Send Slack notif' 'uses': '8398a7/action-slack@v3' 'with': 'status': '${{ env.WORKFLOW_CONCLUSION }}' 'fields': 'repo, message, commit, author' 'env': 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}' 'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}'
https://github.com/AdguardTeam/AdGuardHome/commit/046ec13fdc5ec008fd4ac9b77cc943a96be2605c
.goreleaser.yml
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 keep replace replace
<mask> AdGuard Home is a network-wide software for blocking ads & tracking. After <mask> you set it up, it'll cover ALL your home devices, and you don't need any <mask> client-side software for that. <mask> <mask> It operates as a DNS server that re-routes tracking domains to a "black hole," <mask> thus preventing your devices from connecting to those servers. It's based <mask> on software we use for our public AdGuard DNS servers -- both share a lot <mask> of common code. <mask> grade: stable <mask> confinement: strict <mask> publish: false <mask> license: GPL-3.0 <mask> extra_files: <mask> - source: scripts/snap/local/adguard-home-web.sh <mask> destination: adguard-home-web.sh <mask> mode: 0755 <mask> - source: scripts/snap/gui/adguard-home-web.desktop <mask> destination: meta/gui/adguard-home-web.desktop <mask> mode: 0644 <mask> - source: scripts/snap/gui/adguard-home-web.png <mask> destination: meta/gui/adguard-home-web.png <mask> mode: 0644 <mask> apps: <mask> adguard-home: <mask> command: AdGuardHome -w $SNAP_DATA --no-check-update <mask> plugs: <mask> # Add the "netrwork-bind" plug to bind to interfaces. <mask> - network-bind <mask> # Add the "netrwork-control" plug to be able to bind to ports below <mask> # 1024 (cap_net_bind_service) and also to bind to a particular <mask> # interface using SO_BINDTODEVICE (cap_net_raw). <mask> - network-control <mask> daemon: simple <mask> adguard-home-web: <mask> command: adguard-home-web.sh <mask> plugs: [ desktop ] <mask> <mask> checksum: <mask> name_template: 'checksums.txt' </s> Pull request: all: reformat yaml, add yaml formatting standard Merge in DNS/adguard-home from 2297-yaml to master Closes #2297. Squashed commit of the following: commit 85df3a38a14adb1965944ddf14b197c12a213057 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:52:22 2020 +0300 all: improve HACKING.md commit 079acdfe41cc12ab6aa13d7c28dcbf7b7b3c8380 Merge: 202ea078e 3045da174 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 20 17:50:34 2020 +0300 Merge branch 'master' into 2297-yaml commit 202ea078e29d88871a32ac6e668dfae6db802bab Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 12 20:25:42 2020 +0300 all: reformat yaml, add yaml formatting standard </s> remove snapcrafts: - name: adguard-home base: core18 name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' summary: Network-wide ads & trackers blocking DNS server description: | AdGuard Home is a network-wide software for blocking ads & tracking. After you set it up, it'll cover ALL your home devices, and you don't need any client-side software for that. </s> add 'snapcrafts': - 'name': 'adguard-home' 'base': 'core18' 'name_template': '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' 'summary': 'Network-wide ads & trackers blocking DNS server' 'description': | AdGuard Home is a network-wide software for blocking ads & tracking. After you set it up, it'll cover ALL your home devices, and you don't need any client-side software for that. </s> remove # Number of days of inactivity before an issue becomes stale daysUntilStale: 60 # Number of days of inactivity before a stale issue is closed daysUntilClose: 7 # Issues with these labels will never be considered stale exemptLabels: - 'bug' - 'enhancement' - 'feature request' - 'localization' # Label to use when marking an issue as stale staleLabel: 'wontfix' # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > </s> add # Number of days of inactivity before an issue becomes stale. 'daysUntilStale': 60 # Number of days of inactivity before a stale issue is closed. 'daysUntilClose': 7 # Issues with these labels will never be considered stale. 'exemptLabels': - 'bug' - 'enhancement' - 'feature request' - 'localization' # Label to use when marking an issue as stale. 'staleLabel': 'wontfix' # Comment to post when marking an issue as stale. Set to `false` to disable. 'markComment': > </s> remove # Comment to post when closing a stale issue. Set to `false` to disable closeComment: false </s> add # Comment to post when closing a stale issue. Set to `false` to disable. 'closeComment': false </s> remove name: golangci-lint on: push: tags: - v* branches: - '*' pull_request: jobs: golangci: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: golangci-lint uses: golangci/golangci-lint-action@v2.3.0 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.32 eslint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install modules run: npm --prefix client ci - name: Run ESLint run: npm --prefix client run lint notify: needs: [golangci,eslint] # Secrets are not passed to workflows that are triggered by a pull request from a fork if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} runs-on: ubuntu-latest steps: - name: Conclusion uses: technote-space/workflow-conclusion-action@v1 - name: Send Slack notif uses: 8398a7/action-slack@v3 with: status: ${{ env.WORKFLOW_CONCLUSION }} fields: repo,message,commit,author env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} </s> add 'name': 'golangci-lint' 'on': 'push': 'tags': - 'v*' 'branches': - '*' 'pull_request': 'jobs': 'golangci': 'runs-on': 'ubuntu-latest' 'steps': - 'uses': 'actions/checkout@v2' - 'name': 'golangci-lint' 'uses': 'golangci/golangci-lint-action@v2.3.0' 'with': # This field is required. Don't set the patch version to always use # the latest patch version. 'version': 'v1.32' 'eslint': 'runs-on': 'ubuntu-latest' 'steps': - 'uses': 'actions/checkout@v2' - 'name': 'Install modules' 'run': 'npm --prefix client ci' - 'name': 'Run ESLint' 'run': 'npm --prefix client run lint' 'notify': 'needs': - 'golangci' - 'eslint' # Secrets are not passed to workflows that are triggered by a pull request # from a fork. 'if': "${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}" 'runs-on': 'ubuntu-latest' 'steps': - 'name': 'Conclusion' 'uses': 'technote-space/workflow-conclusion-action@v1' - 'name': 'Send Slack notif' 'uses': '8398a7/action-slack@v3' 'with': 'status': '${{ env.WORKFLOW_CONCLUSION }}' 'fields': 'repo, message, commit, author' 'env': 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}' 'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}' </s> remove skip-files: - ".*generated.*" - dnsfilter/rule_to_regexp.go - util/pprof.go - ".*_test.go" - client/.* - build/.* - dist/.* </s> add 'skip-files': - '.*generated.*' - 'dnsfilter/rule_to_regexp.go' - 'util/pprof.go' - '.*_test.go' - 'client/.*' - 'build/.*' - 'dist/.*'
https://github.com/AdguardTeam/AdGuardHome/commit/046ec13fdc5ec008fd4ac9b77cc943a96be2605c
.goreleaser.yml
keep keep add keep keep keep keep keep keep
<mask> SafeSearchEnabled bool <mask> SafeBrowsingEnabled bool <mask> ParentalEnabled bool <mask> } <mask> <mask> type clientJSON struct { <mask> IP string `json:"ip"` <mask> MAC string `json:"mac"` <mask> Name string `json:"name"` </s> + clients: add BlockedServices field </s> add UseOwnBlockedServices: !cj.UseGlobalBlockedServices, BlockedServices: cj.BlockedServices, </s> add UseGlobalBlockedServices bool `json:"use_global_blocked_services"` BlockedServices []string `json:"blocked_services"` </s> add UseGlobalBlockedServices: !c.UseOwnBlockedServices, BlockedServices: c.BlockedServices,
https://github.com/AdguardTeam/AdGuardHome/commit/04a477c14a1eeea6426c07d5ae0434afe0b6b398
home/clients.go
keep keep add keep keep keep keep keep
<mask> ParentalEnabled bool `json:"parental_enabled"` <mask> SafeSearchEnabled bool `json:"safebrowsing_enabled"` <mask> SafeBrowsingEnabled bool `json:"safesearch_enabled"` <mask> } <mask> <mask> type clientSource uint <mask> <mask> const ( </s> + clients: add BlockedServices field </s> add UseOwnBlockedServices: !cj.UseGlobalBlockedServices, BlockedServices: cj.BlockedServices, </s> add UseGlobalBlockedServices: !c.UseOwnBlockedServices, BlockedServices: c.BlockedServices, </s> add UseOwnBlockedServices bool // false: use global settings BlockedServices []string
https://github.com/AdguardTeam/AdGuardHome/commit/04a477c14a1eeea6426c07d5ae0434afe0b6b398
home/clients.go
keep keep keep add keep keep keep keep
<mask> FilteringEnabled: c.FilteringEnabled, <mask> ParentalEnabled: c.ParentalEnabled, <mask> SafeSearchEnabled: c.SafeSearchEnabled, <mask> SafeBrowsingEnabled: c.SafeBrowsingEnabled, <mask> } <mask> <mask> if len(c.MAC) != 0 { <mask> hwAddr, _ := net.ParseMAC(c.MAC) </s> + clients: add BlockedServices field </s> add UseOwnBlockedServices: !cj.UseGlobalBlockedServices, BlockedServices: cj.BlockedServices, </s> add UseGlobalBlockedServices bool `json:"use_global_blocked_services"` BlockedServices []string `json:"blocked_services"` </s> add UseOwnBlockedServices bool // false: use global settings BlockedServices []string
https://github.com/AdguardTeam/AdGuardHome/commit/04a477c14a1eeea6426c07d5ae0434afe0b6b398
home/clients.go
keep keep keep add keep keep keep keep
<mask> FilteringEnabled: cj.FilteringEnabled, <mask> ParentalEnabled: cj.ParentalEnabled, <mask> SafeSearchEnabled: cj.SafeSearchEnabled, <mask> SafeBrowsingEnabled: cj.SafeBrowsingEnabled, <mask> } <mask> return &c, nil <mask> } <mask> </s> + clients: add BlockedServices field </s> add UseGlobalBlockedServices bool `json:"use_global_blocked_services"` BlockedServices []string `json:"blocked_services"` </s> add UseGlobalBlockedServices: !c.UseOwnBlockedServices, BlockedServices: c.BlockedServices, </s> add UseOwnBlockedServices bool // false: use global settings BlockedServices []string
https://github.com/AdguardTeam/AdGuardHome/commit/04a477c14a1eeea6426c07d5ae0434afe0b6b398
home/clients.go
keep keep add keep keep keep keep keep keep
<mask> "bytes" <mask> "fmt" <mask> "net" <mask> "sync" <mask> <mask> "github.com/AdguardTeam/golibs/errors" <mask> "golang.org/x/exp/slices" <mask> ) <mask> </s> Pull request: 5035-netip-arp-hosts Updates #5035. Squashed commit of the following: commit d1c4493ee4e28d05670c20532ebae1aa809d18da Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Oct 25 14:26:52 2022 +0300 aghnet: imp hosts rec equal commit 0a7f40a64a819245fba20d3b481b0fc34e0c60e6 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Oct 24 18:10:09 2022 +0300 aghnet: move arp and hosts to netip.Addr </s> remove "net" </s> add "net/netip" </s> add "net/netip" </s> add "net/netip" </s> add "net/netip" </s> add "net/netip" </s> add "net/netip"
https://github.com/AdguardTeam/AdGuardHome/commit/04c8e3b2886bb02866ace61f796733c82b3e9aca
internal/aghnet/arpdb.go
keep keep keep keep replace keep keep keep keep keep
<mask> // implementation of ARP is able to retrieve that. <mask> Name string <mask> <mask> // IP contains either IPv4 or IPv6. <mask> IP net.IP <mask> <mask> // MAC contains the hardware address. <mask> MAC net.HardwareAddr <mask> } <mask> </s> Pull request: 5035-netip-arp-hosts Updates #5035. Squashed commit of the following: commit d1c4493ee4e28d05670c20532ebae1aa809d18da Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Oct 25 14:26:52 2022 +0300 aghnet: imp hosts rec equal commit 0a7f40a64a819245fba20d3b481b0fc34e0c60e6 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Oct 24 18:10:09 2022 +0300 aghnet: move arp and hosts to netip.Addr </s> remove if ip.To4() != nil { </s> add if ip.Is4() { </s> remove // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil } return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } </s> add </s> remove rc, ok := clients.FindRuntimeClient(ip) </s> add rc, ok := clients.findRuntimeClient(ip) </s> remove func (hp *hostsParser) addRecord(ip net.IP, hosts []string) { </s> add func (hp *hostsParser) addRecord(ip netip.Addr, hosts []string) { </s> remove // // TODO(e.burkov): Use map[netip.Addr]struct{} instead. updates chan *netutil.IPMap </s> add updates chan HostsRecords </s> remove IP: slices.Clone(n.IP), </s> add IP: n.IP,
https://github.com/AdguardTeam/AdGuardHome/commit/04c8e3b2886bb02866ace61f796733c82b3e9aca
internal/aghnet/arpdb.go
keep keep keep keep replace keep keep keep keep keep
<mask> // Clone returns the deep copy of n. <mask> func (n Neighbor) Clone() (clone Neighbor) { <mask> return Neighbor{ <mask> Name: n.Name, <mask> IP: slices.Clone(n.IP), <mask> MAC: slices.Clone(n.MAC), <mask> } <mask> } <mask> <mask> // neighs is the helper type that stores neighbors to avoid copying its methods </s> Pull request: 5035-netip-arp-hosts Updates #5035. Squashed commit of the following: commit d1c4493ee4e28d05670c20532ebae1aa809d18da Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Oct 25 14:26:52 2022 +0300 aghnet: imp hosts rec equal commit 0a7f40a64a819245fba20d3b481b0fc34e0c60e6 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Oct 24 18:10:09 2022 +0300 aghnet: move arp and hosts to netip.Addr </s> remove // Upd returns the channel into which the updates are sent. The receivable // map's values are guaranteed to be of type of *HostsRecord. func (hc *HostsContainer) Upd() (updates <-chan *netutil.IPMap) { </s> add // Upd returns the channel into which the updates are sent. func (hc *HostsContainer) Upd() (updates <-chan HostsRecords) { </s> remove // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil } return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } </s> add </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap]. </s> add </s> remove table *netutil.IPMap </s> add table HostsRecords </s> remove // equalSet returns true if the internal hosts table just parsed equals target. // target's values must be of type *HostsRecord. func (hp *hostsParser) equalSet(target *netutil.IPMap) (ok bool) { if target == nil { // hp.table shouldn't appear nil since it's initialized on each refresh. return target == hp.table } if hp.table.Len() != target.Len() { return false } hp.table.Range(func(ip net.IP, recVal any) (cont bool) { var targetVal any targetVal, ok = target.Get(ip) if !ok { return false } var rec *HostsRecord rec, ok = recVal.(*HostsRecord) if !ok { log.Error("%s: comparing: unexpected type %T", hostsContainerPref, recVal) return false } var targetRec *HostsRecord targetRec, ok = targetVal.(*HostsRecord) if !ok { log.Error("%s: comparing: target: unexpected type %T", hostsContainerPref, targetVal) return false } ok = rec.Equal(targetRec) return ok }) return ok } </s> add </s> remove // // TODO(e.burkov): Use map[netip.Addr]struct{} instead. updates chan *netutil.IPMap </s> add updates chan HostsRecords
https://github.com/AdguardTeam/AdGuardHome/commit/04c8e3b2886bb02866ace61f796733c82b3e9aca
internal/aghnet/arpdb.go
keep add keep keep keep keep keep keep
<mask> "bufio" <mask> "net" <mask> "strings" <mask> "sync" <mask> <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/netutil" <mask> ) </s> Pull request: 5035-netip-arp-hosts Updates #5035. Squashed commit of the following: commit d1c4493ee4e28d05670c20532ebae1aa809d18da Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Oct 25 14:26:52 2022 +0300 aghnet: imp hosts rec equal commit 0a7f40a64a819245fba20d3b481b0fc34e0c60e6 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Oct 24 18:10:09 2022 +0300 aghnet: move arp and hosts to netip.Addr </s> add "net/netip" </s> add "net/netip" </s> add "net/netip" </s> remove "net" </s> add "net/netip" </s> add "net/netip" </s> add "net/netip"
https://github.com/AdguardTeam/AdGuardHome/commit/04c8e3b2886bb02866ace61f796733c82b3e9aca
internal/aghnet/arpdb_bsd.go
keep keep keep keep replace keep keep keep keep keep
<mask> n := Neighbor{} <mask> <mask> if ipStr := fields[1]; len(ipStr) < 2 { <mask> continue <mask> } else if ip := net.ParseIP(ipStr[1 : len(ipStr)-1]); ip == nil { <mask> continue <mask> } else { <mask> n.IP = ip <mask> } <mask> </s> Pull request: 5035-netip-arp-hosts Updates #5035. Squashed commit of the following: commit d1c4493ee4e28d05670c20532ebae1aa809d18da Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Oct 25 14:26:52 2022 +0300 aghnet: imp hosts rec equal commit 0a7f40a64a819245fba20d3b481b0fc34e0c60e6 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Oct 24 18:10:09 2022 +0300 aghnet: move arp and hosts to netip.Addr </s> remove } else if ip := net.ParseIP(ipStr[1 : len(ipStr)-1]); ip == nil { </s> add } else if ip, err := netip.ParseAddr(ipStr[1 : len(ipStr)-1]); err != nil { log.Debug("arpdb: parsing arp output: ip: %s", err) </s> remove if ip := net.ParseIP(fields[0]); ip == nil { </s> add ip, err := netip.ParseAddr(fields[0]) if err != nil { </s> remove if ip := net.ParseIP(fields[0]); ip == nil { </s> add ip, err := netip.ParseAddr(fields[0]) if err != nil { log.Debug("arpdb: parsing arp output: ip: %s", err) </s> remove if ip := net.ParseIP(fields[0]); ip == nil { </s> add ip, err := netip.ParseAddr(fields[0]) if err != nil { log.Debug("arpdb: parsing arp output: ip: %s", err) </s> remove if ip := net.ParseIP(fields[0]); ip == nil || n.IP.IsUnspecified() { </s> add ip, err := netip.ParseAddr(fields[0]) if err != nil || n.IP.IsUnspecified() { log.Debug("arpdb: parsing arp output: ip: %s", err) </s> remove if n.IP = net.ParseIP(fields[0]); n.IP == nil || n.IP.IsUnspecified() { </s> add n.IP, err = netip.ParseAddr(fields[0]) if err != nil || n.IP.IsUnspecified() {
https://github.com/AdguardTeam/AdGuardHome/commit/04c8e3b2886bb02866ace61f796733c82b3e9aca
internal/aghnet/arpdb_bsd.go
keep keep keep keep replace keep keep keep keep keep
<mask> n.IP = ip <mask> } <mask> <mask> hwStr := fields[3] <mask> if mac, err := net.ParseMAC(hwStr); err != nil { <mask> continue <mask> } else { <mask> n.MAC = mac <mask> } <mask> </s> Pull request: 5035-netip-arp-hosts Updates #5035. Squashed commit of the following: commit d1c4493ee4e28d05670c20532ebae1aa809d18da Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Oct 25 14:26:52 2022 +0300 aghnet: imp hosts rec equal commit 0a7f40a64a819245fba20d3b481b0fc34e0c60e6 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Oct 24 18:10:09 2022 +0300 aghnet: move arp and hosts to netip.Addr </s> remove if mac, err := net.ParseMAC(hwStr); err != nil { log.Debug("parsing arp output: %s", err) </s> add mac, err := net.ParseMAC(hwStr) if err != nil { log.Debug("arpdb: parsing arp output: mac: %s", err) </s> remove log.Debug("parsing arp output: %s", err) </s> add log.Debug("arpdb: parsing arp output: mac: %s", err) </s> remove if mac, err := net.ParseMAC(fields[1]); err != nil { </s> add mac, err := net.ParseMAC(fields[1]) if err != nil { </s> remove if mac, err := net.ParseMAC(fields[1]); err != nil { log.Debug("parsing arp output: %s", err) </s> add mac, err := net.ParseMAC(fields[1]) if err != nil { log.Debug("arpdb: parsing arp output: mac: %s", err) </s> remove if mac, err := net.ParseMAC(fields[4]); err != nil { log.Debug("parsing arp output: %s", err) </s> add mac, err := net.ParseMAC(fields[4]) if err != nil { log.Debug("arpdb: parsing arp output: mac: %s", err) </s> remove if ip := net.ParseIP(fields[0]); ip == nil { </s> add ip, err := netip.ParseAddr(fields[0]) if err != nil {
https://github.com/AdguardTeam/AdGuardHome/commit/04c8e3b2886bb02866ace61f796733c82b3e9aca
internal/aghnet/arpdb_bsd.go