docstring_tokens
stringlengths
0
76.5k
code_tokens
stringlengths
75
1.81M
label_window
sequencelengths
4
2.12k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
r.Header.Del(httphdr.Cookie)
<mask> r.URL = &url.URL{Path: loginURL} <mask> handlerCalled = false <mask> handler2(&w, &r) <mask> assert.True(t, handlerCalled) <mask> r.Header.Del("Cookie") <mask> <mask> Context.auth.Close() <mask> } <mask> <mask> func TestRealIP(t *testing.T) { </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove r.Header.Set("Cookie", "bad") </s> add r.Header.Set(httphdr.Cookie, "bad") </s> remove r.Header.Del("Cookie") </s> add r.Header.Del(httphdr.Cookie) </s> remove loginURL := w.hdr.Get("Location") </s> add loginURL := w.hdr.Get(httphdr.Location) </s> remove assert.NotEmpty(t, w.hdr.Get("Location")) </s> add assert.NotEmpty(t, w.hdr.Get(httphdr.Location)) </s> remove assert.NotEmpty(t, w.hdr.Get("Location")) </s> add assert.NotEmpty(t, w.hdr.Get(httphdr.Location))
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
textproto.CanonicalMIMEHeaderKey(httphdr.XRealIP): []string{"1.2.3.5"},
<mask> wantIP: net.IPv4(1, 2, 3, 4), <mask> }, { <mask> name: "success_proxy", <mask> header: http.Header{ <mask> textproto.CanonicalMIMEHeaderKey("X-Real-IP"): []string{"1.2.3.5"}, <mask> }, <mask> remoteAddr: remoteAddr, <mask> wantErrMsg: "", <mask> wantIP: net.IPv4(1, 2, 3, 5), <mask> }, { </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove textproto.CanonicalMIMEHeaderKey("X-Forwarded-For"): []string{ </s> add textproto.CanonicalMIMEHeaderKey(httphdr.XForwardedFor): []string{ </s> remove h.Set("Content-Disposition", d) </s> add h.Set(httphdr.ContentDisposition, d) </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType) </s> remove w.Header().Set("Location", "/login.html") </s> add w.Header().Set(httphdr.Location, "/login.html") </s> remove w.Header().Set("Content-Disposition", contDisp) </s> add w.Header().Set(httphdr.ContentDisposition, contDisp)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
textproto.CanonicalMIMEHeaderKey(httphdr.XForwardedFor): []string{
<mask> wantIP: net.IPv4(1, 2, 3, 5), <mask> }, { <mask> name: "success_proxy_multiple", <mask> header: http.Header{ <mask> textproto.CanonicalMIMEHeaderKey("X-Forwarded-For"): []string{ <mask> "1.2.3.6, 1.2.3.5", <mask> }, <mask> }, <mask> remoteAddr: remoteAddr, <mask> wantErrMsg: "", </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove textproto.CanonicalMIMEHeaderKey("X-Real-IP"): []string{"1.2.3.5"}, </s> add textproto.CanonicalMIMEHeaderKey(httphdr.XRealIP): []string{"1.2.3.5"}, </s> remove "CF-Connecting-IP", "True-Client-IP", "X-Real-IP", </s> add httphdr.CFConnectingIP, httphdr.TrueClientIP, httphdr.XRealIP, </s> remove h.Set("Content-Disposition", d) </s> add h.Set(httphdr.ContentDisposition, d) </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType) </s> remove w.Header().Set("Location", "/login.html") </s> add w.Header().Set(httphdr.Location, "/login.html")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
"github.com/AdguardTeam/golibs/httphdr"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" <mask> "github.com/AdguardTeam/AdGuardHome/internal/version" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/netutil" <mask> "github.com/NYTimes/gziphandler" <mask> ) <mask> <mask> // appendDNSAddrs is a convenient helper for appending a formatted form of DNS </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain {
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/control.go
cType := r.Header.Get(httphdr.ContentType)
<mask> // to w, and ok is false. <mask> func ensureContentType(w http.ResponseWriter, r *http.Request) (ok bool) { <mask> const statusUnsup = http.StatusUnsupportedMediaType <mask> <mask> cType := r.Header.Get(aghhttp.HdrNameContentType) <mask> if r.ContentLength == 0 { <mask> if cType == "" { <mask> return true <mask> } <mask> </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain { </s> remove w.Header().Set("Content-Disposition", contDisp) </s> add w.Header().Set(httphdr.ContentDisposition, contDisp) </s> remove w.Header().Set("Location", "/") </s> add w.Header().Set(httphdr.Location, "/") </s> remove respHdr.Set(aghhttp.HdrNameAccessControlAllowOrigin, originURL.String()) respHdr.Set(aghhttp.HdrNameVary, aghhttp.HdrNameOrigin) </s> add respHdr.Set(httphdr.AccessControlAllowOrigin, originURL.String()) respHdr.Set(httphdr.Vary, httphdr.Origin) </s> remove cType := w.Header().Get(aghhttp.HdrNameContentType) </s> add cType := w.Header().Get(httphdr.ContentType)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/control.go
respHdr.Set(httphdr.AltSvc, altSvc)
<mask> // TODO(a.garipov): Consider adding a configurable max-age. Currently, the <mask> // default is 24 hours. <mask> if serveHTTP3 { <mask> altSvc := fmt.Sprintf(`h3=":%d"`, portHTTPS) <mask> respHdr.Set(aghhttp.HdrNameAltSvc, altSvc) <mask> } <mask> <mask> if r.TLS == nil && web.forceHTTPS { <mask> hostPort := host <mask> if port := web.conf.PortHTTPS; port != defaultPortHTTPS { </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove w.Header().Set("Location", "/") </s> add w.Header().Set(httphdr.Location, "/") </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain { </s> remove h.Set(aghhttp.HdrNameContentType, aghhttp.HdrValApplicationJSON) h.Set(aghhttp.HdrNameServer, aghhttp.UserAgent()) </s> add h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) h.Set(httphdr.Server, aghhttp.UserAgent()) </s> remove s := r.Header.Get("X-Forwarded-For") </s> add s := r.Header.Get(httphdr.XForwardedFor) </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/control.go
respHdr.Set(httphdr.AccessControlAllowOrigin, originURL.String()) respHdr.Set(httphdr.Vary, httphdr.Origin)
<mask> Scheme: aghhttp.SchemeHTTP, <mask> Host: r.Host, <mask> } <mask> <mask> respHdr.Set(aghhttp.HdrNameAccessControlAllowOrigin, originURL.String()) <mask> respHdr.Set(aghhttp.HdrNameVary, aghhttp.HdrNameOrigin) <mask> <mask> return true <mask> } <mask> <mask> // postInstall lets the handler to run only if firstRun is false. Otherwise, it </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType) </s> remove respHdr.Set("Location", "/login.html") </s> add respHdr.Set(httphdr.Location, "/login.html") </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain { </s> remove w.Header().Set("Location", "/") </s> add w.Header().Set(httphdr.Location, "/") </s> remove w.Header().Set(HdrNameContentType, HdrValApplicationJSON) </s> add w.Header().Set(httphdr.ContentType, HdrValApplicationJSON)
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/control.go
"github.com/AdguardTeam/golibs/httphdr"
<mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/google/uuid" <mask> "howett.net/plist" <mask> ) <mask> </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/mobileconfig.go
w.Header().Set(httphdr.ContentType, "application/xml")
<mask> <mask> return <mask> } <mask> <mask> w.Header().Set("Content-Type", "application/xml") <mask> <mask> const ( <mask> dohContDisp = `attachment; filename=doh.mobileconfig` <mask> dotContDisp = `attachment; filename=dot.mobileconfig` <mask> ) </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove // HTTP Headers // HTTP header name constants. // // TODO(a.garipov): Remove unused. const ( HdrNameAcceptEncoding = "Accept-Encoding" HdrNameAccessControlAllowOrigin = "Access-Control-Allow-Origin" HdrNameAltSvc = "Alt-Svc" HdrNameContentEncoding = "Content-Encoding" HdrNameContentType = "Content-Type" HdrNameOrigin = "Origin" HdrNameServer = "Server" HdrNameTrailer = "Trailer" HdrNameUserAgent = "User-Agent" HdrNameVary = "Vary" ) </s> add // HTTP headers </s> remove w.Header().Set("Content-Disposition", contDisp) </s> add w.Header().Set(httphdr.ContentDisposition, contDisp) </s> remove w.Header().Set("Content-Type", "application/json") </s> add w.Header().Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/mobileconfig.go
w.Header().Set(httphdr.ContentDisposition, contDisp)
<mask> if dnsp == dnsProtoTLS { <mask> contDisp = dotContDisp <mask> } <mask> <mask> w.Header().Set("Content-Disposition", contDisp) <mask> <mask> _, _ = w.Write(mobileconfig) <mask> } <mask> <mask> func handleMobileConfigDoH(w http.ResponseWriter, r *http.Request) { </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType) </s> remove h.Set("Cache-Control", "no-store, no-cache, must-revalidate, proxy-revalidate") h.Set("Pragma", "no-cache") h.Set("Expires", "0") </s> add h.Set(httphdr.CacheControl, "no-store, no-cache, must-revalidate, proxy-revalidate") h.Set(httphdr.Pragma, "no-cache") h.Set(httphdr.Expires, "0") </s> remove w.Header().Set("Content-Type", "application/json") </s> add w.Header().Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain { </s> remove "CF-Connecting-IP", "True-Client-IP", "X-Real-IP", </s> add httphdr.CFConnectingIP, httphdr.TrueClientIP, httphdr.XRealIP,
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/mobileconfig.go
"github.com/AdguardTeam/golibs/httphdr"
<mask> "strconv" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> // JSON Utilities <mask> </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/next/websvc/json.go
h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) h.Set(httphdr.Server, aghhttp.UserAgent())
<mask> // request. <mask> func writeJSONResponse(w http.ResponseWriter, r *http.Request, v any, code int) { <mask> // TODO(a.garipov): Put some of these to a middleware. <mask> h := w.Header() <mask> h.Set(aghhttp.HdrNameContentType, aghhttp.HdrValApplicationJSON) <mask> h.Set(aghhttp.HdrNameServer, aghhttp.UserAgent()) <mask> <mask> w.WriteHeader(code) <mask> <mask> err := json.NewEncoder(w).Encode(v) <mask> if err != nil { </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove w.Header().Set(HdrNameContentType, HdrValApplicationJSON) </s> add w.Header().Set(httphdr.ContentType, HdrValApplicationJSON) </s> remove "CF-Connecting-IP", "True-Client-IP", "X-Real-IP", </s> add httphdr.CFConnectingIP, httphdr.TrueClientIP, httphdr.XRealIP, </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain { </s> remove w.Header().Set("Content-Type", "application/json") </s> add w.Header().Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) </s> remove req.Header.Set("Content-Type", cType) </s> add req.Header.Set(httphdr.ContentType, cType)
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/next/websvc/json.go
import ( "net/http" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/golibs/httphdr" )
<mask> package websvc <mask> <mask> import "net/http" <mask> <mask> // Middlewares <mask> <mask> // jsonMw sets the content type of the response to application/json. <mask> func jsonMw(h http.Handler) (wrapped http.HandlerFunc) { </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove w.Header().Set("Content-Type", "application/json") </s> add w.Header().Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain { </s> remove s := r.Header.Get("X-Forwarded-For") </s> add s := r.Header.Get(httphdr.XForwardedFor) </s> remove w.Header().Set(HdrNameContentType, HdrValApplicationJSON) </s> add w.Header().Set(httphdr.ContentType, HdrValApplicationJSON)
[ "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/next/websvc/middleware.go
w.Header().Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON)
<mask> <mask> // jsonMw sets the content type of the response to application/json. <mask> func jsonMw(h http.Handler) (wrapped http.HandlerFunc) { <mask> f := func(w http.ResponseWriter, r *http.Request) { <mask> w.Header().Set("Content-Type", "application/json") <mask> <mask> h.ServeHTTP(w, r) <mask> } <mask> <mask> return http.HandlerFunc(f) </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove import "net/http" </s> add import ( "net/http" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/golibs/httphdr" ) </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain { </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType) </s> remove s := r.Header.Get("X-Forwarded-For") </s> add s := r.Header.Get(httphdr.XForwardedFor) </s> remove w.Header().Set(HdrNameContentType, HdrValApplicationJSON) </s> add w.Header().Set(httphdr.ContentType, HdrValApplicationJSON)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/next/websvc/middleware.go
"github.com/AdguardTeam/AdGuardHome/internal/aghhttp"
<mask> "sync" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghio" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghos" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/httphdr" <mask> "github.com/AdguardTeam/golibs/log" </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
scripts/translations/main.go
"github.com/AdguardTeam/golibs/httphdr"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghos" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "golang.org/x/exp/maps" <mask> "golang.org/x/exp/slices" <mask> ) <mask> <mask> const ( </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove w.Header().Set("Content-Type", "application/xml") </s> add w.Header().Set(httphdr.ContentType, "application/xml")
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
scripts/translations/main.go
h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON)
<mask> err = errors.WithDeferred(err, file.Close()) <mask> }() <mask> <mask> h := make(textproto.MIMEHeader) <mask> h.Set("Content-Type", "application/json") <mask> <mask> d := fmt.Sprintf("form-data; name=%q; filename=%q", "file", defaultBaseFile) <mask> h.Set("Content-Disposition", d) <mask> <mask> fw, err = w.CreatePart(h) </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove h.Set("Content-Disposition", d) </s> add h.Set(httphdr.ContentDisposition, d) </s> remove h.Set(aghhttp.HdrNameContentType, aghhttp.HdrValApplicationJSON) h.Set(aghhttp.HdrNameServer, aghhttp.UserAgent()) </s> add h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) h.Set(httphdr.Server, aghhttp.UserAgent()) </s> remove "CF-Connecting-IP", "True-Client-IP", "X-Real-IP", </s> add httphdr.CFConnectingIP, httphdr.TrueClientIP, httphdr.XRealIP, </s> remove req.Header.Set("Content-Type", cType) </s> add req.Header.Set(httphdr.ContentType, cType) </s> remove respHdr.Set("Location", "/login.html") </s> add respHdr.Set(httphdr.Location, "/login.html")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
scripts/translations/main.go
h.Set(httphdr.ContentDisposition, d)
<mask> h := make(textproto.MIMEHeader) <mask> h.Set("Content-Type", "application/json") <mask> <mask> d := fmt.Sprintf("form-data; name=%q; filename=%q", "file", defaultBaseFile) <mask> h.Set("Content-Disposition", d) <mask> <mask> fw, err = w.CreatePart(h) <mask> if err != nil { <mask> return nil, "", fmt.Errorf("creating part: %w", err) <mask> } </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove h.Set("Content-Type", "application/json") </s> add h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) </s> remove req.Header.Set("Content-Type", cType) </s> add req.Header.Set(httphdr.ContentType, cType) </s> remove h.Set(aghhttp.HdrNameContentType, aghhttp.HdrValApplicationJSON) h.Set(aghhttp.HdrNameServer, aghhttp.UserAgent()) </s> add h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) h.Set(httphdr.Server, aghhttp.UserAgent()) </s> remove respHdr.Set("Location", "/login.html") </s> add respHdr.Set(httphdr.Location, "/login.html") </s> remove w.Header().Set(HdrNameContentType, HdrValApplicationJSON) </s> add w.Header().Set(httphdr.ContentType, HdrValApplicationJSON)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
scripts/translations/main.go
req.Header.Set(httphdr.ContentType, cType)
<mask> if err != nil { <mask> return fmt.Errorf("bad request: %w", err) <mask> } <mask> <mask> req.Header.Set("Content-Type", cType) <mask> <mask> resp, err := client.Do(req) <mask> if err != nil { <mask> return fmt.Errorf("client post form: %w", err) <mask> } </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove h.Set("Content-Disposition", d) </s> add h.Set(httphdr.ContentDisposition, d) </s> remove respHdr.Set("Location", "/login.html") </s> add respHdr.Set(httphdr.Location, "/login.html") </s> remove w.Header().Set(HdrNameContentType, HdrValApplicationJSON) </s> add w.Header().Set(httphdr.ContentType, HdrValApplicationJSON) </s> remove w.Header().Set("Location", "/") </s> add w.Header().Set(httphdr.Location, "/") </s> remove h.Set(aghhttp.HdrNameContentType, aghhttp.HdrValApplicationJSON) h.Set(aghhttp.HdrNameServer, aghhttp.UserAgent()) </s> add h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) h.Set(httphdr.Server, aghhttp.UserAgent())
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
scripts/translations/main.go
overflow-y: scroll; max-height: 100%;
<mask> border-radius: 4px !important; <mask> pointer-events: auto !important; <mask> background-color: var(--white); <mask> z-index: 102; <mask> } <mask> <mask> .white-space--nowrap { <mask> white-space: nowrap !important; <mask> } </s> Open tooltip on hover, show scroll on overflow y </s> remove .tooltip__container { overflow-y: scroll; } </s> add </s> remove scrollHide: PropTypes.bool, </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15db9e9c1daec31d5d6f1d6d77a59bc125fb00d5
client/src/components/Logs/Cells/Tooltip.css
<mask> <mask> .grid .key-colon, .grid .title--border { <mask> font-weight: bold; <mask> } <mask> <mask> .tooltip__container { <mask> overflow-y: scroll; <mask> } <mask> } <mask> <mask> .grid .key-colon:nth-child(odd)::after { <mask> content: ':'; <mask> } </s> Open tooltip on hover, show scroll on overflow y </s> remove scrollHide: PropTypes.bool, </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15db9e9c1daec31d5d6f1d6d77a59bc125fb00d5
client/src/components/Logs/Cells/Tooltip.css
import { HIDE_TOOLTIP_DELAY } from '../../../helpers/constants';
<mask> import './Tooltip.css'; <mask> import 'react-popper-tooltip/dist/styles.css'; <mask> <mask> const getHintElement = ({ <mask> className, <mask> contentItemClass, </s> Open tooltip on hover, show scroll on overflow y </s> remove scrollHide: PropTypes.bool, </s> add </s> remove .tooltip__container { overflow-y: scroll; } </s> add
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15db9e9c1daec31d5d6f1d6d77a59bc125fb00d5
client/src/components/Logs/Cells/getHintElement.js
<mask> title: PropTypes.string, <mask> placement: PropTypes.string, <mask> canShowTooltip: PropTypes.string, <mask> xlinkHref: PropTypes.string, <mask> scrollHide: PropTypes.bool, <mask> content: PropTypes.oneOfType([ <mask> PropTypes.string, <mask> PropTypes.array, <mask> ]), <mask> renderContent: PropTypes.arrayOf(PropTypes.element), </s> Open tooltip on hover, show scroll on overflow y </s> remove .tooltip__container { overflow-y: scroll; } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15db9e9c1daec31d5d6f1d6d77a59bc125fb00d5
client/src/components/Logs/Cells/getHintElement.js
export const HIDE_TOOLTIP_DELAY = 300;
<mask> export const DEBOUNCE_FILTER_TIMEOUT = 500; <mask> export const CHECK_TIMEOUT = 1000; <mask> export const SUCCESS_TOAST_TIMEOUT = 5000; <mask> export const FAILURE_TOAST_TIMEOUT = 30000; <mask> <mask> export const UNSAFE_PORTS = [ <mask> 1, <mask> 7, </s> Open tooltip on hover, show scroll on overflow y </s> remove scrollHide: PropTypes.bool, </s> add </s> remove .tooltip__container { overflow-y: scroll; } </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15db9e9c1daec31d5d6f1d6d77a59bc125fb00d5
client/src/helpers/constants.js
"github.com/AdguardTeam/golibs/errors"
<mask> "runtime" <mask> "strconv" <mask> "strings" <mask> <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> // UnsupportedError is returned by functions and methods when a particular <mask> // operation Op cannot be performed on the current OS. <mask> type UnsupportedError struct { </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // Represents the program that will be launched by a service or daemon </s> add // program represents the program that will be launched by as a service or a // daemon. </s> remove // On OpenWrt it is important to run enable after the service installation // Otherwise, the service won't start on the system startup </s> add // On OpenWrt it is important to run enable after the service // installation Otherwise, the service won't start on the system // startup.
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/aghos/os.go
if errors.As(err, new(*exec.ExitError)) { return cmd.ProcessState.ExitCode(), string(out), nil } else if err != nil { return 1, "", fmt.Errorf("exec.Command(%s) failed: %w: %s", command, err, string(out))
<mask> out, err := cmd.Output() <mask> if len(out) > MaxCmdOutputSize { <mask> out = out[:MaxCmdOutputSize] <mask> } <mask> if err != nil { <mask> return 1, "", fmt.Errorf("exec.Command(%s) failed: %v: %s", command, err, string(out)) <mask> } <mask> <mask> return cmd.ProcessState.ExitCode(), string(out), nil <mask> } <mask> </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove } else if action == "run" { err = s.Run() if err != nil { </s> add case "run": if err = s.Run(); err != nil { </s> remove s, err := service.New(prg, svcConfig) if err != nil { </s> add var s service.Service if s, err = service.New(prg, svcConfig); err != nil { </s> remove err := svcAction(s, "uninstall") if err != nil { </s> add if err := svcAction(s, "uninstall"); err != nil { </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil { </s> remove if action == "status" { </s> add switch action { case "status":
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/aghos/os.go
<mask> } <mask> }() <mask> <mask> if args.serviceControlAction != "" { <mask> // TODO(a.garipov): github.com/kardianos/service doesn't seem to <mask> // support OpenBSD currently. Either patch it to do so or make <mask> // our own implementation of the service.System interface. <mask> if runtime.GOOS == "openbsd" { <mask> log.Fatal("service actions are not supported on openbsd, see issue 3226") <mask> } <mask> <mask> handleServiceControlAction(args, clientBuildFS) <mask> <mask> return <mask> } <mask> </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // Send SIGHUP to a process with ID taken from our pid-file // If pid-file doesn't exist, find our PID using 'ps' command </s> add // Send SIGHUP to a process with PID taken from our .pid file. If it doesn't // exist, find our PID using 'ps' command. </s> remove // On OpenWrt it is important to run enable after the service installation // Otherwise, the service won't start on the system startup </s> add // On OpenWrt it is important to run enable after the service // installation Otherwise, the service won't start on the system // startup. </s> remove err := svcAction(s, "uninstall") if err != nil { </s> add if err := svcAction(s, "uninstall"); err != nil {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/home.go
"time"
<mask> "strconv" <mask> "strings" <mask> "syscall" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghos" <mask> "github.com/AdguardTeam/AdGuardHome/internal/version" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/kardianos/service" </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove err = os.Remove(launchdStdoutPath) </s> add err := os.Remove(launchdStdoutPath) </s> remove if err != nil { return 1, "", fmt.Errorf("exec.Command(%s) failed: %v: %s", command, err, string(out)) </s> add if errors.As(err, new(*exec.ExitError)) { return cmd.ProcessState.ExitCode(), string(out), nil } else if err != nil { return 1, "", fmt.Errorf("exec.Command(%s) failed: %w: %s", command, err, string(out)) </s> remove // TODO(a.garipov): github.com/kardianos/service doesn't seem to // support OpenBSD currently. Either patch it to do so or make // our own implementation of the service.System interface. if runtime.GOOS == "openbsd" { log.Fatal("service actions are not supported on openbsd, see issue 3226") } </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
"github.com/AdguardTeam/AdGuardHome/internal/version"
<mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghos" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/kardianos/service" <mask> ) <mask> </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // Represents the program that will be launched by a service or daemon </s> add // program represents the program that will be launched by as a service or a // daemon. </s> remove err = os.Remove(launchdStdoutPath) </s> add err := os.Remove(launchdStdoutPath) </s> remove if err != nil { return 1, "", fmt.Errorf("exec.Command(%s) failed: %v: %s", command, err, string(out)) </s> add if errors.As(err, new(*exec.ExitError)) { return cmd.ProcessState.ExitCode(), string(out), nil } else if err != nil { return 1, "", fmt.Errorf("exec.Command(%s) failed: %w: %s", command, err, string(out))
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
// program represents the program that will be launched by as a service or a // daemon.
<mask> serviceDisplayName = "AdGuard Home service" <mask> serviceDescription = "AdGuard Home: Network-level blocker" <mask> ) <mask> <mask> // Represents the program that will be launched by a service or daemon <mask> type program struct { <mask> clientBuildFS fs.FS <mask> opts options <mask> } <mask> </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // Start should quickly start the program func (p *program) Start(s service.Service) error { // Start should not block. Do the actual work async. </s> add // Start implements service.Interface interface for *program. func (p *program) Start(_ service.Service) (err error) { // Start should not block. Do the actual work async. </s> remove // Stop stops the program func (p *program) Stop(s service.Service) error { // Stop should not block. Return with a few seconds. </s> add // Stop implements service.Interface interface for *program. func (p *program) Stop(_ service.Service) error { // Stop should not block. Return with a few seconds.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
// Start implements service.Interface interface for *program. func (p *program) Start(_ service.Service) (err error) { // Start should not block. Do the actual work async.
<mask> clientBuildFS fs.FS <mask> opts options <mask> } <mask> <mask> // Start should quickly start the program <mask> func (p *program) Start(s service.Service) error { <mask> // Start should not block. Do the actual work async. <mask> args := p.opts <mask> args.runningAsService = true <mask> go run(args, p.clientBuildFS) <mask> <mask> return nil </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // Stop stops the program func (p *program) Stop(s service.Service) error { // Stop should not block. Return with a few seconds. </s> add // Stop implements service.Interface interface for *program. func (p *program) Stop(_ service.Service) error { // Stop should not block. Return with a few seconds. </s> remove // Represents the program that will be launched by a service or daemon </s> add // program represents the program that will be launched by as a service or a // daemon. </s> remove // Start automatically after install </s> add // Start automatically after install. </s> remove // svcStatus check the service's status. </s> add // svcStatus returns the service's status. </s> remove // On OpenWrt it is important to run enable after the service installation // Otherwise, the service won't start on the system startup </s> add // On OpenWrt it is important to run enable after the service // installation Otherwise, the service won't start on the system // startup.
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
// Stop implements service.Interface interface for *program. func (p *program) Stop(_ service.Service) error { // Stop should not block. Return with a few seconds.
<mask> <mask> return nil <mask> } <mask> <mask> // Stop stops the program <mask> func (p *program) Stop(s service.Service) error { <mask> // Stop should not block. Return with a few seconds. <mask> if Context.appSignalChannel == nil { <mask> os.Exit(0) <mask> } <mask> Context.appSignalChannel <- syscall.SIGINT <mask> return nil </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // Start should quickly start the program func (p *program) Start(s service.Service) error { // Start should not block. Do the actual work async. </s> add // Start implements service.Interface interface for *program. func (p *program) Start(_ service.Service) (err error) { // Start should not block. Do the actual work async. </s> remove // svcStatus check the service's status. </s> add // svcStatus returns the service's status. </s> remove // Send SIGHUP to a process with ID taken from our pid-file // If pid-file doesn't exist, find our PID using 'ps' command </s> add // Send SIGHUP to a process with PID taken from our .pid file. If it doesn't // exist, find our PID using 'ps' command. </s> remove if err != nil { return 1, "", fmt.Errorf("exec.Command(%s) failed: %v: %s", command, err, string(out)) </s> add if errors.As(err, new(*exec.ExitError)) { return cmd.ProcessState.ExitCode(), string(out), nil } else if err != nil { return 1, "", fmt.Errorf("exec.Command(%s) failed: %w: %s", command, err, string(out)) </s> remove // TODO(a.garipov): github.com/kardianos/service doesn't seem to // support OpenBSD currently. Either patch it to do so or make // our own implementation of the service.System interface. if runtime.GOOS == "openbsd" { log.Fatal("service actions are not supported on openbsd, see issue 3226") } </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
// svcStatus returns the service's status.
<mask> Context.appSignalChannel <- syscall.SIGINT <mask> return nil <mask> } <mask> <mask> // svcStatus check the service's status. <mask> // <mask> // On OpenWrt, the service utility may not exist. We use our service script <mask> // directly in this case. <mask> func svcStatus(s service.Service) (status service.Status, err error) { <mask> status, err = s.Status() </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // Stop stops the program func (p *program) Stop(s service.Service) error { // Stop should not block. Return with a few seconds. </s> add // Stop implements service.Interface interface for *program. func (p *program) Stop(_ service.Service) error { // Stop should not block. Return with a few seconds. </s> remove // On OpenWrt it is important to run enable after the service installation // Otherwise, the service won't start on the system startup </s> add // On OpenWrt it is important to run enable after the service // installation Otherwise, the service won't start on the system // startup. </s> remove // Start should quickly start the program func (p *program) Start(s service.Service) error { // Start should not block. Do the actual work async. </s> add // Start implements service.Interface interface for *program. func (p *program) Start(_ service.Service) (err error) { // Start should not block. Do the actual work async. </s> remove // handleServiceStatusCommand handles service "status" command </s> add // handleServiceStatusCommand handles service "status" command. </s> remove // Send SIGHUP to a process with ID taken from our pid-file // If pid-file doesn't exist, find our PID using 'ps' command </s> add // Send SIGHUP to a process with PID taken from our .pid file. If it doesn't // exist, find our PID using 'ps' command.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
// Send SIGHUP to a process with PID taken from our .pid file. If it doesn't // exist, find our PID using 'ps' command.
<mask> <mask> return err <mask> } <mask> <mask> // Send SIGHUP to a process with ID taken from our pid-file <mask> // If pid-file doesn't exist, find our PID using 'ps' command <mask> func sendSigReload() { <mask> if runtime.GOOS == "windows" { <mask> log.Error("not implemented on windows") <mask> <mask> return </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // TODO(a.garipov): github.com/kardianos/service doesn't seem to // support OpenBSD currently. Either patch it to do so or make // our own implementation of the service.System interface. if runtime.GOOS == "openbsd" { log.Fatal("service actions are not supported on openbsd, see issue 3226") } </s> add </s> remove // Stop stops the program func (p *program) Stop(s service.Service) error { // Stop should not block. Return with a few seconds. </s> add // Stop implements service.Interface interface for *program. func (p *program) Stop(_ service.Service) error { // Stop should not block. Return with a few seconds. </s> remove // svcStatus check the service's status. </s> add // svcStatus returns the service's status. </s> remove err := svcAction(s, "uninstall") if err != nil { </s> add if err := svcAction(s, "uninstall"); err != nil {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
// Call chooseSystem expicitly to introduce OpenBSD support for service // package. It's a noop for other GOOS values. chooseSystem()
<mask> // it is specified when we register a service, and it indicates to the app <mask> // that it is being run as a service/daemon. <mask> func handleServiceControlAction(opts options, clientBuildFS fs.FS) { <mask> action := opts.serviceControlAction <mask> log.Printf("Service control action: %s", action) <mask> <mask> if action == "reload" { </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // On OpenWrt it is important to run enable after the service installation // Otherwise, the service won't start on the system startup </s> add // On OpenWrt it is important to run enable after the service // installation Otherwise, the service won't start on the system // startup. </s> remove // Represents the program that will be launched by a service or daemon </s> add // program represents the program that will be launched by as a service or a // daemon. </s> remove // Send SIGHUP to a process with ID taken from our pid-file // If pid-file doesn't exist, find our PID using 'ps' command </s> add // Send SIGHUP to a process with PID taken from our .pid file. If it doesn't // exist, find our PID using 'ps' command. </s> remove // TODO(a.garipov): github.com/kardianos/service doesn't seem to // support OpenBSD currently. Either patch it to do so or make // our own implementation of the service.System interface. if runtime.GOOS == "openbsd" { log.Fatal("service actions are not supported on openbsd, see issue 3226") } </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
var s service.Service if s, err = service.New(prg, svcConfig); err != nil {
<mask> prg := &program{ <mask> clientBuildFS: clientBuildFS, <mask> opts: runOpts, <mask> } <mask> s, err := service.New(prg, svcConfig) <mask> if err != nil { <mask> log.Fatal(err) <mask> } <mask> <mask> if action == "status" { <mask> handleServiceStatusCommand(s) </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove if action == "status" { </s> add switch action { case "status": </s> remove } else if action == "run" { err = s.Run() if err != nil { </s> add case "run": if err = s.Run(); err != nil { </s> remove err := svcAction(s, "uninstall") if err != nil { </s> add if err := svcAction(s, "uninstall"); err != nil { </s> remove } else if action == "uninstall" { </s> add case "uninstall": </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
switch action { case "status":
<mask> if err != nil { <mask> log.Fatal(err) <mask> } <mask> <mask> if action == "status" { <mask> handleServiceStatusCommand(s) <mask> } else if action == "run" { <mask> err = s.Run() <mask> if err != nil { <mask> log.Fatalf("Failed to run service: %s", err) </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove } else if action == "run" { err = s.Run() if err != nil { </s> add case "run": if err = s.Run(); err != nil { </s> remove } else if action == "install" { </s> add case "install": </s> remove s, err := service.New(prg, svcConfig) if err != nil { </s> add var s service.Service if s, err = service.New(prg, svcConfig); err != nil { </s> remove } else if action == "uninstall" { </s> add case "uninstall": </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
case "run": if err = s.Run(); err != nil {
<mask> } <mask> <mask> if action == "status" { <mask> handleServiceStatusCommand(s) <mask> } else if action == "run" { <mask> err = s.Run() <mask> if err != nil { <mask> log.Fatalf("Failed to run service: %s", err) <mask> } <mask> } else if action == "install" { <mask> initConfigFilename(opts) <mask> initWorkingDir(opts) </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove } else if action == "install" { </s> add case "install": </s> remove if action == "status" { </s> add switch action { case "status": </s> remove } else if action == "uninstall" { </s> add case "uninstall": </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil { </s> remove s, err := service.New(prg, svcConfig) if err != nil { </s> add var s service.Service if s, err = service.New(prg, svcConfig); err != nil {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
case "install":
<mask> err = s.Run() <mask> if err != nil { <mask> log.Fatalf("Failed to run service: %s", err) <mask> } <mask> } else if action == "install" { <mask> initConfigFilename(opts) <mask> initWorkingDir(opts) <mask> handleServiceInstallCommand(s) <mask> } else if action == "uninstall" { <mask> handleServiceUninstallCommand(s) </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove } else if action == "run" { err = s.Run() if err != nil { </s> add case "run": if err = s.Run(); err != nil { </s> remove } else if action == "uninstall" { </s> add case "uninstall": </s> remove if action == "status" { </s> add switch action { case "status": </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil { </s> remove // Start automatically after install </s> add // Start automatically after install.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
case "uninstall":
<mask> } else if action == "install" { <mask> initConfigFilename(opts) <mask> initWorkingDir(opts) <mask> handleServiceInstallCommand(s) <mask> } else if action == "uninstall" { <mask> handleServiceUninstallCommand(s) <mask> } else { <mask> err = svcAction(s, action) <mask> if err != nil { <mask> log.Fatal(err) </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove } else if action == "install" { </s> add case "install": </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil { </s> remove } else if action == "run" { err = s.Run() if err != nil { </s> add case "run": if err = s.Run(); err != nil { </s> remove if action == "status" { </s> add switch action { case "status": </s> remove err := svcAction(s, "uninstall") if err != nil { </s> add if err := svcAction(s, "uninstall"); err != nil {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
default: if err = svcAction(s, action); err != nil {
<mask> initWorkingDir(opts) <mask> handleServiceInstallCommand(s) <mask> } else if action == "uninstall" { <mask> handleServiceUninstallCommand(s) <mask> } else { <mask> err = svcAction(s, action) <mask> if err != nil { <mask> log.Fatal(err) <mask> } <mask> } <mask> <mask> log.Printf("Action %s has been done successfully on %s", action, service.ChosenSystem().String()) </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove } else if action == "uninstall" { </s> add case "uninstall": </s> remove log.Printf("Action %s has been done successfully on %s", action, service.ChosenSystem().String()) </s> add log.Printf("action %s has been done successfully on %s", action, service.ChosenSystem()) </s> remove } else if action == "install" { </s> add case "install": </s> remove // handleServiceStatusCommand handles service "status" command </s> add // handleServiceStatusCommand handles service "status" command. </s> remove } else if action == "run" { err = s.Run() if err != nil { </s> add case "run": if err = s.Run(); err != nil {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
log.Printf("action %s has been done successfully on %s", action, service.ChosenSystem())
<mask> log.Fatal(err) <mask> } <mask> } <mask> <mask> log.Printf("Action %s has been done successfully on %s", action, service.ChosenSystem().String()) <mask> } <mask> <mask> // handleServiceStatusCommand handles service "status" command <mask> func handleServiceStatusCommand(s service.Service) { <mask> status, errSt := svcStatus(s) </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // handleServiceStatusCommand handles service "status" command </s> add // handleServiceStatusCommand handles service "status" command. </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil { </s> remove // Start automatically after install </s> add // Start automatically after install. </s> remove // svcStatus check the service's status. </s> add // svcStatus returns the service's status.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
// handleServiceStatusCommand handles service "status" command.
<mask> <mask> log.Printf("Action %s has been done successfully on %s", action, service.ChosenSystem().String()) <mask> } <mask> <mask> // handleServiceStatusCommand handles service "status" command <mask> func handleServiceStatusCommand(s service.Service) { <mask> status, errSt := svcStatus(s) <mask> if errSt != nil { <mask> log.Fatalf("failed to get service status: %s", errSt) <mask> } </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove log.Printf("Action %s has been done successfully on %s", action, service.ChosenSystem().String()) </s> add log.Printf("action %s has been done successfully on %s", action, service.ChosenSystem()) </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil { </s> remove // Start automatically after install </s> add // Start automatically after install. </s> remove // On OpenWrt it is important to run enable after the service installation // Otherwise, the service won't start on the system startup </s> add // On OpenWrt it is important to run enable after the service // installation Otherwise, the service won't start on the system // startup. </s> remove // svcStatus check the service's status. </s> add // svcStatus returns the service's status.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
// On OpenWrt it is important to run enable after the service // installation Otherwise, the service won't start on the system // startup.
<mask> log.Fatal(err) <mask> } <mask> <mask> if aghos.IsOpenWrt() { <mask> // On OpenWrt it is important to run enable after the service installation <mask> // Otherwise, the service won't start on the system startup <mask> _, err = runInitdCommand("enable") <mask> if err != nil { <mask> log.Fatal(err) <mask> } <mask> } </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // Start automatically after install </s> add // Start automatically after install. </s> remove err := svcAction(s, "uninstall") if err != nil { </s> add if err := svcAction(s, "uninstall"); err != nil { </s> remove if action == "status" { </s> add switch action { case "status": </s> remove // svcStatus check the service's status. </s> add // svcStatus returns the service's status. </s> remove } else if action == "run" { err = s.Run() if err != nil { </s> add case "run": if err = s.Run(); err != nil {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
// Start automatically after install.
<mask> log.Fatal(err) <mask> } <mask> } <mask> <mask> // Start automatically after install <mask> err = svcAction(s, "start") <mask> if err != nil { <mask> log.Fatalf("Failed to start the service: %s", err) <mask> } <mask> log.Printf("Service has been started") </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil { </s> remove // On OpenWrt it is important to run enable after the service installation // Otherwise, the service won't start on the system startup </s> add // On OpenWrt it is important to run enable after the service // installation Otherwise, the service won't start on the system // startup. </s> remove if action == "status" { </s> add switch action { case "status": </s> remove } else if action == "run" { err = s.Run() if err != nil { </s> add case "run": if err = s.Run(); err != nil { </s> remove } else if action == "install" { </s> add case "install":
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
if err := svcAction(s, "uninstall"); err != nil {
<mask> log.Fatal(err) <mask> } <mask> } <mask> <mask> err := svcAction(s, "uninstall") <mask> if err != nil { <mask> log.Fatal(err) <mask> } <mask> <mask> if runtime.GOOS == "darwin" { <mask> // Remove log files on cleanup and log errors. </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove err = os.Remove(launchdStdoutPath) </s> add err := os.Remove(launchdStdoutPath) </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil { </s> remove } else if action == "uninstall" { </s> add case "uninstall": </s> remove s, err := service.New(prg, svcConfig) if err != nil { </s> add var s service.Service if s, err = service.New(prg, svcConfig); err != nil { </s> remove if action == "status" { </s> add switch action { case "status":
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
err := os.Remove(launchdStdoutPath)
<mask> } <mask> <mask> if runtime.GOOS == "darwin" { <mask> // Remove log files on cleanup and log errors. <mask> err = os.Remove(launchdStdoutPath) <mask> if err != nil && !errors.Is(err, os.ErrNotExist) { <mask> log.Printf("removing stdout file: %s", err) <mask> } <mask> <mask> err = os.Remove(launchdStderrPath) </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove err := svcAction(s, "uninstall") if err != nil { </s> add if err := svcAction(s, "uninstall"); err != nil { </s> remove } else if action == "run" { err = s.Run() if err != nil { </s> add case "run": if err = s.Run(); err != nil { </s> remove if action == "status" { </s> add switch action { case "status": </s> remove } else { err = svcAction(s, action) if err != nil { </s> add default: if err = svcAction(s, action); err != nil { </s> remove } else if action == "install" { </s> add case "install":
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
c.Option["RunComScript"] = openBSDScript c.Option["SvcInfo"] = fmt.Sprintf("%s %s", version.Full(), time.Now())
<mask> } else if runtime.GOOS == "freebsd" { <mask> c.Option["SysvScript"] = freeBSDScript <mask> } <mask> } <mask> <mask> // runInitdCommand runs init.d service command <mask> // returns command code or error if any </s> Pull request: 3226 support service on OpenBSD Merge in DNS/adguard-home from 3226-openbsd-svc to master Closes #3226. Squashed commit of the following: commit bcf1a31a8343ae4b35c7cadeb45bc7a10863fda2 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:43:31 2021 +0300 aghos: imp code commit 3d4060ce6b5a37cf7af05b117b8bc4a49f69b2e8 Merge: 9e9225ec b92db25e Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:09:00 2021 +0300 Merge branch 'master' into 3226-openbsd-svc commit 9e9225ecb2af30fe46999b43c0683e4b3c946778 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 17:02:52 2021 +0300 home: fix lil bugs commit 03456f9a09081c6178dca0ac9887590b5d24f333 Author: Eugene Burkov <[email protected]> Date: Tue Aug 24 16:18:48 2021 +0300 home: imp code commit 5cdf4fcbae78c07b663190012228003fe94bfdee Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 23:32:15 2021 +0300 home: imp code, docs commit d2a95faa0a7d176cdcba304e7226ebe11c1ce341 Author: Eugene Burkov <[email protected]> Date: Fri Aug 20 14:01:53 2021 +0300 home: sup service on openbsd </s> remove // handleServiceStatusCommand handles service "status" command </s> add // handleServiceStatusCommand handles service "status" command. </s> remove // TODO(a.garipov): github.com/kardianos/service doesn't seem to // support OpenBSD currently. Either patch it to do so or make // our own implementation of the service.System interface. if runtime.GOOS == "openbsd" { log.Fatal("service actions are not supported on openbsd, see issue 3226") } </s> add </s> remove } else if action == "run" { err = s.Run() if err != nil { </s> add case "run": if err = s.Run(); err != nil { </s> remove } else if action == "uninstall" { </s> add case "uninstall": </s> remove err := svcAction(s, "uninstall") if err != nil { </s> add if err := svcAction(s, "uninstall"); err != nil {
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/16092e8ba9f2064f9e92374c77a804271741a051
internal/home/service.go
// TODO(a.garipov): Write a case-agnostic version of strings.HasSuffix // and use it in matchDomainWildcard instead of using strings.ToLower // everywhere. r.Domain = strings.ToLower(r.Domain)
<mask> <mask> // prepare prepares the a new or decoded entry. <mask> func (r *RewriteEntry) prepare() { <mask> switch r.Answer { <mask> case "AAAA": <mask> r.IP = nil <mask> r.Type = dns.TypeAAAA <mask> </s> Pull request: filtering: fix legacy rewrite domain case Updates #3351. Squashed commit of the following: commit cc1c72cc13026ed703bb140e55dc3eb886846e48 Author: Ainar Garipov <[email protected]> Date: Tue Jul 13 17:23:33 2021 +0300 filtering: fix legacy rewrite domain case </s> remove assert.Equal(t, Rewritten, r.Reason) </s> add assert.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason) </s> remove require.Equal(t, Rewritten, r.Reason) </s> add require.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason)
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/167447547aa52cfa01b48680d13aff73ba64fb42
internal/filtering/rewrites.go
}, { Domain: "BIGHOST.COM", Answer: "1.2.3.7",
<mask> Answer: "1.2.3.6", <mask> }, { <mask> Domain: "*.hostboth.com", <mask> Answer: "1234::5678", <mask> }} <mask> d.prepareRewrites() <mask> <mask> testCases := []struct { <mask> name string <mask> host string </s> Pull request: filtering: fix legacy rewrite domain case Updates #3351. Squashed commit of the following: commit cc1c72cc13026ed703bb140e55dc3eb886846e48 Author: Ainar Garipov <[email protected]> Date: Tue Jul 13 17:23:33 2021 +0300 filtering: fix legacy rewrite domain case </s> remove assert.Equal(t, Rewritten, r.Reason) </s> add assert.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason) </s> remove require.Equal(t, Rewritten, r.Reason) </s> add require.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason)
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/167447547aa52cfa01b48680d13aff73ba64fb42
internal/filtering/rewrites_test.go
}, { name: "issue3351", host: "bighost.com", wantCName: "", wantVals: []net.IP{{1, 2, 3, 7}}, dtyp: dns.TypeA,
<mask> wantVals: []net.IP{net.ParseIP("1234::5678")}, <mask> dtyp: dns.TypeAAAA, <mask> }} <mask> <mask> for _, tc := range testCases { <mask> t.Run(tc.name, func(t *testing.T) { <mask> valsNum := len(tc.wantVals) <mask> </s> Pull request: filtering: fix legacy rewrite domain case Updates #3351. Squashed commit of the following: commit cc1c72cc13026ed703bb140e55dc3eb886846e48 Author: Ainar Garipov <[email protected]> Date: Tue Jul 13 17:23:33 2021 +0300 filtering: fix legacy rewrite domain case </s> remove assert.Equal(t, Rewritten, r.Reason) </s> add assert.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason) </s> remove require.Equal(t, Rewritten, r.Reason) </s> add require.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason)
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/167447547aa52cfa01b48680d13aff73ba64fb42
internal/filtering/rewrites_test.go
require.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason)
<mask> <mask> return <mask> } <mask> <mask> require.Equal(t, Rewritten, r.Reason) <mask> if tc.wantCName != "" { <mask> assert.Equal(t, tc.wantCName, r.CanonName) <mask> } <mask> <mask> require.Len(t, r.IPList, valsNum) </s> Pull request: filtering: fix legacy rewrite domain case Updates #3351. Squashed commit of the following: commit cc1c72cc13026ed703bb140e55dc3eb886846e48 Author: Ainar Garipov <[email protected]> Date: Tue Jul 13 17:23:33 2021 +0300 filtering: fix legacy rewrite domain case </s> remove assert.Equal(t, Rewritten, r.Reason) </s> add assert.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/167447547aa52cfa01b48680d13aff73ba64fb42
internal/filtering/rewrites_test.go
assert.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason)
<mask> <mask> return <mask> } <mask> <mask> assert.Equal(t, Rewritten, r.Reason) <mask> <mask> require.Len(t, r.IPList, len(tc.want)) <mask> <mask> for _, ip := range tc.want { <mask> assert.True(t, ip.Equal(r.IPList[0])) </s> Pull request: filtering: fix legacy rewrite domain case Updates #3351. Squashed commit of the following: commit cc1c72cc13026ed703bb140e55dc3eb886846e48 Author: Ainar Garipov <[email protected]> Date: Tue Jul 13 17:23:33 2021 +0300 filtering: fix legacy rewrite domain case </s> remove require.Equal(t, Rewritten, r.Reason) </s> add require.Equalf(t, Rewritten, r.Reason, "got %s", r.Reason)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/167447547aa52cfa01b48680d13aff73ba64fb42
internal/filtering/rewrites_test.go
github.com/AdguardTeam/golibs v0.9.3
<mask> go 1.16 <mask> <mask> require ( <mask> github.com/AdguardTeam/dnsproxy v0.39.5 <mask> github.com/AdguardTeam/golibs v0.9.2 <mask> github.com/AdguardTeam/urlfilter v0.14.6 <mask> github.com/NYTimes/gziphandler v1.1.1 <mask> github.com/ameshkov/dnscrypt/v2 v2.2.2 <mask> github.com/digineo/go-ipset/v2 v2.2.1 <mask> github.com/fsnotify/fsnotify v1.4.9 </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove github.com/AdguardTeam/golibs v0.9.2 h1:H3BDFkaosxvb+UgFlNVyN66GZ+JglcZULnJ7z7PukyQ= </s> add </s> remove // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"`
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
go.mod
<mask> github.com/AdguardTeam/dnsproxy v0.39.5 h1:SQorhRLR1241t6hy9CiAGZUjRULhsDJlPJTl0UGX8uw= <mask> github.com/AdguardTeam/dnsproxy v0.39.5/go.mod h1:eDpJKAdkHORRwAedjuERv+7SWlcz4cn+5uwrbUAWHRY= <mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/AdguardTeam/golibs v0.9.2 h1:H3BDFkaosxvb+UgFlNVyN66GZ+JglcZULnJ7z7PukyQ= <mask> github.com/AdguardTeam/golibs v0.9.2/go.mod h1:fCAMwPBJ8S7YMYbTWvYS+eeTLblP5E04IDtNAo7y7IY= <mask> github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU= <mask> github.com/AdguardTeam/urlfilter v0.14.6 h1:emqoKZElooHACYehRBYENeKVN1a/rspxiqTIMYLuoIo= <mask> github.com/AdguardTeam/urlfilter v0.14.6/go.mod h1:klx4JbOfc4EaNb5lWLqOwfg+pVcyRukmoJRvO55lL5U= <mask> github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove github.com/AdguardTeam/golibs v0.9.2 </s> add github.com/AdguardTeam/golibs v0.9.3 </s> remove // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"` </s> remove Port: 53, </s> add Port: defaultPortDNS, </s> remove PortHTTPS: 443, PortDNSOverTLS: 853, // needs to be passed through to dnsproxy PortDNSOverQUIC: 784, </s> add PortHTTPS: defaultPortHTTPS, PortDNSOverTLS: defaultPortTLS, // needs to be passed through to dnsproxy PortDNSOverQUIC: defaultPortQUIC,
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
go.sum
github.com/AdguardTeam/golibs v0.9.3 h1:noeKHJEzrSwxzX0Zi3USM3cXf1qQV99SO772jet/uEY= github.com/AdguardTeam/golibs v0.9.3/go.mod h1:fCAMwPBJ8S7YMYbTWvYS+eeTLblP5E04IDtNAo7y7IY=
<mask> github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/AdguardTeam/golibs v0.9.2/go.mod h1:fCAMwPBJ8S7YMYbTWvYS+eeTLblP5E04IDtNAo7y7IY= <mask> github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU= <mask> github.com/AdguardTeam/urlfilter v0.14.6 h1:emqoKZElooHACYehRBYENeKVN1a/rspxiqTIMYLuoIo= <mask> github.com/AdguardTeam/urlfilter v0.14.6/go.mod h1:klx4JbOfc4EaNb5lWLqOwfg+pVcyRukmoJRvO55lL5U= <mask> github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= <mask> github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= <mask> github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove github.com/AdguardTeam/golibs v0.9.2 h1:H3BDFkaosxvb+UgFlNVyN66GZ+JglcZULnJ7z7PukyQ= </s> add </s> remove github.com/AdguardTeam/golibs v0.9.2 </s> add github.com/AdguardTeam/golibs v0.9.3 </s> remove // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"` </s> remove Port: 53, </s> add Port: defaultPortDNS, </s> remove PortHTTPS: 443, PortDNSOverTLS: 853, // needs to be passed through to dnsproxy PortDNSOverQUIC: 784, </s> add PortHTTPS: defaultPortHTTPS, PortDNSOverTLS: defaultPortTLS, // needs to be passed through to dnsproxy PortDNSOverQUIC: defaultPortQUIC,
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
go.sum
Port: defaultPortDNS,
<mask> AuthAttempts: 5, <mask> AuthBlockMin: 15, <mask> DNS: dnsConfig{ <mask> BindHosts: []net.IP{{0, 0, 0, 0}}, <mask> Port: 53, <mask> StatsInterval: 1, <mask> FilteringConfig: dnsforward.FilteringConfig{ <mask> ProtectionEnabled: true, // whether or not use any of filtering features <mask> BlockingMode: "default", // mode how to answer filtered requests <mask> BlockedResponseTTL: 10, // in seconds </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS, </s> remove PortHTTPS: 443, PortDNSOverTLS: 853, // needs to be passed through to dnsproxy PortDNSOverQUIC: 784, </s> add PortHTTPS: defaultPortHTTPS, PortDNSOverTLS: defaultPortTLS, // needs to be passed through to dnsproxy PortDNSOverQUIC: defaultPortQUIC, </s> remove // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"`
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/config.go
PortHTTPS: defaultPortHTTPS, PortDNSOverTLS: defaultPortTLS, // needs to be passed through to dnsproxy PortDNSOverQUIC: defaultPortQUIC,
<mask> ResolveClients: true, <mask> UsePrivateRDNS: true, <mask> }, <mask> TLS: tlsConfigSettings{ <mask> PortHTTPS: 443, <mask> PortDNSOverTLS: 853, // needs to be passed through to dnsproxy <mask> PortDNSOverQUIC: 784, <mask> }, <mask> logSettings: logSettings{ <mask> LogCompress: false, <mask> LogLocalTime: false, <mask> LogMaxBackups: 0, </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove Port: 53, </s> add Port: defaultPortDNS, </s> remove const defaultHTTPSPort = 443 </s> add </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS, </s> remove // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"`
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/config.go
if config.DNS.Port != defaultPortDNS {
<mask> // addresses to a slice of strings. <mask> func appendDNSAddrs(dst []string, addrs ...net.IP) (res []string) { <mask> for _, addr := range addrs { <mask> var hostport string <mask> if config.DNS.Port != 53 { <mask> hostport = netutil.JoinHostPort(addr.String(), config.DNS.Port) <mask> } else { <mask> hostport = addr.String() <mask> } <mask> </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> add </s> remove if tlsConf.PortHTTPS != 443 { </s> add if tlsConf.PortHTTPS != defaultPortHTTPS { </s> remove // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. var testBootstrapDNS = []string{ "94.140.14.14", "94.140.15.15", } // setupBootstraps is a helper that sets up the bootstrap plain DNS server // configuration for tests and also tears it down in a cleanup function. func setupBootstraps(t testing.TB) { </s> add // setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) { </s> remove // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"` </s> remove if port := web.conf.PortHTTPS; port != defaultHTTPSPort { </s> add if port := web.conf.PortHTTPS; port != defaultPortHTTPS {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/control.go
<mask> func preInstallHandler(handler http.Handler) http.Handler { <mask> return &preInstallHandlerStruct{handler} <mask> } <mask> <mask> const defaultHTTPSPort = 443 <mask> <mask> // handleHTTPSRedirect redirects the request to HTTPS, if needed. If ok is <mask> // true, the middleware must continue handling the request. <mask> func handleHTTPSRedirect(w http.ResponseWriter, r *http.Request) (ok bool) { <mask> web := Context.web <mask> if web.httpsServer.server == nil { </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> add </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove if port := web.conf.PortHTTPS; port != defaultHTTPSPort { </s> add if port := web.conf.PortHTTPS; port != defaultPortHTTPS {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/control.go
if port := web.conf.PortHTTPS; port != defaultPortHTTPS {
<mask> } <mask> <mask> if r.TLS == nil && web.forceHTTPS { <mask> hostPort := host <mask> if port := web.conf.PortHTTPS; port != defaultHTTPSPort { <mask> hostPort = netutil.JoinHostPort(host, port) <mask> } <mask> <mask> httpsURL := &url.URL{ <mask> Scheme: schemeHTTPS, </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove if tlsConf.PortHTTPS != 443 { </s> add if tlsConf.PortHTTPS != defaultPortHTTPS { </s> remove const defaultHTTPSPort = 443 </s> add </s> remove ServerAddresses: cloneBootstrap(), </s> add ServerAddresses: dnsIPs, </s> remove if config.DNS.Port != 53 { </s> add if config.DNS.Port != defaultPortDNS {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/control.go
data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS
<mask> <mask> // handleInstallGetAddresses is the handler for /install/get_addresses endpoint. <mask> func (web *Web) handleInstallGetAddresses(w http.ResponseWriter, r *http.Request) { <mask> data := getAddrsResponse{} <mask> data.WebPort = 80 <mask> data.DNSPort = 53 <mask> <mask> ifaces, err := aghnet.GetValidNetInterfacesForWeb() <mask> if err != nil { <mask> httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) <mask> return </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove const defaultHTTPSPort = 443 </s> add </s> remove ServerAddresses: cloneBootstrap(), </s> add ServerAddresses: dnsIPs, </s> remove // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/controlinstall.go
data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS
<mask> // TODO(e.burkov): This should removed with the API v1 when the appropriate <mask> // functionality will appear in default handleInstallGetAddresses. <mask> func (web *Web) handleInstallGetAddressesBeta(w http.ResponseWriter, r *http.Request) { <mask> data := getAddrsResponseBeta{} <mask> data.WebPort = 80 <mask> data.DNSPort = 53 <mask> <mask> ifaces, err := aghnet.GetValidNetInterfacesForWeb() <mask> if err != nil { <mask> httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) <mask> return </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove const defaultHTTPSPort = 443 </s> add </s> remove // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> add </s> remove ServerAddresses: cloneBootstrap(), </s> add ServerAddresses: dnsIPs,
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/controlinstall.go
// Default ports. const ( defaultPortDNS = 53 defaultPortHTTP = 80 defaultPortHTTPS = 443 defaultPortQUIC = 784 defaultPortTLS = 853 )
<mask> yaml "gopkg.in/yaml.v2" <mask> ) <mask> <mask> // Called by other modules when configuration is changed <mask> func onConfigModified() { <mask> _ = config.write() <mask> } <mask> </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. var testBootstrapDNS = []string{ "94.140.14.14", "94.140.15.15", } // setupBootstraps is a helper that sets up the bootstrap plain DNS server // configuration for tests and also tears it down in a cleanup function. func setupBootstraps(t testing.TB) { </s> add // setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) { </s> remove // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> add </s> remove "github.com/AdguardTeam/golibs/stringutil" </s> add </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/dns.go
if tlsConf.PortHTTPS != defaultPortHTTPS {
<mask> if tlsConf.Enabled && len(tlsConf.ServerName) != 0 { <mask> hostname := tlsConf.ServerName <mask> if tlsConf.PortHTTPS != 0 { <mask> addr := hostname <mask> if tlsConf.PortHTTPS != 443 { <mask> addr = netutil.JoinHostPort(addr, tlsConf.PortHTTPS) <mask> } <mask> <mask> de.https = (&url.URL{ <mask> Scheme: "https", </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove if port := web.conf.PortHTTPS; port != defaultHTTPSPort { </s> add if port := web.conf.PortHTTPS; port != defaultPortHTTPS { </s> remove if config.DNS.Port != 53 { </s> add if config.DNS.Port != defaultPortDNS { </s> remove ServerAddresses: cloneBootstrap(), </s> add ServerAddresses: dnsIPs, </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove const defaultHTTPSPort = 443 </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/dns.go
"net"
<mask> <mask> import ( <mask> "encoding/json" <mask> "fmt" <mask> "net/http" <mask> "net/url" <mask> "path" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" <mask> "github.com/AdguardTeam/golibs/errors" </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" </s> add "github.com/AdguardTeam/golibs/netutil" </s> remove "github.com/AdguardTeam/golibs/stringutil" </s> add </s> remove github.com/AdguardTeam/golibs v0.9.2 </s> add github.com/AdguardTeam/golibs v0.9.3
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig.go
<mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/stringutil" <mask> uuid "github.com/satori/go.uuid" <mask> "howett.net/plist" <mask> ) <mask> <mask> // dnsSettings is the DNSSetting.DNSSettings mobileconfig profile. </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" </s> add "github.com/AdguardTeam/golibs/netutil" </s> remove // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. var testBootstrapDNS = []string{ "94.140.14.14", "94.140.15.15", } // setupBootstraps is a helper that sets up the bootstrap plain DNS server // configuration for tests and also tears it down in a cleanup function. func setupBootstraps(t testing.TB) { </s> add // setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) { </s> remove // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"`
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig.go
// ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"`
<mask> // ServerName is the hostname of the DoT server. It must be empty if <mask> // DNSProtocol is not "TLS". <mask> ServerName string `plist:",omitempty"` <mask> <mask> // ServerAddresses is a list of plain DNS server IP addresses used to <mask> // resolve the hostname in ServerURL or ServerName. <mask> ServerAddresses []string `plist:",omitempty"` <mask> } <mask> <mask> // payloadContent is a Device Management Profile payload. <mask> // <mask> // See https://developer.apple.com/documentation/devicemanagement/configuring_multiple_devices_using_profiles#3234127. </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. var testBootstrapDNS = []string{ "94.140.14.14", "94.140.15.15", } // setupBootstraps is a helper that sets up the bootstrap plain DNS server // configuration for tests and also tears it down in a cleanup function. func setupBootstraps(t testing.TB) { </s> add // setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) { </s> remove const defaultHTTPSPort = 443 </s> add </s> remove if config.DNS.Port != 53 { </s> add if config.DNS.Port != defaultPortDNS { </s> remove Port: 53, </s> add Port: defaultPortDNS,
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig.go
dnsIPs, err := collectDNSIPs() if err != nil { // Don't add a lot of formatting, since the error is already // wrapped by collectDNSIPs. respondJSONError(w, http.StatusInternalServerError, err.Error()) return }
<mask> return <mask> } <mask> } <mask> <mask> d := &dnsSettings{ <mask> DNSProtocol: dnsp, <mask> ServerName: host, <mask> ServerAddresses: dnsIPs, <mask> } <mask> </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove ServerAddresses: cloneBootstrap(), </s> add ServerAddresses: dnsIPs, </s> remove // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> add </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> remove if port := web.conf.PortHTTPS; port != defaultHTTPSPort { </s> add if port := web.conf.PortHTTPS; port != defaultPortHTTPS {
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig.go
ServerAddresses: dnsIPs,
<mask> <mask> d := &dnsSettings{ <mask> DNSProtocol: dnsp, <mask> ServerName: host, <mask> ServerAddresses: cloneBootstrap(), <mask> } <mask> <mask> mobileconfig, err := encodeMobileConfig(d, clientID) <mask> if err != nil { <mask> respondJSONError(w, http.StatusInternalServerError, err.Error()) </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove if port := web.conf.PortHTTPS; port != defaultHTTPSPort { </s> add if port := web.conf.PortHTTPS; port != defaultPortHTTPS { </s> remove if tlsConf.PortHTTPS != 443 { </s> add if tlsConf.PortHTTPS != defaultPortHTTPS {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig.go
<mask> <mask> _, _ = w.Write(mobileconfig) <mask> } <mask> <mask> // cloneBootstrap returns a clone of the current bootstrap DNS servers. <mask> func cloneBootstrap() (bootstrap []string) { <mask> config.RLock() <mask> defer config.RUnlock() <mask> <mask> return stringutil.CloneSlice(config.DNS.BootstrapDNS) <mask> } <mask> <mask> func handleMobileConfigDoH(w http.ResponseWriter, r *http.Request) { <mask> handleMobileConfig(w, r, dnsProtoHTTPS) <mask> } <mask> <mask> func handleMobileConfigDoT(w http.ResponseWriter, r *http.Request) { </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove const defaultHTTPSPort = 443 </s> add </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove if config.DNS.Port != 53 { </s> add if config.DNS.Port != defaultPortDNS { </s> remove data.WebPort = 80 data.DNSPort = 53 </s> add data.WebPort = defaultPortHTTP data.DNSPort = defaultPortDNS </s> remove // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. var testBootstrapDNS = []string{ "94.140.14.14", "94.140.15.15", } // setupBootstraps is a helper that sets up the bootstrap plain DNS server // configuration for tests and also tears it down in a cleanup function. func setupBootstraps(t testing.TB) { </s> add // setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig.go
"net"
<mask> "bytes" <mask> "encoding/json" <mask> "net/http" <mask> "net/http/httptest" <mask> "testing" <mask> <mask> "github.com/AdguardTeam/golibs/netutil" <mask> "github.com/stretchr/testify/assert" </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" </s> add "github.com/AdguardTeam/golibs/netutil" </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove "github.com/AdguardTeam/golibs/stringutil" </s> add </s> remove github.com/AdguardTeam/golibs v0.9.2 h1:H3BDFkaosxvb+UgFlNVyN66GZ+JglcZULnJ7z7PukyQ= </s> add
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
"github.com/AdguardTeam/golibs/netutil"
<mask> "net/http" <mask> "net/http/httptest" <mask> "testing" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" <mask> "github.com/stretchr/testify/assert" <mask> "github.com/stretchr/testify/require" <mask> "howett.net/plist" <mask> ) <mask> </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove "github.com/AdguardTeam/golibs/stringutil" </s> add </s> remove // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. var testBootstrapDNS = []string{ "94.140.14.14", "94.140.15.15", } // setupBootstraps is a helper that sets up the bootstrap plain DNS server // configuration for tests and also tears it down in a cleanup function. func setupBootstraps(t testing.TB) { </s> add // setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
// setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) {
<mask> "github.com/stretchr/testify/require" <mask> "howett.net/plist" <mask> ) <mask> <mask> // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. <mask> var testBootstrapDNS = []string{ <mask> "94.140.14.14", <mask> "94.140.15.15", <mask> } <mask> <mask> // setupBootstraps is a helper that sets up the bootstrap plain DNS server <mask> // configuration for tests and also tears it down in a cleanup function. <mask> func setupBootstraps(t testing.TB) { <mask> t.Helper() <mask> <mask> prevConfig := config <mask> t.Cleanup(func() { <mask> config = prevConfig </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // ServerAddresses is a list IP addresses of the server. ServerAddresses []net.IP `plist:",omitempty"` </s> remove // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> add </s> remove if config.DNS.Port != 53 { </s> add if config.DNS.Port != defaultPortDNS {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
prevTLS := Context.tls
<mask> func setupDNSIPs(t testing.TB) { <mask> t.Helper() <mask> <mask> prevConfig := config <mask> t.Cleanup(func() { <mask> config = prevConfig <mask> Context.tls = prevTLS <mask> }) <mask> <mask> config = &configuration{ </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS, </s> remove // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. var testBootstrapDNS = []string{ "94.140.14.14", "94.140.15.15", } // setupBootstraps is a helper that sets up the bootstrap plain DNS server // configuration for tests and also tears it down in a cleanup function. func setupBootstraps(t testing.TB) { </s> add // setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) { </s> remove setupBootstraps(t) </s> add setupDNSIPs(t)
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
Context.tls = prevTLS
<mask> t.Cleanup(func() { <mask> config = prevConfig <mask> }) <mask> <mask> config = &configuration{ <mask> DNS: dnsConfig{ <mask> BindHosts: []net.IP{netutil.IPv4Zero()}, <mask> Port: defaultPortDNS, </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS, </s> remove Port: 53, </s> add Port: defaultPortDNS, </s> remove // testBootstrapDNS are the bootstrap plain DNS server addresses for tests. var testBootstrapDNS = []string{ "94.140.14.14", "94.140.15.15", } // setupBootstraps is a helper that sets up the bootstrap plain DNS server // configuration for tests and also tears it down in a cleanup function. func setupBootstraps(t testing.TB) { </s> add // setupDNSIPs is a helper that sets up the server IP address configuration for // tests and also tears it down in a cleanup function. func setupDNSIPs(t testing.TB) {
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS,
<mask> config = prevConfig <mask> }) <mask> config = &configuration{ <mask> DNS: dnsConfig{ <mask> FilteringConfig: dnsforward.FilteringConfig{ <mask> BootstrapDNS: testBootstrapDNS, <mask> }, <mask> }, <mask> } <mask> } <mask> <mask> func TestHandleMobileConfigDoH(t *testing.T) { </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> remove Port: 53, </s> add Port: defaultPortDNS,
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
Context.tls = &TLSMod{}
<mask> BindHosts: []net.IP{netutil.IPv4Zero()}, <mask> Port: defaultPortDNS, <mask> }, <mask> } <mask> } <mask> <mask> func TestHandleMobileConfigDoH(t *testing.T) { <mask> setupDNSIPs(t) <mask> </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS, </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> remove Port: 53, </s> add Port: defaultPortDNS,
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
setupDNSIPs(t)
<mask> } <mask> } <mask> <mask> func TestHandleMobileConfigDoH(t *testing.T) { <mask> setupBootstraps(t) <mask> <mask> t.Run("success", func(t *testing.T) { <mask> r, err := http.NewRequest(http.MethodGet, "https://example.com:12345/apple/doh.mobileconfig?host=example.org", nil) <mask> require.NoError(t, err) <mask> </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS, </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
assert.NotEmpty(t, s.ServerAddresses)
<mask> <mask> s := mc.PayloadContent[0].DNSSettings <mask> require.NotNil(t, s) <mask> <mask> assert.Equal(t, testBootstrapDNS, s.ServerAddresses) <mask> assert.Empty(t, s.ServerName) <mask> assert.Equal(t, "https://example.org/dns-query", s.ServerURL) <mask> }) <mask> <mask> t.Run("error_no_host", func(t *testing.T) { </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> remove setupBootstraps(t) </s> add setupDNSIPs(t)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
assert.NotEmpty(t, s.ServerAddresses)
<mask> <mask> s := mc.PayloadContent[0].DNSSettings <mask> require.NotNil(t, s) <mask> <mask> assert.Equal(t, testBootstrapDNS, s.ServerAddresses) <mask> assert.Empty(t, s.ServerName) <mask> assert.Equal(t, "https://example.org/dns-query/cli42", s.ServerURL) <mask> }) <mask> } <mask> </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS, </s> remove setupBootstraps(t) </s> add setupDNSIPs(t)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
setupDNSIPs(t)
<mask> }) <mask> } <mask> <mask> func TestHandleMobileConfigDoT(t *testing.T) { <mask> setupBootstraps(t) <mask> <mask> t.Run("success", func(t *testing.T) { <mask> r, err := http.NewRequest(http.MethodGet, "https://example.com:12345/apple/dot.mobileconfig?host=example.org", nil) <mask> require.NoError(t, err) <mask> </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS,
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
assert.NotEmpty(t, s.ServerAddresses)
<mask> <mask> s := mc.PayloadContent[0].DNSSettings <mask> require.NotNil(t, s) <mask> <mask> assert.Equal(t, testBootstrapDNS, s.ServerAddresses) <mask> assert.Equal(t, "example.org", s.ServerName) <mask> assert.Empty(t, s.ServerURL) <mask> }) <mask> <mask> t.Run("error_no_host", func(t *testing.T) { </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove setupBootstraps(t) </s> add setupDNSIPs(t) </s> remove setupBootstraps(t) </s> add setupDNSIPs(t)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
assert.NotEmpty(t, s.ServerAddresses)
<mask> <mask> s := mc.PayloadContent[0].DNSSettings <mask> require.NotNil(t, s) <mask> <mask> assert.Equal(t, testBootstrapDNS, s.ServerAddresses) <mask> assert.Equal(t, "cli42.example.org", s.ServerName) <mask> assert.Empty(t, s.ServerURL) <mask> }) <mask> } </s> Pull request: home: provide correct server addrs in mobileconfig Updates #3607. Updates #3568. Squashed commit of the following: commit a02f9788f88b3a9339a0900baa02881a77f1fb9b Author: Ainar Garipov <[email protected]> Date: Fri Sep 17 18:18:31 2021 +0300 home: provide correct server addrs in mobileconfig </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove assert.Equal(t, testBootstrapDNS, s.ServerAddresses) </s> add assert.NotEmpty(t, s.ServerAddresses) </s> remove FilteringConfig: dnsforward.FilteringConfig{ BootstrapDNS: testBootstrapDNS, }, </s> add BindHosts: []net.IP{netutil.IPv4Zero()}, Port: defaultPortDNS, </s> remove setupBootstraps(t) </s> add setupDNSIPs(t)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1714a986e3305450f80acbee61596a1475f1c3b4
internal/home/mobileconfig_test.go
import { normalizeTopStats, secondsToMilliseconds } from '../helpers/helpers';
<mask> import { createAction } from 'redux-actions'; <mask> <mask> import Api from '../api/Api'; <mask> import { addErrorToast, addSuccessToast } from './index'; <mask> import { normalizeTopStats } from '../helpers/helpers'; <mask> <mask> const apiClient = new Api(); <mask> <mask> export const getStatsConfigRequest = createAction('GET_LOGS_CONFIG_REQUEST'); <mask> export const getStatsConfigFailure = createAction('GET_LOGS_CONFIG_FAILURE'); </s> - client: convert average processing time to milliseconds </s> remove {avgProcessingTime ? `${round(avgProcessingTime, 2)} ms` : 0} </s> add {avgProcessingTime ? `${round(avgProcessingTime)} ms` : 0}
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/17a26155cdf0150ea9d8cf915311f16fafa6354a
client/src/actions/stats.js
avg_processing_time: secondsToMilliseconds(stats.avg_processing_time),
<mask> ...stats, <mask> top_blocked_domains: normalizeTopStats(stats.top_blocked_domains), <mask> top_clients: normalizeTopStats(stats.top_clients), <mask> top_queried_domains: normalizeTopStats(stats.top_queried_domains), <mask> }; <mask> <mask> dispatch(getStatsSuccess(normalizedStats)); <mask> } catch (error) { <mask> dispatch(addErrorToast({ error })); </s> - client: convert average processing time to milliseconds </s> remove import { normalizeTopStats } from '../helpers/helpers'; </s> add import { normalizeTopStats, secondsToMilliseconds } from '../helpers/helpers'; </s> remove {avgProcessingTime ? `${round(avgProcessingTime, 2)} ms` : 0} </s> add {avgProcessingTime ? `${round(avgProcessingTime)} ms` : 0}
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/17a26155cdf0150ea9d8cf915311f16fafa6354a
client/src/actions/stats.js
{avgProcessingTime ? `${round(avgProcessingTime)} ms` : 0}
<mask> <Tooltip text={t('average_processing_time_hint')} type={tooltipType} /> <mask> </td> <mask> <td className="text-right"> <mask> <span className="text-muted"> <mask> {avgProcessingTime ? `${round(avgProcessingTime, 2)} ms` : 0} <mask> </span> <mask> </td> <mask> </tr> <mask> </tbody> <mask> </table> </s> - client: convert average processing time to milliseconds </s> remove import { normalizeTopStats } from '../helpers/helpers'; </s> add import { normalizeTopStats, secondsToMilliseconds } from '../helpers/helpers';
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/17a26155cdf0150ea9d8cf915311f16fafa6354a
client/src/components/Dashboard/Counters.js
export const secondsToMilliseconds = (seconds) => { if (seconds) { return seconds * 1000; } return seconds; };
<mask> <mask> export const toggleAllServices = (services, change, isSelected) => { <mask> services.forEach(service => change(`blocked_services.${service.id}`, isSelected)); <mask> }; </s> - client: convert average processing time to milliseconds </s> remove import { normalizeTopStats } from '../helpers/helpers'; </s> add import { normalizeTopStats, secondsToMilliseconds } from '../helpers/helpers'; </s> remove {avgProcessingTime ? `${round(avgProcessingTime, 2)} ms` : 0} </s> add {avgProcessingTime ? `${round(avgProcessingTime)} ms` : 0}
[ "keep", "keep", "keep", "add" ]
https://github.com/AdguardTeam/AdGuardHome/commit/17a26155cdf0150ea9d8cf915311f16fafa6354a
client/src/helpers/helpers.js
if (hasV4Interface && v4.other_server.found === STATUS_RESPONSE.ERROR) {
<mask> <mask> const hasV4Interface = !!interfaces[selectedInterface]?.ipv4_addresses; <mask> const hasV6Interface = !!interfaces[selectedInterface]?.ipv6_addresses; <mask> <mask> if ((hasV4Interface && v4.other_server.found === STATUS_RESPONSE.ERROR) <mask> || (hasV6Interface && v6.other_server.found === STATUS_RESPONSE.ERROR)) { <mask> isError = true; <mask> dispatch(addErrorToast({ error: 'dhcp_error' })); <mask> if (v4.other_server.error) { <mask> dispatch(addErrorToast({ error: v4.other_server.error })); <mask> } </s> Fix DHCP check when there is no V6 interface </s> remove dispatch(addErrorToast({ error: 'dhcp_error' })); </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1806816d9c1a655467e6ed3934beec96a6944d4a
client/src/actions/index.js
<mask> <mask> if ((hasV4Interface && v4.other_server.found === STATUS_RESPONSE.ERROR) <mask> || (hasV6Interface && v6.other_server.found === STATUS_RESPONSE.ERROR)) { <mask> isError = true; <mask> dispatch(addErrorToast({ error: 'dhcp_error' })); <mask> if (v4.other_server.error) { <mask> dispatch(addErrorToast({ error: v4.other_server.error })); <mask> } <mask> if (v6.other_server.error) { <mask> dispatch(addErrorToast({ error: v6.other_server.error })); </s> Fix DHCP check when there is no V6 interface </s> remove if ((hasV4Interface && v4.other_server.found === STATUS_RESPONSE.ERROR) || (hasV6Interface && v6.other_server.found === STATUS_RESPONSE.ERROR)) { </s> add if (hasV4Interface && v4.other_server.found === STATUS_RESPONSE.ERROR) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1806816d9c1a655467e6ed3934beec96a6944d4a
client/src/actions/index.js
} if (hasV6Interface && v6.other_server.found === STATUS_RESPONSE.ERROR) { isError = true;
<mask> if (v4.other_server.error) { <mask> dispatch(addErrorToast({ error: v4.other_server.error })); <mask> } <mask> if (v6.other_server.error) { <mask> dispatch(addErrorToast({ error: v6.other_server.error })); <mask> } <mask> } <mask> <mask> if (hasV4Interface && v4.static_ip.static === STATUS_RESPONSE.ERROR) { </s> Fix DHCP check when there is no V6 interface </s> remove if ((hasV4Interface && v4.other_server.found === STATUS_RESPONSE.ERROR) || (hasV6Interface && v6.other_server.found === STATUS_RESPONSE.ERROR)) { </s> add if (hasV4Interface && v4.other_server.found === STATUS_RESPONSE.ERROR) { </s> remove dispatch(addErrorToast({ error: 'dhcp_error' })); </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1806816d9c1a655467e6ed3934beec96a6944d4a
client/src/actions/index.js
dispatch(addErrorToast({ error: 'dhcp_error' }));
<mask> } <mask> <mask> if (isError) { <mask> return; <mask> } <mask> <mask> if ((hasV4Interface && v4.other_server.found === STATUS_RESPONSE.YES) <mask> || (hasV6Interface && v6.other_server.found === STATUS_RESPONSE.YES)) { </s> Fix DHCP check when there is no V6 interface </s> remove if ((hasV4Interface && v4.other_server.found === STATUS_RESPONSE.ERROR) || (hasV6Interface && v6.other_server.found === STATUS_RESPONSE.ERROR)) { </s> add if (hasV4Interface && v4.other_server.found === STATUS_RESPONSE.ERROR) { </s> remove dispatch(addErrorToast({ error: 'dhcp_error' })); </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1806816d9c1a655467e6ed3934beec96a6944d4a
client/src/actions/index.js
rr := findRewrites(d.Rewrites, host, qtype)
<mask> func (d *DNSFilter) processRewrites(host string, qtype uint16) (res Result) { <mask> d.confLock.RLock() <mask> defer d.confLock.RUnlock() <mask> <mask> rr := findRewrites(d.Rewrites, host) <mask> if len(rr) != 0 { <mask> res.Reason = Rewritten <mask> } <mask> <mask> cnames := aghstrings.NewSet() </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove if (r.Type == dns.TypeA && qtype == dns.TypeA) || (r.Type == dns.TypeAAAA && qtype == dns.TypeAAAA) { </s> add if r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA) { </s> remove rr = findRewrites(d.Rewrites, host) </s> add rr = findRewrites(d.Rewrites, host, qtype) </s> remove if r.Domain != host { if !matchDomainWildcard(host, r.Domain) { continue } </s> add if r.Domain != host && !matchDomainWildcard(host, r.Domain) { continue } // Return CNAMEs for all types requests, but only the // appropriate ones for A and AAAA. if r.Type == dns.TypeCNAME || (r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA)) { rr = append(rr, r) </s> remove rr = append(rr, r) </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/filtering.go
rr = findRewrites(d.Rewrites, host, qtype)
<mask> } <mask> <mask> cnames.Add(host) <mask> res.CanonName = rr[0].Answer <mask> rr = findRewrites(d.Rewrites, host) <mask> } <mask> <mask> for _, r := range rr { <mask> if (r.Type == dns.TypeA && qtype == dns.TypeA) || <mask> (r.Type == dns.TypeAAAA && qtype == dns.TypeAAAA) { </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove if (r.Type == dns.TypeA && qtype == dns.TypeA) || (r.Type == dns.TypeAAAA && qtype == dns.TypeAAAA) { </s> add if r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA) { </s> remove res.Reason = 0 </s> add res.Reason = NotFilteredNotFound </s> remove if r.Domain != host { if !matchDomainWildcard(host, r.Domain) { continue } </s> add if r.Domain != host && !matchDomainWildcard(host, r.Domain) { continue } // Return CNAMEs for all types requests, but only the // appropriate ones for A and AAAA. if r.Type == dns.TypeCNAME || (r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA)) { rr = append(rr, r) </s> remove rr := findRewrites(d.Rewrites, host) </s> add rr := findRewrites(d.Rewrites, host, qtype) </s> remove } else if r.Answer == "A" { </s> add case "A":
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/filtering.go
if r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA) {
<mask> rr = findRewrites(d.Rewrites, host) <mask> } <mask> <mask> for _, r := range rr { <mask> if (r.Type == dns.TypeA && qtype == dns.TypeA) || <mask> (r.Type == dns.TypeAAAA && qtype == dns.TypeAAAA) { <mask> <mask> if r.IP == nil { // IP exception <mask> res.Reason = 0 <mask> return res <mask> } <mask> </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove rr = findRewrites(d.Rewrites, host) </s> add rr = findRewrites(d.Rewrites, host, qtype) </s> remove res.Reason = 0 </s> add res.Reason = NotFilteredNotFound </s> remove if r.Domain != host { if !matchDomainWildcard(host, r.Domain) { continue } </s> add if r.Domain != host && !matchDomainWildcard(host, r.Domain) { continue } // Return CNAMEs for all types requests, but only the // appropriate ones for A and AAAA. if r.Type == dns.TypeCNAME || (r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA)) { rr = append(rr, r) </s> remove rr := findRewrites(d.Rewrites, host) </s> add rr := findRewrites(d.Rewrites, host, qtype) </s> remove } else if r.Answer == "A" { </s> add case "A":
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/filtering.go
res.Reason = NotFilteredNotFound
<mask> if (r.Type == dns.TypeA && qtype == dns.TypeA) || <mask> (r.Type == dns.TypeAAAA && qtype == dns.TypeAAAA) { <mask> <mask> if r.IP == nil { // IP exception <mask> res.Reason = 0 <mask> return res <mask> } <mask> <mask> res.IPList = append(res.IPList, r.IP) <mask> log.Debug("rewrite: A/AAAA for %s is %s", host, r.IP) </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove if (r.Type == dns.TypeA && qtype == dns.TypeA) || (r.Type == dns.TypeAAAA && qtype == dns.TypeAAAA) { </s> add if r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA) { </s> remove rr = findRewrites(d.Rewrites, host) </s> add rr = findRewrites(d.Rewrites, host, qtype) </s> remove if r.Domain != host { if !matchDomainWildcard(host, r.Domain) { continue } </s> add if r.Domain != host && !matchDomainWildcard(host, r.Domain) { continue } // Return CNAMEs for all types requests, but only the // appropriate ones for A and AAAA. if r.Type == dns.TypeCNAME || (r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA)) { rr = append(rr, r) </s> remove } else if r.Answer == "A" { </s> add case "A": </s> remove if r.Answer == "AAAA" { </s> add switch r.Answer { case "AAAA":
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/filtering.go
// Domain is the domain for which this rewrite should work.
<mask> ) <mask> <mask> // RewriteEntry is a rewrite array element <mask> type RewriteEntry struct { <mask> Domain string `yaml:"domain"` <mask> // Answer is the IP address, canonical name, or one of the special <mask> // values: "A" or "AAAA". <mask> Answer string `yaml:"answer"` <mask> // IP is the IP address that should be used in the response if Type is <mask> // A or AAAA. </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove Answer string `yaml:"answer"` // IP address or canonical name Type uint16 `yaml:"-"` // DNS record type: CNAME, A or AAAA IP net.IP `yaml:"-"` // Parsed IP address (if Type is A or AAAA) </s> add // Answer is the IP address, canonical name, or one of the special // values: "A" or "AAAA". Answer string `yaml:"answer"` // IP is the IP address that should be used in the response if Type is // A or AAAA. IP net.IP `yaml:"-"` // Type is the DNS record type: A, AAAA, or CNAME. Type uint16 `yaml:"-"` </s> remove // Get the list of matched rewrite entries. // Priority: CNAME, A/AAAA; exact, wildcard. // If matched exactly, don't return wildcard entries. // If matched by several wildcards, select the more specific one func findRewrites(a []RewriteEntry, host string) []RewriteEntry { rr := rewritesArray{} </s> add // findRewrites returns the list of matched rewrite entries. The priority is: // CNAME, then A and AAAA; exact, then wildcard. If the host is matched // exactly, wildcard entries aren't returned. If the host matched by wildcards, // return the most specific for the question type. func findRewrites(a []RewriteEntry, host string, qtype uint16) []RewriteEntry { rr := rewritesSorted{} </s> remove // Prepare entry for use </s> add // prepare prepares the a new or decoded entry. </s> remove type rewritesArray []RewriteEntry </s> add // rewritesSorted is a slice of legacy rewrites for sorting. // // The sorting priority: // // A and AAAA > CNAME // wildcard > exact // lower level wildcard > higher level wildcard // type rewritesSorted []RewriteEntry </s> remove res.Reason = 0 </s> add res.Reason = NotFilteredNotFound
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites.go
// Answer is the IP address, canonical name, or one of the special // values: "A" or "AAAA". Answer string `yaml:"answer"` // IP is the IP address that should be used in the response if Type is // A or AAAA. IP net.IP `yaml:"-"` // Type is the DNS record type: A, AAAA, or CNAME. Type uint16 `yaml:"-"`
<mask> <mask> // RewriteEntry is a rewrite array element <mask> type RewriteEntry struct { <mask> Domain string `yaml:"domain"` <mask> Answer string `yaml:"answer"` // IP address or canonical name <mask> Type uint16 `yaml:"-"` // DNS record type: CNAME, A or AAAA <mask> IP net.IP `yaml:"-"` // Parsed IP address (if Type is A or AAAA) <mask> } <mask> <mask> func (r *RewriteEntry) equals(b RewriteEntry) bool { <mask> return r.Domain == b.Domain && r.Answer == b.Answer <mask> } </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove // Prepare entry for use </s> add // prepare prepares the a new or decoded entry. </s> remove return len(host) >= 2 && host[0] == '*' && host[1] == '.' </s> add return len(host) > 1 && host[0] == '*' && host[1] == '.' </s> remove type rewritesArray []RewriteEntry </s> add // rewritesSorted is a slice of legacy rewrites for sorting. // // The sorting priority: // // A and AAAA > CNAME // wildcard > exact // lower level wildcard > higher level wildcard // type rewritesSorted []RewriteEntry </s> remove res.Reason = 0 </s> add res.Reason = NotFilteredNotFound
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites.go
return len(host) > 1 && host[0] == '*' && host[1] == '.'
<mask> return r.Domain == b.Domain && r.Answer == b.Answer <mask> } <mask> <mask> func isWildcard(host string) bool { <mask> return len(host) >= 2 && <mask> host[0] == '*' && host[1] == '.' <mask> } <mask> <mask> // Return TRUE of host name matches a wildcard pattern <mask> func matchDomainWildcard(host, wildcard string) bool { <mask> return isWildcard(wildcard) && </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove // Return TRUE of host name matches a wildcard pattern func matchDomainWildcard(host, wildcard string) bool { return isWildcard(wildcard) && strings.HasSuffix(host, wildcard[1:]) </s> add // matchDomainWildcard returns true if host matches the wildcard pattern. func matchDomainWildcard(host, wildcard string) (ok bool) { return isWildcard(wildcard) && strings.HasSuffix(host, wildcard[1:]) </s> remove // Priority: // . CNAME < A/AAAA; // . exact < wildcard; // . higher level wildcard < lower level wildcard func (a rewritesArray) Less(i, j int) bool { </s> add // Less implements the sort.Interface interface for legacyRewritesSorted. func (a rewritesSorted) Less(i, j int) bool { </s> remove if r.Domain != host { if !matchDomainWildcard(host, r.Domain) { continue } </s> add if r.Domain != host && !matchDomainWildcard(host, r.Domain) { continue } // Return CNAMEs for all types requests, but only the // appropriate ones for A and AAAA. if r.Type == dns.TypeCNAME || (r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA)) { rr = append(rr, r) </s> remove if (r.Type == dns.TypeA && qtype == dns.TypeA) || (r.Type == dns.TypeAAAA && qtype == dns.TypeAAAA) { </s> add if r.Type == qtype && (qtype == dns.TypeA || qtype == dns.TypeAAAA) { </s> remove type rewritesArray []RewriteEntry </s> add // rewritesSorted is a slice of legacy rewrites for sorting. // // The sorting priority: // // A and AAAA > CNAME // wildcard > exact // lower level wildcard > higher level wildcard // type rewritesSorted []RewriteEntry
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites.go
// matchDomainWildcard returns true if host matches the wildcard pattern. func matchDomainWildcard(host, wildcard string) (ok bool) { return isWildcard(wildcard) && strings.HasSuffix(host, wildcard[1:])
<mask> return len(host) >= 2 && <mask> host[0] == '*' && host[1] == '.' <mask> } <mask> <mask> // Return TRUE of host name matches a wildcard pattern <mask> func matchDomainWildcard(host, wildcard string) bool { <mask> return isWildcard(wildcard) && <mask> strings.HasSuffix(host, wildcard[1:]) <mask> } <mask> <mask> type rewritesArray []RewriteEntry <mask> <mask> func (a rewritesArray) Len() int { return len(a) } </s> Pull request: filtering: fix legacy rewrite wildcards Updates #3343. Squashed commit of the following: commit ab3c3e002a6d2a11bc3207fdaaeb292aaa194907 Author: Ainar Garipov <[email protected]> Date: Mon Jul 12 20:58:57 2021 +0300 filtering: fix legacy rewrite wildcards </s> remove return len(host) >= 2 && host[0] == '*' && host[1] == '.' </s> add return len(host) > 1 && host[0] == '*' && host[1] == '.' </s> remove type rewritesArray []RewriteEntry </s> add // rewritesSorted is a slice of legacy rewrites for sorting. // // The sorting priority: // // A and AAAA > CNAME // wildcard > exact // lower level wildcard > higher level wildcard // type rewritesSorted []RewriteEntry </s> remove // Priority: // . CNAME < A/AAAA; // . exact < wildcard; // . higher level wildcard < lower level wildcard func (a rewritesArray) Less(i, j int) bool { </s> add // Less implements the sort.Interface interface for legacyRewritesSorted. func (a rewritesSorted) Less(i, j int) bool { </s> remove func (a rewritesArray) Len() int { return len(a) } </s> add // Len implements the sort.Interface interface for legacyRewritesSorted. func (a rewritesSorted) Len() int { return len(a) } </s> remove func (a rewritesArray) Swap(i, j int) { a[i], a[j] = a[j], a[i] } </s> add // Swap implements the sort.Interface interface for legacyRewritesSorted. func (a rewritesSorted) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/194ea6ef9529e4d34ae764eaf4c5f60960aa3ed2
internal/filtering/rewrites.go