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
|
---|---|---|---|---|
httpUpdateConfigReloadDNSReturnOK(w, r) | <mask> }
<mask>
<mask> func handleQueryLogDisable(w http.ResponseWriter, r *http.Request) {
<mask> config.CoreDNS.QueryLogEnabled = false
<mask> err := writeAllConfigsAndReloadCoreDNS()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write config file: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> return
<mask> }
<mask> _, err = fmt.Fprintf(w, "OK\n")
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write body: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> }
<mask>
<mask> }
<mask>
<mask> func handleStatsReset(w http.ResponseWriter, r *http.Request) {
<mask> resp, err := client.Post("http://127.0.0.1:8618/stats_reset", "text/plain", nil)
<mask> if err != nil {
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
httpUpdateConfigReloadDNSReturnOK(w, r) | <mask> // ---------
<mask>
<mask> func handleFilteringEnable(w http.ResponseWriter, r *http.Request) {
<mask> config.CoreDNS.FilteringEnabled = true
<mask> err := writeAllConfigsAndReloadCoreDNS()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write config file: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> return
<mask> }
<mask> _, err = fmt.Fprintf(w, "OK\n")
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write body: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> }
<mask>
<mask> }
<mask>
<mask> func handleFilteringDisable(w http.ResponseWriter, r *http.Request) {
<mask> config.CoreDNS.FilteringEnabled = false
<mask> err := writeAllConfigsAndReloadCoreDNS()
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err = writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
httpUpdateConfigReloadDNSReturnOK(w, r) | <mask> }
<mask>
<mask> func handleFilteringDisable(w http.ResponseWriter, r *http.Request) {
<mask> config.CoreDNS.FilteringEnabled = false
<mask> err := writeAllConfigsAndReloadCoreDNS()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write config file: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> return
<mask> }
<mask> _, err = fmt.Fprintf(w, "OK\n")
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write body: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> }
<mask>
<mask> }
<mask>
<mask> func handleFilteringStatus(w http.ResponseWriter, r *http.Request) {
<mask> data := map[string]interface{}{
<mask> "enabled": config.CoreDNS.FilteringEnabled,
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
<mask> newFilters = append(newFilters, filter)
<mask> }
<mask> }
<mask> config.Filters = newFilters
<mask> err = writeAllConfigs()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write config file: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> return
<mask> }
<mask> err = writeFilterFile()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write filter file: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove err = writeAllConfigs()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
</s> add </s> remove err = writeAllConfigs()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
</s> add </s> remove err = writeAllConfigs()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
</s> add </s> remove err = writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
|
httpUpdateConfigReloadDNSReturnOK(w, r) | <mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> return
<mask> }
<mask> tellCoreDNSToReload()
<mask> _, err = fmt.Fprintf(w, "OK\n")
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write body: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> }
<mask>
<mask> }
<mask>
<mask> func handleFilteringEnableURL(w http.ResponseWriter, r *http.Request) {
<mask> parameters, err := parseParametersFromBody(r.Body)
<mask> if err != nil {
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove tellCoreDNSToReload()
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove tellCoreDNSToReload()
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
<mask> http.Error(w, "URL parameter was not previously added", http.StatusBadRequest)
<mask> return
<mask> }
<mask>
<mask> err = writeAllConfigs()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write config file: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> return
<mask> }
<mask>
<mask> // kick off refresh of rules from new URLs
<mask> refreshFiltersIfNeccessary()
<mask> err = writeFilterFile()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write filter file: %s", err)
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove err = writeAllConfigs()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
</s> add </s> remove err = writeAllConfigs()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
</s> add </s> remove err = writeAllConfigs()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
</s> add </s> remove err = writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
|
httpUpdateConfigReloadDNSReturnOK(w, r) | <mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> return
<mask> }
<mask> tellCoreDNSToReload()
<mask> _, err = fmt.Fprintf(w, "OK\n")
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write body: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> }
<mask>
<mask> }
<mask>
<mask> func handleFilteringDisableURL(w http.ResponseWriter, r *http.Request) {
<mask> parameters, err := parseParametersFromBody(r.Body)
<mask> if err != nil {
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove tellCoreDNSToReload()
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove tellCoreDNSToReload()
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
<mask> http.Error(w, "URL parameter was not previously added", http.StatusBadRequest)
<mask> return
<mask> }
<mask>
<mask> err = writeAllConfigs()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write config file: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> return
<mask> }
<mask> err = writeFilterFile()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write filter file: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove err = writeAllConfigs()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
</s> add </s> remove err = writeAllConfigs()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
</s> add </s> remove err = writeAllConfigs()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
</s> add </s> remove err = writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
|
httpUpdateConfigReloadDNSReturnOK(w, r) | <mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> return
<mask> }
<mask> tellCoreDNSToReload()
<mask> _, err = fmt.Fprintf(w, "OK\n")
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write body: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> }
<mask>
<mask> // TODO: regenerate coredns config and tell coredns to reload it if it's running
<mask> }
<mask>
<mask> func handleFilteringSetRules(w http.ResponseWriter, r *http.Request) {
<mask> body, err := ioutil.ReadAll(r.Body)
<mask> if err != nil {
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove tellCoreDNSToReload()
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove tellCoreDNSToReload()
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove tellCoreDNSToReload()
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
<mask> return
<mask> }
<mask>
<mask> config.UserRules = strings.Split(string(body), "\n")
<mask> err = writeAllConfigs()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write config file: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> return
<mask> }
<mask> err = writeFilterFile()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write filter file: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove err = writeAllConfigs()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
</s> add </s> remove err = writeAllConfigs()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
</s> add </s> remove err = writeAllConfigs()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
</s> add </s> remove err = writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
|
httpUpdateConfigReloadDNSReturnOK(w, r) | <mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> return
<mask> }
<mask> tellCoreDNSToReload()
<mask> _, err = fmt.Fprintf(w, "OK\n")
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write body: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> }
<mask>
<mask> }
<mask>
<mask> func handleFilteringRefresh(w http.ResponseWriter, r *http.Request) {
<mask> force := r.URL.Query().Get("force")
<mask> if force != "" {
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove tellCoreDNSToReload()
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove tellCoreDNSToReload()
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
httpUpdateConfigReloadDNSReturnOK(w, r) | <mask> // ------------
<mask>
<mask> func handleSafeBrowsingEnable(w http.ResponseWriter, r *http.Request) {
<mask> config.CoreDNS.SafeBrowsingEnabled = true
<mask> err := writeAllConfigsAndReloadCoreDNS()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write config file: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> return
<mask> }
<mask> _, err = fmt.Fprintf(w, "OK\n")
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write body: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> }
<mask>
<mask> }
<mask>
<mask> func handleSafeBrowsingDisable(w http.ResponseWriter, r *http.Request) {
<mask> config.CoreDNS.SafeBrowsingEnabled = false
<mask> err := writeAllConfigsAndReloadCoreDNS()
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err = writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
httpUpdateConfigReloadDNSReturnOK(w, r) | <mask> }
<mask>
<mask> func handleSafeBrowsingDisable(w http.ResponseWriter, r *http.Request) {
<mask> config.CoreDNS.SafeBrowsingEnabled = false
<mask> err := writeAllConfigsAndReloadCoreDNS()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write config file: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> return
<mask> }
<mask> _, err = fmt.Fprintf(w, "OK\n")
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write body: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> }
<mask>
<mask> }
<mask>
<mask> func handleSafeBrowsingStatus(w http.ResponseWriter, r *http.Request) {
<mask> data := map[string]interface{}{
<mask> "enabled": config.CoreDNS.SafeBrowsingEnabled,
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
httpUpdateConfigReloadDNSReturnOK(w, r) | <mask> return
<mask> }
<mask> config.CoreDNS.ParentalSensitivity = i
<mask> config.CoreDNS.ParentalEnabled = true
<mask> err = writeAllConfigsAndReloadCoreDNS()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write config file: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> return
<mask> }
<mask> _, err = fmt.Fprintf(w, "OK\n")
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write body: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> }
<mask>
<mask> }
<mask>
<mask> func handleParentalDisable(w http.ResponseWriter, r *http.Request) {
<mask> config.CoreDNS.ParentalEnabled = false
<mask> err := writeAllConfigsAndReloadCoreDNS()
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
httpUpdateConfigReloadDNSReturnOK(w, r) | <mask> }
<mask>
<mask> func handleParentalDisable(w http.ResponseWriter, r *http.Request) {
<mask> config.CoreDNS.ParentalEnabled = false
<mask> err := writeAllConfigsAndReloadCoreDNS()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write config file: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> return
<mask> }
<mask> _, err = fmt.Fprintf(w, "OK\n")
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write body: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> }
<mask>
<mask> }
<mask>
<mask> func handleParentalStatus(w http.ResponseWriter, r *http.Request) {
<mask> data := map[string]interface{}{
<mask> "enabled": config.CoreDNS.ParentalEnabled,
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err = writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
httpUpdateConfigReloadDNSReturnOK(w, r) | <mask> // ------------
<mask>
<mask> func handleSafeSearchEnable(w http.ResponseWriter, r *http.Request) {
<mask> config.CoreDNS.SafeSearchEnabled = true
<mask> err := writeAllConfigsAndReloadCoreDNS()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write config file: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> return
<mask> }
<mask> _, err = fmt.Fprintf(w, "OK\n")
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write body: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> }
<mask>
<mask> }
<mask>
<mask> func handleSafeSearchDisable(w http.ResponseWriter, r *http.Request) {
<mask> config.CoreDNS.SafeSearchEnabled = false
<mask> err := writeAllConfigsAndReloadCoreDNS()
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err = writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
httpUpdateConfigReloadDNSReturnOK(w, r) | <mask> }
<mask>
<mask> func handleSafeSearchDisable(w http.ResponseWriter, r *http.Request) {
<mask> config.CoreDNS.SafeSearchEnabled = false
<mask> err := writeAllConfigsAndReloadCoreDNS()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write config file: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> return
<mask> }
<mask> _, err = fmt.Fprintf(w, "OK\n")
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write body: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> }
<mask>
<mask> }
<mask>
<mask> func handleSafeSearchStatus(w http.ResponseWriter, r *http.Request) {
<mask> data := map[string]interface{}{
<mask> "enabled": config.CoreDNS.SafeSearchEnabled,
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
http.HandleFunc("/control/enable_protection", optionalAuth(ensurePOST(handleProtectionEnable)))
http.HandleFunc("/control/disable_protection", optionalAuth(ensurePOST(handleProtectionDisable))) | <mask> http.HandleFunc("/control/start", optionalAuth(ensurePOST(handleStart)))
<mask> http.HandleFunc("/control/stop", optionalAuth(ensurePOST(handleStop)))
<mask> http.HandleFunc("/control/restart", optionalAuth(ensurePOST(handleRestart)))
<mask> http.HandleFunc("/control/status", optionalAuth(ensureGET(handleStatus)))
<mask> http.HandleFunc("/control/stats", optionalAuth(ensureGET(handleStats)))
<mask> http.HandleFunc("/control/stats_history", optionalAuth(ensureGET(handleStatsHistory)))
<mask> http.HandleFunc("/control/stats_top", optionalAuth(ensureGET(handleStatsTop)))
<mask> http.HandleFunc("/control/stats_reset", optionalAuth(ensurePOST(handleStatsReset)))
<mask> http.HandleFunc("/control/querylog", optionalAuth(ensureGET(handleQueryLog)))
<mask> http.HandleFunc("/control/querylog_enable", optionalAuth(ensurePOST(handleQueryLogEnable)))
<mask> http.HandleFunc("/control/querylog_disable", optionalAuth(ensurePOST(handleQueryLogDisable)))
<mask> http.HandleFunc("/control/set_upstream_dns", optionalAuth(ensurePOST(handleSetUpstreamDNS)))
<mask> http.HandleFunc("/control/test_upstream_dns", optionalAuth(ensurePOST(handleTestUpstreamDNS)))
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove http.HandleFunc("/control/filtering/status", optionalAuth(ensureGET(handleFilteringStatus)))
</s> add </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove tellCoreDNSToReload()
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
http.HandleFunc("/control/stats_top", optionalAuth(ensureGET(handleStatsTop)))
http.HandleFunc("/control/stats", optionalAuth(ensureGET(handleStats)))
http.HandleFunc("/control/stats_history", optionalAuth(ensureGET(handleStatsHistory)))
http.HandleFunc("/control/stats_reset", optionalAuth(ensurePOST(handleStatsReset))) | <mask> http.HandleFunc("/control/set_upstream_dns", optionalAuth(ensurePOST(handleSetUpstreamDNS)))
<mask> http.HandleFunc("/control/test_upstream_dns", optionalAuth(ensurePOST(handleTestUpstreamDNS)))
<mask> http.HandleFunc("/control/version.json", optionalAuth(handleGetVersionJSON))
<mask> http.HandleFunc("/control/filtering/enable", optionalAuth(ensurePOST(handleFilteringEnable)))
<mask> http.HandleFunc("/control/filtering/disable", optionalAuth(ensurePOST(handleFilteringDisable)))
<mask> http.HandleFunc("/control/filtering/add_url", optionalAuth(ensurePUT(handleFilteringAddURL)))
<mask> http.HandleFunc("/control/filtering/remove_url", optionalAuth(ensureDELETE(handleFilteringRemoveURL)))
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove http.HandleFunc("/control/filtering/status", optionalAuth(ensureGET(handleFilteringStatus)))
</s> add </s> remove http.HandleFunc("/control/stats", optionalAuth(ensureGET(handleStats)))
http.HandleFunc("/control/stats_history", optionalAuth(ensureGET(handleStatsHistory)))
http.HandleFunc("/control/stats_top", optionalAuth(ensureGET(handleStatsTop)))
http.HandleFunc("/control/stats_reset", optionalAuth(ensurePOST(handleStatsReset)))
</s> add http.HandleFunc("/control/enable_protection", optionalAuth(ensurePOST(handleProtectionEnable)))
http.HandleFunc("/control/disable_protection", optionalAuth(ensurePOST(handleProtectionDisable))) </s> remove http.HandleFunc("/control/filtering/set_rules", optionalAuth(ensurePUT(handleFilteringSetRules)))
</s> add | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
<mask> http.HandleFunc("/control/test_upstream_dns", optionalAuth(ensurePOST(handleTestUpstreamDNS)))
<mask> http.HandleFunc("/control/version.json", optionalAuth(handleGetVersionJSON))
<mask> http.HandleFunc("/control/filtering/enable", optionalAuth(ensurePOST(handleFilteringEnable)))
<mask> http.HandleFunc("/control/filtering/disable", optionalAuth(ensurePOST(handleFilteringDisable)))
<mask> http.HandleFunc("/control/filtering/status", optionalAuth(ensureGET(handleFilteringStatus)))
<mask> http.HandleFunc("/control/filtering/add_url", optionalAuth(ensurePUT(handleFilteringAddURL)))
<mask> http.HandleFunc("/control/filtering/remove_url", optionalAuth(ensureDELETE(handleFilteringRemoveURL)))
<mask> http.HandleFunc("/control/filtering/enable_url", optionalAuth(ensurePOST(handleFilteringEnableURL)))
<mask> http.HandleFunc("/control/filtering/disable_url", optionalAuth(ensurePOST(handleFilteringDisableURL)))
<mask> http.HandleFunc("/control/filtering/set_rules", optionalAuth(ensurePUT(handleFilteringSetRules)))
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove http.HandleFunc("/control/filtering/set_rules", optionalAuth(ensurePUT(handleFilteringSetRules)))
</s> add </s> remove http.HandleFunc("/control/stats", optionalAuth(ensureGET(handleStats)))
http.HandleFunc("/control/stats_history", optionalAuth(ensureGET(handleStatsHistory)))
http.HandleFunc("/control/stats_top", optionalAuth(ensureGET(handleStatsTop)))
http.HandleFunc("/control/stats_reset", optionalAuth(ensurePOST(handleStatsReset)))
</s> add http.HandleFunc("/control/enable_protection", optionalAuth(ensurePOST(handleProtectionEnable)))
http.HandleFunc("/control/disable_protection", optionalAuth(ensurePOST(handleProtectionDisable))) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
|
<mask> http.HandleFunc("/control/filtering/add_url", optionalAuth(ensurePUT(handleFilteringAddURL)))
<mask> http.HandleFunc("/control/filtering/remove_url", optionalAuth(ensureDELETE(handleFilteringRemoveURL)))
<mask> http.HandleFunc("/control/filtering/enable_url", optionalAuth(ensurePOST(handleFilteringEnableURL)))
<mask> http.HandleFunc("/control/filtering/disable_url", optionalAuth(ensurePOST(handleFilteringDisableURL)))
<mask> http.HandleFunc("/control/filtering/set_rules", optionalAuth(ensurePUT(handleFilteringSetRules)))
<mask> http.HandleFunc("/control/filtering/refresh", optionalAuth(ensurePOST(handleFilteringRefresh)))
<mask> http.HandleFunc("/control/safebrowsing/enable", optionalAuth(ensurePOST(handleSafeBrowsingEnable)))
<mask> http.HandleFunc("/control/safebrowsing/disable", optionalAuth(ensurePOST(handleSafeBrowsingDisable)))
<mask> http.HandleFunc("/control/safebrowsing/status", optionalAuth(ensureGET(handleSafeBrowsingStatus)))
<mask> http.HandleFunc("/control/parental/enable", optionalAuth(ensurePOST(handleParentalEnable)))
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove http.HandleFunc("/control/filtering/status", optionalAuth(ensureGET(handleFilteringStatus)))
</s> add </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
|
http.HandleFunc("/control/filtering/status", optionalAuth(ensureGET(handleFilteringStatus)))
http.HandleFunc("/control/filtering/set_rules", optionalAuth(ensurePUT(handleFilteringSetRules))) | <mask> http.HandleFunc("/control/filtering/remove_url", optionalAuth(ensureDELETE(handleFilteringRemoveURL)))
<mask> http.HandleFunc("/control/filtering/enable_url", optionalAuth(ensurePOST(handleFilteringEnableURL)))
<mask> http.HandleFunc("/control/filtering/disable_url", optionalAuth(ensurePOST(handleFilteringDisableURL)))
<mask> http.HandleFunc("/control/filtering/refresh", optionalAuth(ensurePOST(handleFilteringRefresh)))
<mask> http.HandleFunc("/control/safebrowsing/enable", optionalAuth(ensurePOST(handleSafeBrowsingEnable)))
<mask> http.HandleFunc("/control/safebrowsing/disable", optionalAuth(ensurePOST(handleSafeBrowsingDisable)))
<mask> http.HandleFunc("/control/safebrowsing/status", optionalAuth(ensureGET(handleSafeBrowsingStatus)))
<mask> http.HandleFunc("/control/parental/enable", optionalAuth(ensurePOST(handleParentalEnable)))
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove http.HandleFunc("/control/filtering/set_rules", optionalAuth(ensurePUT(handleFilteringSetRules)))
</s> add </s> remove http.HandleFunc("/control/filtering/status", optionalAuth(ensureGET(handleFilteringStatus)))
</s> add </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | control.go |
protection_enabled: true | <mask> dns_address: 127.0.0.1
<mask> dns_port: 53
<mask> querylog_enabled: true
<mask> running: true
<mask> upstream_dns:
<mask> - 1.1.1.1
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove err = writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) </s> remove err := writeAllConfigsAndReloadCoreDNS()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK\n")
if err != nil {
errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
}
</s> add httpUpdateConfigReloadDNSReturnOK(w, r) | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | openapi.yaml |
/stats_reset:
post:
tags:
-global
operationId: statsReset
summary: "Reset all statistics to zeroes"
responses:
200:
description: OK | <mask> - 123
<mask> - 123
<mask> - 123
<mask> - 123
<mask> /filtering/enable:
<mask> post:
<mask> tags:
<mask> - filtering
</s> API backend -- implement ability to turn toggle all protection in one go, helpful to temporarily disable all kinds of filtering </s> remove err = writeAllConfigs()
if err != nil {
errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
return
}
</s> add </s> remove dnsfilter {{if .FilteringEnabled}}{{.FilterFile}}{{end}} {
</s> add {{if .ProtectionEnabled}}dnsfilter {{if .FilteringEnabled}}{{.FilterFile}}{{end}} { </s> remove }
</s> add }{{end}} | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/413228e6ecaf9019c8eac7034f1404b5c9c497fd | openapi.yaml |
// IP (or domain name) which is used to respond to DNS requests blocked by parental control or safe-browsing
ParentalBlockHost string `yaml:"parental_block_host"`
SafeBrowsingBlockHost string `yaml:"safebrowsing_block_host"`
| <mask> AllowedClients []string `yaml:"allowed_clients"` // IP addresses of whitelist clients
<mask> DisallowedClients []string `yaml:"disallowed_clients"` // IP addresses of clients that should be blocked
<mask> BlockedHosts []string `yaml:"blocked_hosts"` // hosts that should be blocked
<mask>
<mask> dnsfilter.Config `yaml:",inline"`
<mask> }
<mask>
<mask> // TLSConfig is the TLS configuration for HTTPS, DNS-over-HTTPS, and DNS-over-TLS
<mask> type TLSConfig struct {
<mask> TLSListenAddr *net.TCPAddr `yaml:"-" json:"-"`
</s> + dnsforward, config: add "parental_block_host" and "safebrowsing_block_host" settings </s> remove return s.genBlockedHost(m, safeBrowsingBlockHost, d)
</s> add return s.genBlockedHost(m, s.conf.SafeBrowsingBlockHost, d) </s> remove return s.genBlockedHost(m, parentalBlockHost, d)
</s> add return s.genBlockedHost(m, s.conf.ParentalBlockHost, d) | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4134a8c30e4e3e32eab0dcc595798ffbb907e791 | dnsforward/dnsforward.go |
if len(s.conf.ParentalBlockHost) == 0 {
s.conf.ParentalBlockHost = parentalBlockHost
}
if len(s.conf.SafeBrowsingBlockHost) == 0 {
s.conf.SafeBrowsingBlockHost = safeBrowsingBlockHost
}
| <mask> }
<mask> }
<mask> }
<mask>
<mask> s.dnsFilter = dnsfilter.New(&s.conf.Config, filters)
<mask> if s.dnsFilter == nil {
<mask> return fmt.Errorf("could not initialize dnsfilter")
<mask> }
<mask> return nil
</s> + dnsforward, config: add "parental_block_host" and "safebrowsing_block_host" settings </s> remove return s.genBlockedHost(m, safeBrowsingBlockHost, d)
</s> add return s.genBlockedHost(m, s.conf.SafeBrowsingBlockHost, d) </s> remove return s.genBlockedHost(m, parentalBlockHost, d)
</s> add return s.genBlockedHost(m, s.conf.ParentalBlockHost, d) | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4134a8c30e4e3e32eab0dcc595798ffbb907e791 | dnsforward/dnsforward.go |
return s.genBlockedHost(m, s.conf.SafeBrowsingBlockHost, d) | <mask> }
<mask>
<mask> switch result.Reason {
<mask> case dnsfilter.FilteredSafeBrowsing:
<mask> return s.genBlockedHost(m, safeBrowsingBlockHost, d)
<mask> case dnsfilter.FilteredParental:
<mask> return s.genBlockedHost(m, parentalBlockHost, d)
<mask> default:
<mask> if result.IP != nil {
<mask> if m.Question[0].Qtype == dns.TypeA {
</s> + dnsforward, config: add "parental_block_host" and "safebrowsing_block_host" settings </s> remove return s.genBlockedHost(m, parentalBlockHost, d)
</s> add return s.genBlockedHost(m, s.conf.ParentalBlockHost, d) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4134a8c30e4e3e32eab0dcc595798ffbb907e791 | dnsforward/dnsforward.go |
return s.genBlockedHost(m, s.conf.ParentalBlockHost, d) | <mask> switch result.Reason {
<mask> case dnsfilter.FilteredSafeBrowsing:
<mask> return s.genBlockedHost(m, safeBrowsingBlockHost, d)
<mask> case dnsfilter.FilteredParental:
<mask> return s.genBlockedHost(m, parentalBlockHost, d)
<mask> default:
<mask> if result.IP != nil {
<mask> if m.Question[0].Qtype == dns.TypeA {
<mask> return s.genARecord(m, result.IP)
<mask> } else if m.Question[0].Qtype == dns.TypeAAAA {
</s> + dnsforward, config: add "parental_block_host" and "safebrowsing_block_host" settings </s> remove return s.genBlockedHost(m, safeBrowsingBlockHost, d)
</s> add return s.genBlockedHost(m, s.conf.SafeBrowsingBlockHost, d) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4134a8c30e4e3e32eab0dcc595798ffbb907e791 | dnsforward/dnsforward.go |
// Connect to a remote server resolving hostname using our own DNS server.
//
// TODO(e.burkov): This messy logic should be decomposed and clarified. | <mask> _, err := os.Stat(configfile)
<mask> return errors.Is(err, os.ErrNotExist)
<mask> }
<mask>
<mask> // Connect to a remote server resolving hostname using our own DNS server
<mask> func customDialContext(ctx context.Context, network, addr string) (conn net.Conn, err error) {
<mask> log.Tracef("network:%v addr:%v", network, addr)
<mask>
<mask> host, port, err := net.SplitHostPort(addr)
<mask> if err != nil {
</s> Pull request: 2574 external tests vol.4
Merge in DNS/adguard-home from 2574-external-tests-4 to master
Close #2574.
Squashed commit of the following:
commit 0d06fce604750f76f4a319b2539105e936a248ce
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 13:26:25 2021 +0300
home: imp tests, docs
commit fc7b7f13f19bb8f183522a13d5726253eaae83d0
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 12:20:15 2021 +0300
home: fix whois test </s> remove conn, err := customDialContext(ctx, "tcp", serverAddr)
</s> add conn, err := w.dialContext(ctx, "tcp", serverAddr) </s> remove err = Context.dnsServer.Prepare(conf)
require.NoError(t, err)
</s> add // SetReadDeadline implements net.Conn interface for *fakeConn. It always
// returns nil.
func (c *fakeConn) SetReadDeadline(_ time.Time) (err error) {
return nil
}
// fakeDial is a mock implementation of customDialContext to simplify testing.
func (c *fakeConn) fakeDial(ctx context.Context, network, addr string) (conn net.Conn, err error) {
return c, nil </s> remove config.DNS.Port = 1234
</s> add // Write implements net.Conn interface for *fakeConn. It always returns 0 and a
// nil error without mutating the slice.
func (c *fakeConn) Write(_ []byte) (n int, err error) {
return 0, nil
} </s> remove conf := &dnsforward.ServerConfig{}
conf.UpstreamDNS = []string{"8.8.8.8"}
</s> add // Close implements net.Conn interface for *fakeConn. It always returns nil.
func (c *fakeConn) Close() (err error) {
return nil
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4165e0ef3a751383f1dd28b13a4086e3c1eb8cba | internal/home/home.go |
// dialContext specifies the dial function for creating unencrypted TCP
// connections.
dialContext func(ctx context.Context, network, addr string) (conn net.Conn, err error)
| <mask> ipChan chan net.IP
<mask>
<mask> // Contains IP addresses of clients
<mask> // An active IP address is resolved once again after it expires.
<mask> // If IP address couldn't be resolved, it stays here for some time to prevent further attempts to resolve the same IP.
<mask> ipAddrs cache.Cache
<mask>
<mask> // TODO(a.garipov): Rewrite to use time.Duration. Like, seriously, why?
</s> Pull request: 2574 external tests vol.4
Merge in DNS/adguard-home from 2574-external-tests-4 to master
Close #2574.
Squashed commit of the following:
commit 0d06fce604750f76f4a319b2539105e936a248ce
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 13:26:25 2021 +0300
home: imp tests, docs
commit fc7b7f13f19bb8f183522a13d5726253eaae83d0
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 12:20:15 2021 +0300
home: fix whois test </s> remove func prepareTestDNSServer(t *testing.T) {
t.Helper()
</s> add // fakeConn is a mock implementation of net.Conn to simplify testing.
//
// TODO(e.burkov): Search for other places in code where it may be used. Move
// into aghtest then.
type fakeConn struct {
// Conn is embedded here simply to make *fakeConn a net.Conn without
// actually implementing all methods.
net.Conn
data []byte
} </s> remove // TODO(e.burkov): It's kind of complicated to get rid of network access in this
// test. The thing is that *Whois creates new *net.Dialer each time it requests
// the server, so it becomes hard to simulate handling of request from test even
// with substituted upstream. However, it must be done.
</s> add </s> remove err = Context.dnsServer.Prepare(conf)
require.NoError(t, err)
</s> add // SetReadDeadline implements net.Conn interface for *fakeConn. It always
// returns nil.
func (c *fakeConn) SetReadDeadline(_ time.Time) (err error) {
return nil
}
// fakeDial is a mock implementation of customDialContext to simplify testing.
func (c *fakeConn) fakeDial(ctx context.Context, network, addr string) (conn net.Conn, err error) {
return c, nil </s> remove prepareTestDNSServer(t)
</s> add const (
nl = "\n"
data = `OrgName: FakeOrg LLC` + nl +
`City: Nonreal` + nl +
`Country: Imagiland` + nl
)
fc := &fakeConn{
data: []byte(data),
} </s> remove var err error
Context.dnsServer, err = dnsforward.NewServer(dnsforward.DNSCreateParams{})
require.NoError(t, err)
</s> add // Read implements net.Conn interface for *fakeConn. It puts the content of
// c.data field into b up to the b's capacity.
func (c *fakeConn) Read(b []byte) (n int, err error) {
return copy(b, c.data), io.EOF
} | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4165e0ef3a751383f1dd28b13a4086e3c1eb8cba | internal/home/whois.go |
dialContext: customDialContext,
ipChan: make(chan net.IP, 255), | <mask> ipAddrs: cache.New(cache.Config{
<mask> EnableLRU: true,
<mask> MaxCount: 10000,
<mask> }),
<mask> ipChan: make(chan net.IP, 255),
<mask> }
<mask>
<mask> go w.workerLoop()
<mask>
<mask> return &w
</s> Pull request: 2574 external tests vol.4
Merge in DNS/adguard-home from 2574-external-tests-4 to master
Close #2574.
Squashed commit of the following:
commit 0d06fce604750f76f4a319b2539105e936a248ce
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 13:26:25 2021 +0300
home: imp tests, docs
commit fc7b7f13f19bb8f183522a13d5726253eaae83d0
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 12:20:15 2021 +0300
home: fix whois test </s> remove conn, err := customDialContext(ctx, "tcp", serverAddr)
</s> add conn, err := w.dialContext(ctx, "tcp", serverAddr) </s> remove conf := &dnsforward.ServerConfig{}
conf.UpstreamDNS = []string{"8.8.8.8"}
</s> add // Close implements net.Conn interface for *fakeConn. It always returns nil.
func (c *fakeConn) Close() (err error) {
return nil
} </s> remove err = Context.dnsServer.Prepare(conf)
require.NoError(t, err)
</s> add // SetReadDeadline implements net.Conn interface for *fakeConn. It always
// returns nil.
func (c *fakeConn) SetReadDeadline(_ time.Time) (err error) {
return nil
}
// fakeDial is a mock implementation of customDialContext to simplify testing.
func (c *fakeConn) fakeDial(ctx context.Context, network, addr string) (conn net.Conn, err error) {
return c, nil </s> remove config.DNS.Port = 1234
</s> add // Write implements net.Conn interface for *fakeConn. It always returns 0 and a
// nil error without mutating the slice.
func (c *fakeConn) Write(_ []byte) (n int, err error) {
return 0, nil
} </s> remove var err error
Context.dnsServer, err = dnsforward.NewServer(dnsforward.DNSCreateParams{})
require.NoError(t, err)
</s> add // Read implements net.Conn interface for *fakeConn. It puts the content of
// c.data field into b up to the b's capacity.
func (c *fakeConn) Read(b []byte) (n int, err error) {
return copy(b, c.data), io.EOF
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4165e0ef3a751383f1dd28b13a4086e3c1eb8cba | internal/home/whois.go |
conn, err := w.dialContext(ctx, "tcp", serverAddr) | <mask> addr, _, _ := net.SplitHostPort(serverAddr)
<mask> if addr == "whois.arin.net" {
<mask> target = "n + " + target
<mask> }
<mask> conn, err := customDialContext(ctx, "tcp", serverAddr)
<mask> if err != nil {
<mask> return "", err
<mask> }
<mask> defer conn.Close()
<mask>
</s> Pull request: 2574 external tests vol.4
Merge in DNS/adguard-home from 2574-external-tests-4 to master
Close #2574.
Squashed commit of the following:
commit 0d06fce604750f76f4a319b2539105e936a248ce
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 13:26:25 2021 +0300
home: imp tests, docs
commit fc7b7f13f19bb8f183522a13d5726253eaae83d0
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 12:20:15 2021 +0300
home: fix whois test </s> remove // Connect to a remote server resolving hostname using our own DNS server
</s> add // Connect to a remote server resolving hostname using our own DNS server.
//
// TODO(e.burkov): This messy logic should be decomposed and clarified. </s> remove prepareTestDNSServer(t)
</s> add const (
nl = "\n"
data = `OrgName: FakeOrg LLC` + nl +
`City: Nonreal` + nl +
`Country: Imagiland` + nl
)
fc := &fakeConn{
data: []byte(data),
} </s> remove conf := &dnsforward.ServerConfig{}
conf.UpstreamDNS = []string{"8.8.8.8"}
</s> add // Close implements net.Conn interface for *fakeConn. It always returns nil.
func (c *fakeConn) Close() (err error) {
return nil
} </s> remove w := Whois{timeoutMsec: 5000}
resp, err := w.queryAll(context.Background(), "8.8.8.8")
</s> add w := Whois{
timeoutMsec: 5000,
dialContext: fc.fakeDial,
}
resp, err := w.queryAll(context.Background(), "1.2.3.4") </s> remove config.DNS.Port = 1234
</s> add // Write implements net.Conn interface for *fakeConn. It always returns 0 and a
// nil error without mutating the slice.
func (c *fakeConn) Write(_ []byte) (n int, err error) {
return 0, nil
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4165e0ef3a751383f1dd28b13a4086e3c1eb8cba | internal/home/whois.go |
"io"
"net" | <mask> import (
<mask> "context"
<mask> "testing"
<mask> "time"
<mask>
<mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
</s> Pull request: 2574 external tests vol.4
Merge in DNS/adguard-home from 2574-external-tests-4 to master
Close #2574.
Squashed commit of the following:
commit 0d06fce604750f76f4a319b2539105e936a248ce
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 13:26:25 2021 +0300
home: imp tests, docs
commit fc7b7f13f19bb8f183522a13d5726253eaae83d0
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 12:20:15 2021 +0300
home: fix whois test </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsforward"
</s> add </s> remove func prepareTestDNSServer(t *testing.T) {
t.Helper()
</s> add // fakeConn is a mock implementation of net.Conn to simplify testing.
//
// TODO(e.burkov): Search for other places in code where it may be used. Move
// into aghtest then.
type fakeConn struct {
// Conn is embedded here simply to make *fakeConn a net.Conn without
// actually implementing all methods.
net.Conn
data []byte
} </s> remove prepareTestDNSServer(t)
</s> add const (
nl = "\n"
data = `OrgName: FakeOrg LLC` + nl +
`City: Nonreal` + nl +
`Country: Imagiland` + nl
)
fc := &fakeConn{
data: []byte(data),
} </s> remove assert.Equal(t, "Google LLC", m["orgname"])
assert.Equal(t, "US", m["country"])
assert.Equal(t, "Mountain View", m["city"])
</s> add assert.Equal(t, "FakeOrg LLC", m["orgname"])
assert.Equal(t, "Imagiland", m["country"])
assert.Equal(t, "Nonreal", m["city"]) | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4165e0ef3a751383f1dd28b13a4086e3c1eb8cba | internal/home/whois_test.go |
"time" | <mask> "io"
<mask> "net"
<mask> "testing"
<mask>
<mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
</s> Pull request: 2574 external tests vol.4
Merge in DNS/adguard-home from 2574-external-tests-4 to master
Close #2574.
Squashed commit of the following:
commit 0d06fce604750f76f4a319b2539105e936a248ce
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 13:26:25 2021 +0300
home: imp tests, docs
commit fc7b7f13f19bb8f183522a13d5726253eaae83d0
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 12:20:15 2021 +0300
home: fix whois test </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsforward"
</s> add </s> remove func prepareTestDNSServer(t *testing.T) {
t.Helper()
</s> add // fakeConn is a mock implementation of net.Conn to simplify testing.
//
// TODO(e.burkov): Search for other places in code where it may be used. Move
// into aghtest then.
type fakeConn struct {
// Conn is embedded here simply to make *fakeConn a net.Conn without
// actually implementing all methods.
net.Conn
data []byte
} </s> remove prepareTestDNSServer(t)
</s> add const (
nl = "\n"
data = `OrgName: FakeOrg LLC` + nl +
`City: Nonreal` + nl +
`Country: Imagiland` + nl
)
fc := &fakeConn{
data: []byte(data),
} </s> remove assert.Equal(t, "Google LLC", m["orgname"])
assert.Equal(t, "US", m["country"])
assert.Equal(t, "Mountain View", m["city"])
</s> add assert.Equal(t, "FakeOrg LLC", m["orgname"])
assert.Equal(t, "Imagiland", m["country"])
assert.Equal(t, "Nonreal", m["city"]) | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4165e0ef3a751383f1dd28b13a4086e3c1eb8cba | internal/home/whois_test.go |
<mask> import (
<mask> "context"
<mask> "testing"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward"
<mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
<mask> func prepareTestDNSServer(t *testing.T) {
</s> Pull request: 2574 external tests vol.4
Merge in DNS/adguard-home from 2574-external-tests-4 to master
Close #2574.
Squashed commit of the following:
commit 0d06fce604750f76f4a319b2539105e936a248ce
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 13:26:25 2021 +0300
home: imp tests, docs
commit fc7b7f13f19bb8f183522a13d5726253eaae83d0
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 12:20:15 2021 +0300
home: fix whois test </s> remove func prepareTestDNSServer(t *testing.T) {
t.Helper()
</s> add // fakeConn is a mock implementation of net.Conn to simplify testing.
//
// TODO(e.burkov): Search for other places in code where it may be used. Move
// into aghtest then.
type fakeConn struct {
// Conn is embedded here simply to make *fakeConn a net.Conn without
// actually implementing all methods.
net.Conn
data []byte
} </s> remove config.DNS.Port = 1234
</s> add // Write implements net.Conn interface for *fakeConn. It always returns 0 and a
// nil error without mutating the slice.
func (c *fakeConn) Write(_ []byte) (n int, err error) {
return 0, nil
} </s> remove prepareTestDNSServer(t)
</s> add const (
nl = "\n"
data = `OrgName: FakeOrg LLC` + nl +
`City: Nonreal` + nl +
`Country: Imagiland` + nl
)
fc := &fakeConn{
data: []byte(data),
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4165e0ef3a751383f1dd28b13a4086e3c1eb8cba | internal/home/whois_test.go |
|
// fakeConn is a mock implementation of net.Conn to simplify testing.
//
// TODO(e.burkov): Search for other places in code where it may be used. Move
// into aghtest then.
type fakeConn struct {
// Conn is embedded here simply to make *fakeConn a net.Conn without
// actually implementing all methods.
net.Conn
data []byte
} | <mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
<mask> func prepareTestDNSServer(t *testing.T) {
<mask> t.Helper()
<mask>
<mask> config.DNS.Port = 1234
<mask>
<mask> var err error
<mask> Context.dnsServer, err = dnsforward.NewServer(dnsforward.DNSCreateParams{})
</s> Pull request: 2574 external tests vol.4
Merge in DNS/adguard-home from 2574-external-tests-4 to master
Close #2574.
Squashed commit of the following:
commit 0d06fce604750f76f4a319b2539105e936a248ce
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 13:26:25 2021 +0300
home: imp tests, docs
commit fc7b7f13f19bb8f183522a13d5726253eaae83d0
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 12:20:15 2021 +0300
home: fix whois test </s> remove config.DNS.Port = 1234
</s> add // Write implements net.Conn interface for *fakeConn. It always returns 0 and a
// nil error without mutating the slice.
func (c *fakeConn) Write(_ []byte) (n int, err error) {
return 0, nil
} </s> remove var err error
Context.dnsServer, err = dnsforward.NewServer(dnsforward.DNSCreateParams{})
require.NoError(t, err)
</s> add // Read implements net.Conn interface for *fakeConn. It puts the content of
// c.data field into b up to the b's capacity.
func (c *fakeConn) Read(b []byte) (n int, err error) {
return copy(b, c.data), io.EOF
} </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsforward"
</s> add </s> remove conf := &dnsforward.ServerConfig{}
conf.UpstreamDNS = []string{"8.8.8.8"}
</s> add // Close implements net.Conn interface for *fakeConn. It always returns nil.
func (c *fakeConn) Close() (err error) {
return nil
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4165e0ef3a751383f1dd28b13a4086e3c1eb8cba | internal/home/whois_test.go |
// Write implements net.Conn interface for *fakeConn. It always returns 0 and a
// nil error without mutating the slice.
func (c *fakeConn) Write(_ []byte) (n int, err error) {
return 0, nil
} | <mask>
<mask> func prepareTestDNSServer(t *testing.T) {
<mask> t.Helper()
<mask>
<mask> config.DNS.Port = 1234
<mask>
<mask> var err error
<mask> Context.dnsServer, err = dnsforward.NewServer(dnsforward.DNSCreateParams{})
<mask> require.NoError(t, err)
<mask>
</s> Pull request: 2574 external tests vol.4
Merge in DNS/adguard-home from 2574-external-tests-4 to master
Close #2574.
Squashed commit of the following:
commit 0d06fce604750f76f4a319b2539105e936a248ce
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 13:26:25 2021 +0300
home: imp tests, docs
commit fc7b7f13f19bb8f183522a13d5726253eaae83d0
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 12:20:15 2021 +0300
home: fix whois test </s> remove var err error
Context.dnsServer, err = dnsforward.NewServer(dnsforward.DNSCreateParams{})
require.NoError(t, err)
</s> add // Read implements net.Conn interface for *fakeConn. It puts the content of
// c.data field into b up to the b's capacity.
func (c *fakeConn) Read(b []byte) (n int, err error) {
return copy(b, c.data), io.EOF
} </s> remove func prepareTestDNSServer(t *testing.T) {
t.Helper()
</s> add // fakeConn is a mock implementation of net.Conn to simplify testing.
//
// TODO(e.burkov): Search for other places in code where it may be used. Move
// into aghtest then.
type fakeConn struct {
// Conn is embedded here simply to make *fakeConn a net.Conn without
// actually implementing all methods.
net.Conn
data []byte
} </s> remove conf := &dnsforward.ServerConfig{}
conf.UpstreamDNS = []string{"8.8.8.8"}
</s> add // Close implements net.Conn interface for *fakeConn. It always returns nil.
func (c *fakeConn) Close() (err error) {
return nil
} </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsforward"
</s> add </s> remove w := Whois{timeoutMsec: 5000}
resp, err := w.queryAll(context.Background(), "8.8.8.8")
</s> add w := Whois{
timeoutMsec: 5000,
dialContext: fc.fakeDial,
}
resp, err := w.queryAll(context.Background(), "1.2.3.4") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4165e0ef3a751383f1dd28b13a4086e3c1eb8cba | internal/home/whois_test.go |
// Read implements net.Conn interface for *fakeConn. It puts the content of
// c.data field into b up to the b's capacity.
func (c *fakeConn) Read(b []byte) (n int, err error) {
return copy(b, c.data), io.EOF
} | <mask> t.Helper()
<mask>
<mask> config.DNS.Port = 1234
<mask>
<mask> var err error
<mask> Context.dnsServer, err = dnsforward.NewServer(dnsforward.DNSCreateParams{})
<mask> require.NoError(t, err)
<mask>
<mask> conf := &dnsforward.ServerConfig{}
<mask> conf.UpstreamDNS = []string{"8.8.8.8"}
<mask>
<mask> err = Context.dnsServer.Prepare(conf)
</s> Pull request: 2574 external tests vol.4
Merge in DNS/adguard-home from 2574-external-tests-4 to master
Close #2574.
Squashed commit of the following:
commit 0d06fce604750f76f4a319b2539105e936a248ce
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 13:26:25 2021 +0300
home: imp tests, docs
commit fc7b7f13f19bb8f183522a13d5726253eaae83d0
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 12:20:15 2021 +0300
home: fix whois test </s> remove conf := &dnsforward.ServerConfig{}
conf.UpstreamDNS = []string{"8.8.8.8"}
</s> add // Close implements net.Conn interface for *fakeConn. It always returns nil.
func (c *fakeConn) Close() (err error) {
return nil
} </s> remove config.DNS.Port = 1234
</s> add // Write implements net.Conn interface for *fakeConn. It always returns 0 and a
// nil error without mutating the slice.
func (c *fakeConn) Write(_ []byte) (n int, err error) {
return 0, nil
} </s> remove func prepareTestDNSServer(t *testing.T) {
t.Helper()
</s> add // fakeConn is a mock implementation of net.Conn to simplify testing.
//
// TODO(e.burkov): Search for other places in code where it may be used. Move
// into aghtest then.
type fakeConn struct {
// Conn is embedded here simply to make *fakeConn a net.Conn without
// actually implementing all methods.
net.Conn
data []byte
} </s> remove err = Context.dnsServer.Prepare(conf)
require.NoError(t, err)
</s> add // SetReadDeadline implements net.Conn interface for *fakeConn. It always
// returns nil.
func (c *fakeConn) SetReadDeadline(_ time.Time) (err error) {
return nil
}
// fakeDial is a mock implementation of customDialContext to simplify testing.
func (c *fakeConn) fakeDial(ctx context.Context, network, addr string) (conn net.Conn, err error) {
return c, nil </s> remove // TODO(e.burkov): It's kind of complicated to get rid of network access in this
// test. The thing is that *Whois creates new *net.Dialer each time it requests
// the server, so it becomes hard to simulate handling of request from test even
// with substituted upstream. However, it must be done.
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4165e0ef3a751383f1dd28b13a4086e3c1eb8cba | internal/home/whois_test.go |
// Close implements net.Conn interface for *fakeConn. It always returns nil.
func (c *fakeConn) Close() (err error) {
return nil
} | <mask> var err error
<mask> Context.dnsServer, err = dnsforward.NewServer(dnsforward.DNSCreateParams{})
<mask> require.NoError(t, err)
<mask>
<mask> conf := &dnsforward.ServerConfig{}
<mask> conf.UpstreamDNS = []string{"8.8.8.8"}
<mask>
<mask> err = Context.dnsServer.Prepare(conf)
<mask> require.NoError(t, err)
<mask> }
<mask>
</s> Pull request: 2574 external tests vol.4
Merge in DNS/adguard-home from 2574-external-tests-4 to master
Close #2574.
Squashed commit of the following:
commit 0d06fce604750f76f4a319b2539105e936a248ce
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 13:26:25 2021 +0300
home: imp tests, docs
commit fc7b7f13f19bb8f183522a13d5726253eaae83d0
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 12:20:15 2021 +0300
home: fix whois test </s> remove var err error
Context.dnsServer, err = dnsforward.NewServer(dnsforward.DNSCreateParams{})
require.NoError(t, err)
</s> add // Read implements net.Conn interface for *fakeConn. It puts the content of
// c.data field into b up to the b's capacity.
func (c *fakeConn) Read(b []byte) (n int, err error) {
return copy(b, c.data), io.EOF
} </s> remove config.DNS.Port = 1234
</s> add // Write implements net.Conn interface for *fakeConn. It always returns 0 and a
// nil error without mutating the slice.
func (c *fakeConn) Write(_ []byte) (n int, err error) {
return 0, nil
} </s> remove err = Context.dnsServer.Prepare(conf)
require.NoError(t, err)
</s> add // SetReadDeadline implements net.Conn interface for *fakeConn. It always
// returns nil.
func (c *fakeConn) SetReadDeadline(_ time.Time) (err error) {
return nil
}
// fakeDial is a mock implementation of customDialContext to simplify testing.
func (c *fakeConn) fakeDial(ctx context.Context, network, addr string) (conn net.Conn, err error) {
return c, nil </s> remove func prepareTestDNSServer(t *testing.T) {
t.Helper()
</s> add // fakeConn is a mock implementation of net.Conn to simplify testing.
//
// TODO(e.burkov): Search for other places in code where it may be used. Move
// into aghtest then.
type fakeConn struct {
// Conn is embedded here simply to make *fakeConn a net.Conn without
// actually implementing all methods.
net.Conn
data []byte
} </s> remove // TODO(e.burkov): It's kind of complicated to get rid of network access in this
// test. The thing is that *Whois creates new *net.Dialer each time it requests
// the server, so it becomes hard to simulate handling of request from test even
// with substituted upstream. However, it must be done.
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4165e0ef3a751383f1dd28b13a4086e3c1eb8cba | internal/home/whois_test.go |
// SetReadDeadline implements net.Conn interface for *fakeConn. It always
// returns nil.
func (c *fakeConn) SetReadDeadline(_ time.Time) (err error) {
return nil
}
// fakeDial is a mock implementation of customDialContext to simplify testing.
func (c *fakeConn) fakeDial(ctx context.Context, network, addr string) (conn net.Conn, err error) {
return c, nil | <mask>
<mask> conf := &dnsforward.ServerConfig{}
<mask> conf.UpstreamDNS = []string{"8.8.8.8"}
<mask>
<mask> err = Context.dnsServer.Prepare(conf)
<mask> require.NoError(t, err)
<mask> }
<mask>
<mask> // TODO(e.burkov): It's kind of complicated to get rid of network access in this
<mask> // test. The thing is that *Whois creates new *net.Dialer each time it requests
<mask> // the server, so it becomes hard to simulate handling of request from test even
</s> Pull request: 2574 external tests vol.4
Merge in DNS/adguard-home from 2574-external-tests-4 to master
Close #2574.
Squashed commit of the following:
commit 0d06fce604750f76f4a319b2539105e936a248ce
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 13:26:25 2021 +0300
home: imp tests, docs
commit fc7b7f13f19bb8f183522a13d5726253eaae83d0
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 12:20:15 2021 +0300
home: fix whois test </s> remove // TODO(e.burkov): It's kind of complicated to get rid of network access in this
// test. The thing is that *Whois creates new *net.Dialer each time it requests
// the server, so it becomes hard to simulate handling of request from test even
// with substituted upstream. However, it must be done.
</s> add </s> remove prepareTestDNSServer(t)
</s> add const (
nl = "\n"
data = `OrgName: FakeOrg LLC` + nl +
`City: Nonreal` + nl +
`Country: Imagiland` + nl
)
fc := &fakeConn{
data: []byte(data),
} </s> remove var err error
Context.dnsServer, err = dnsforward.NewServer(dnsforward.DNSCreateParams{})
require.NoError(t, err)
</s> add // Read implements net.Conn interface for *fakeConn. It puts the content of
// c.data field into b up to the b's capacity.
func (c *fakeConn) Read(b []byte) (n int, err error) {
return copy(b, c.data), io.EOF
} </s> remove conf := &dnsforward.ServerConfig{}
conf.UpstreamDNS = []string{"8.8.8.8"}
</s> add // Close implements net.Conn interface for *fakeConn. It always returns nil.
func (c *fakeConn) Close() (err error) {
return nil
} </s> remove func prepareTestDNSServer(t *testing.T) {
t.Helper()
</s> add // fakeConn is a mock implementation of net.Conn to simplify testing.
//
// TODO(e.burkov): Search for other places in code where it may be used. Move
// into aghtest then.
type fakeConn struct {
// Conn is embedded here simply to make *fakeConn a net.Conn without
// actually implementing all methods.
net.Conn
data []byte
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4165e0ef3a751383f1dd28b13a4086e3c1eb8cba | internal/home/whois_test.go |
<mask> err = Context.dnsServer.Prepare(conf)
<mask> require.NoError(t, err)
<mask> }
<mask>
<mask> // TODO(e.burkov): It's kind of complicated to get rid of network access in this
<mask> // test. The thing is that *Whois creates new *net.Dialer each time it requests
<mask> // the server, so it becomes hard to simulate handling of request from test even
<mask> // with substituted upstream. However, it must be done.
<mask> func TestWhois(t *testing.T) {
<mask> prepareTestDNSServer(t)
<mask>
<mask> w := Whois{timeoutMsec: 5000}
<mask> resp, err := w.queryAll(context.Background(), "8.8.8.8")
</s> Pull request: 2574 external tests vol.4
Merge in DNS/adguard-home from 2574-external-tests-4 to master
Close #2574.
Squashed commit of the following:
commit 0d06fce604750f76f4a319b2539105e936a248ce
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 13:26:25 2021 +0300
home: imp tests, docs
commit fc7b7f13f19bb8f183522a13d5726253eaae83d0
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 12:20:15 2021 +0300
home: fix whois test </s> remove prepareTestDNSServer(t)
</s> add const (
nl = "\n"
data = `OrgName: FakeOrg LLC` + nl +
`City: Nonreal` + nl +
`Country: Imagiland` + nl
)
fc := &fakeConn{
data: []byte(data),
} </s> remove err = Context.dnsServer.Prepare(conf)
require.NoError(t, err)
</s> add // SetReadDeadline implements net.Conn interface for *fakeConn. It always
// returns nil.
func (c *fakeConn) SetReadDeadline(_ time.Time) (err error) {
return nil
}
// fakeDial is a mock implementation of customDialContext to simplify testing.
func (c *fakeConn) fakeDial(ctx context.Context, network, addr string) (conn net.Conn, err error) {
return c, nil </s> remove w := Whois{timeoutMsec: 5000}
resp, err := w.queryAll(context.Background(), "8.8.8.8")
</s> add w := Whois{
timeoutMsec: 5000,
dialContext: fc.fakeDial,
}
resp, err := w.queryAll(context.Background(), "1.2.3.4") </s> remove func prepareTestDNSServer(t *testing.T) {
t.Helper()
</s> add // fakeConn is a mock implementation of net.Conn to simplify testing.
//
// TODO(e.burkov): Search for other places in code where it may be used. Move
// into aghtest then.
type fakeConn struct {
// Conn is embedded here simply to make *fakeConn a net.Conn without
// actually implementing all methods.
net.Conn
data []byte
} </s> remove var err error
Context.dnsServer, err = dnsforward.NewServer(dnsforward.DNSCreateParams{})
require.NoError(t, err)
</s> add // Read implements net.Conn interface for *fakeConn. It puts the content of
// c.data field into b up to the b's capacity.
func (c *fakeConn) Read(b []byte) (n int, err error) {
return copy(b, c.data), io.EOF
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4165e0ef3a751383f1dd28b13a4086e3c1eb8cba | internal/home/whois_test.go |
|
const (
nl = "\n"
data = `OrgName: FakeOrg LLC` + nl +
`City: Nonreal` + nl +
`Country: Imagiland` + nl
)
fc := &fakeConn{
data: []byte(data),
} | <mask> // test. The thing is that *Whois creates new *net.Dialer each time it requests
<mask> // the server, so it becomes hard to simulate handling of request from test even
<mask> // with substituted upstream. However, it must be done.
<mask> func TestWhois(t *testing.T) {
<mask> prepareTestDNSServer(t)
<mask>
<mask> w := Whois{timeoutMsec: 5000}
<mask> resp, err := w.queryAll(context.Background(), "8.8.8.8")
<mask> assert.NoError(t, err)
<mask>
</s> Pull request: 2574 external tests vol.4
Merge in DNS/adguard-home from 2574-external-tests-4 to master
Close #2574.
Squashed commit of the following:
commit 0d06fce604750f76f4a319b2539105e936a248ce
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 13:26:25 2021 +0300
home: imp tests, docs
commit fc7b7f13f19bb8f183522a13d5726253eaae83d0
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 12:20:15 2021 +0300
home: fix whois test </s> remove // TODO(e.burkov): It's kind of complicated to get rid of network access in this
// test. The thing is that *Whois creates new *net.Dialer each time it requests
// the server, so it becomes hard to simulate handling of request from test even
// with substituted upstream. However, it must be done.
</s> add </s> remove w := Whois{timeoutMsec: 5000}
resp, err := w.queryAll(context.Background(), "8.8.8.8")
</s> add w := Whois{
timeoutMsec: 5000,
dialContext: fc.fakeDial,
}
resp, err := w.queryAll(context.Background(), "1.2.3.4") </s> remove err = Context.dnsServer.Prepare(conf)
require.NoError(t, err)
</s> add // SetReadDeadline implements net.Conn interface for *fakeConn. It always
// returns nil.
func (c *fakeConn) SetReadDeadline(_ time.Time) (err error) {
return nil
}
// fakeDial is a mock implementation of customDialContext to simplify testing.
func (c *fakeConn) fakeDial(ctx context.Context, network, addr string) (conn net.Conn, err error) {
return c, nil </s> remove func prepareTestDNSServer(t *testing.T) {
t.Helper()
</s> add // fakeConn is a mock implementation of net.Conn to simplify testing.
//
// TODO(e.burkov): Search for other places in code where it may be used. Move
// into aghtest then.
type fakeConn struct {
// Conn is embedded here simply to make *fakeConn a net.Conn without
// actually implementing all methods.
net.Conn
data []byte
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4165e0ef3a751383f1dd28b13a4086e3c1eb8cba | internal/home/whois_test.go |
w := Whois{
timeoutMsec: 5000,
dialContext: fc.fakeDial,
}
resp, err := w.queryAll(context.Background(), "1.2.3.4") | <mask> // with substituted upstream. However, it must be done.
<mask> func TestWhois(t *testing.T) {
<mask> prepareTestDNSServer(t)
<mask>
<mask> w := Whois{timeoutMsec: 5000}
<mask> resp, err := w.queryAll(context.Background(), "8.8.8.8")
<mask> assert.NoError(t, err)
<mask>
<mask> m := whoisParse(resp)
<mask> require.NotEmpty(t, m)
<mask>
</s> Pull request: 2574 external tests vol.4
Merge in DNS/adguard-home from 2574-external-tests-4 to master
Close #2574.
Squashed commit of the following:
commit 0d06fce604750f76f4a319b2539105e936a248ce
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 13:26:25 2021 +0300
home: imp tests, docs
commit fc7b7f13f19bb8f183522a13d5726253eaae83d0
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 12:20:15 2021 +0300
home: fix whois test </s> remove // TODO(e.burkov): It's kind of complicated to get rid of network access in this
// test. The thing is that *Whois creates new *net.Dialer each time it requests
// the server, so it becomes hard to simulate handling of request from test even
// with substituted upstream. However, it must be done.
</s> add </s> remove prepareTestDNSServer(t)
</s> add const (
nl = "\n"
data = `OrgName: FakeOrg LLC` + nl +
`City: Nonreal` + nl +
`Country: Imagiland` + nl
)
fc := &fakeConn{
data: []byte(data),
} </s> remove assert.Equal(t, "Google LLC", m["orgname"])
assert.Equal(t, "US", m["country"])
assert.Equal(t, "Mountain View", m["city"])
</s> add assert.Equal(t, "FakeOrg LLC", m["orgname"])
assert.Equal(t, "Imagiland", m["country"])
assert.Equal(t, "Nonreal", m["city"]) </s> remove // Connect to a remote server resolving hostname using our own DNS server
</s> add // Connect to a remote server resolving hostname using our own DNS server.
//
// TODO(e.burkov): This messy logic should be decomposed and clarified. </s> remove conf := &dnsforward.ServerConfig{}
conf.UpstreamDNS = []string{"8.8.8.8"}
</s> add // Close implements net.Conn interface for *fakeConn. It always returns nil.
func (c *fakeConn) Close() (err error) {
return nil
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4165e0ef3a751383f1dd28b13a4086e3c1eb8cba | internal/home/whois_test.go |
assert.Equal(t, "FakeOrg LLC", m["orgname"])
assert.Equal(t, "Imagiland", m["country"])
assert.Equal(t, "Nonreal", m["city"]) | <mask>
<mask> m := whoisParse(resp)
<mask> require.NotEmpty(t, m)
<mask>
<mask> assert.Equal(t, "Google LLC", m["orgname"])
<mask> assert.Equal(t, "US", m["country"])
<mask> assert.Equal(t, "Mountain View", m["city"])
<mask> }
</s> Pull request: 2574 external tests vol.4
Merge in DNS/adguard-home from 2574-external-tests-4 to master
Close #2574.
Squashed commit of the following:
commit 0d06fce604750f76f4a319b2539105e936a248ce
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 13:26:25 2021 +0300
home: imp tests, docs
commit fc7b7f13f19bb8f183522a13d5726253eaae83d0
Author: Eugene Burkov <[email protected]>
Date: Thu Apr 22 12:20:15 2021 +0300
home: fix whois test </s> remove w := Whois{timeoutMsec: 5000}
resp, err := w.queryAll(context.Background(), "8.8.8.8")
</s> add w := Whois{
timeoutMsec: 5000,
dialContext: fc.fakeDial,
}
resp, err := w.queryAll(context.Background(), "1.2.3.4") </s> remove conn, err := customDialContext(ctx, "tcp", serverAddr)
</s> add conn, err := w.dialContext(ctx, "tcp", serverAddr) </s> remove conf := &dnsforward.ServerConfig{}
conf.UpstreamDNS = []string{"8.8.8.8"}
</s> add // Close implements net.Conn interface for *fakeConn. It always returns nil.
func (c *fakeConn) Close() (err error) {
return nil
} </s> remove prepareTestDNSServer(t)
</s> add const (
nl = "\n"
data = `OrgName: FakeOrg LLC` + nl +
`City: Nonreal` + nl +
`Country: Imagiland` + nl
)
fc := &fakeConn{
data: []byte(data),
} </s> remove // Connect to a remote server resolving hostname using our own DNS server
</s> add // Connect to a remote server resolving hostname using our own DNS server.
//
// TODO(e.burkov): This messy logic should be decomposed and clarified. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4165e0ef3a751383f1dd28b13a4086e3c1eb8cba | internal/home/whois_test.go |
"click_to_view_queries": "Click to view queries",
"port_53_faq_link": "Port 53 is often occupied by \"DNSStubListener\" or \"systemd-resolved\" services. Please read <0>this instruction</0> on how to resolve this." | <mask> "filter_category_security_desc": "Lists that specialize on blocking malware, phishing or scam domains",
<mask> "filter_category_regional_desc": "Lists that focus on regional ads and tracking servers",
<mask> "filter_category_other_desc": "Other blocklists",
<mask> "original_response": "Original response",
<mask> "click_to_view_queries": "Click to view queries"
<mask> }
</s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use
Close #1889
Squashed commit of the following:
commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:28:38 2020 +0300
Revert "Update locales"
This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b.
commit dd88f8047e612022678dfabe8dda446c4b8f201b
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:26:00 2020 +0300
Update locales
commit 954ae2e97e988b53856766100c873e6d40b75123
Merge: 28f205a8 c1e56c83
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:23:50 2020 +0300
Merge branch 'master' into feature/1889
commit 28f205a858281811af7d708356e10108983c7292
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:39:57 2020 +0300
Rename systemdns-resolved ---> systemd-resolved
commit 3d62e26984f73285a7b788b6f42efcb3376ae562
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:15:10 2020 +0300
Add commas to port 53 locale
commit 457563085186244dca36a80a959e5a9486558299
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:34:13 2020 +0300
minor
commit 7aacf879951f8ab619824730cb28ea5cd2518812
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:27:55 2020 +0300
+ client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove import React, { Component, Fragment } from 'react';
</s> add import React, { Component } from 'react'; </s> remove import { ALL_INTERFACES_IP, FORM_NAME } from '../../helpers/constants';
</s> add import {
ALL_INTERFACES_IP, FORM_NAME, ADDRESS_IN_USE_TEXT, PORT_53_FAQ_LINK, UBUNTU_SYSTEM_PORT,
} from '../../helpers/constants'; </s> remove </button>
}
<hr className="divider--small" />
</div>
}
</s> add </button>}
</div>}
<hr className="divider--small" /> </s> remove return (
<option value={ip} key={name}>
{name} - {ip}
</option>
);
}
return false;
})
</s> add return false;
}) </s> remove <Fragment>
</s> add <> | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9 | client/src/__locales/en.json |
export const PORT_53_FAQ_LINK = 'https://github.com/AdguardTeam/AdGuardHome/wiki/FAQ#bindinuse';
export const ADDRESS_IN_USE_TEXT = 'address already in use';
export const UBUNTU_SYSTEM_PORT = 53; | <mask>
<mask> export const PRIVACY_POLICY_LINK = 'https://adguard.com/privacy/home.html';
<mask>
<mask> export const INSTALL_FIRST_STEP = 1;
<mask> export const INSTALL_TOTAL_STEPS = 5;
<mask>
<mask> export const SETTINGS_NAMES = {
</s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use
Close #1889
Squashed commit of the following:
commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:28:38 2020 +0300
Revert "Update locales"
This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b.
commit dd88f8047e612022678dfabe8dda446c4b8f201b
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:26:00 2020 +0300
Update locales
commit 954ae2e97e988b53856766100c873e6d40b75123
Merge: 28f205a8 c1e56c83
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:23:50 2020 +0300
Merge branch 'master' into feature/1889
commit 28f205a858281811af7d708356e10108983c7292
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:39:57 2020 +0300
Rename systemdns-resolved ---> systemd-resolved
commit 3d62e26984f73285a7b788b6f42efcb3376ae562
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:15:10 2020 +0300
Add commas to port 53 locale
commit 457563085186244dca36a80a959e5a9486558299
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:34:13 2020 +0300
minor
commit 7aacf879951f8ab619824730cb28ea5cd2518812
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:27:55 2020 +0300
+ client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove Object.keys(interfaces).map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
</s> add Object.keys(interfaces)
.map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
if (isDown) {
return (
<option value={ip} key={name} disabled>
<>
{name} - {ip} (<Trans>down</Trans>)
</>
</option>
);
} </s> remove const web = { ip: webIp, port: webPort, autofix: false };
const dns = { ip: dnsIp, port: dnsPort, autofix: false };
</s> add const web = {
ip: webIp,
port: webPort,
autofix: false,
};
const dns = {
ip: dnsIp,
port: dnsPort,
autofix: false,
}; </s> remove const web = { ip: webIp, port: webPort, autofix: false };
const dns = { ip: dnsIp, port: dnsPort, autofix: false };
</s> add const web = {
ip: webIp,
port: webPort,
autofix: false,
};
const dns = {
ip: dnsIp,
port: dnsPort,
autofix: false,
}; </s> remove if (isDown) {
</s> add </s> remove </Fragment>
</s> add </> | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9 | client/src/helpers/constants.js |
import React, { Component } from 'react'; | <mask> import React, { Component, Fragment } from 'react';
<mask> import { connect } from 'react-redux';
<mask> import PropTypes from 'prop-types';
<mask> import { Field, reduxForm, formValueSelector } from 'redux-form';
<mask> import { Trans, withTranslation } from 'react-i18next';
<mask> import flow from 'lodash/flow';
</s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use
Close #1889
Squashed commit of the following:
commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:28:38 2020 +0300
Revert "Update locales"
This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b.
commit dd88f8047e612022678dfabe8dda446c4b8f201b
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:26:00 2020 +0300
Update locales
commit 954ae2e97e988b53856766100c873e6d40b75123
Merge: 28f205a8 c1e56c83
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:23:50 2020 +0300
Merge branch 'master' into feature/1889
commit 28f205a858281811af7d708356e10108983c7292
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:39:57 2020 +0300
Rename systemdns-resolved ---> systemd-resolved
commit 3d62e26984f73285a7b788b6f42efcb3376ae562
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:15:10 2020 +0300
Add commas to port 53 locale
commit 457563085186244dca36a80a959e5a9486558299
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:34:13 2020 +0300
minor
commit 7aacf879951f8ab619824730cb28ea5cd2518812
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:27:55 2020 +0300
+ client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove import { ALL_INTERFACES_IP, FORM_NAME } from '../../helpers/constants';
</s> add import {
ALL_INTERFACES_IP, FORM_NAME, ADDRESS_IN_USE_TEXT, PORT_53_FAQ_LINK, UBUNTU_SYSTEM_PORT,
} from '../../helpers/constants'; </s> remove return (
<option value={ip} key={name}>
{name} - {ip}
</option>
);
}
return false;
})
</s> add return false;
}) </s> remove const web = { ip: webIp, port: webPort, autofix: false };
const dns = { ip: dnsIp, port: dnsPort, autofix: false };
</s> add const web = {
ip: webIp,
port: webPort,
autofix: false,
};
const dns = {
ip: dnsIp,
port: dnsPort,
autofix: false,
}; </s> remove const web = { ip: webIp, port: webPort, autofix: false };
const dns = { ip: dnsIp, port: dnsPort, autofix: false };
</s> add const web = {
ip: webIp,
port: webPort,
autofix: false,
};
const dns = {
ip: dnsIp,
port: dnsPort,
autofix: false,
}; </s> remove Object.keys(interfaces).map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
</s> add Object.keys(interfaces)
.map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
if (isDown) {
return (
<option value={ip} key={name} disabled>
<>
{name} - {ip} (<Trans>down</Trans>)
</>
</option>
);
} | [
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9 | client/src/install/Setup/Settings.js |
import {
ALL_INTERFACES_IP, FORM_NAME, ADDRESS_IN_USE_TEXT, PORT_53_FAQ_LINK, UBUNTU_SYSTEM_PORT,
} from '../../helpers/constants'; | <mask> import Controls from './Controls';
<mask> import AddressList from './AddressList';
<mask>
<mask> import { getInterfaceIp } from '../../helpers/helpers';
<mask> import { ALL_INTERFACES_IP, FORM_NAME } from '../../helpers/constants';
<mask> import { renderInputField, toNumber } from '../../helpers/form';
<mask> import { validateRequiredValue, validateInstallPort } from '../../helpers/validators';
<mask>
<mask> const STATIC_STATUS = {
<mask> ENABLED: 'yes',
</s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use
Close #1889
Squashed commit of the following:
commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:28:38 2020 +0300
Revert "Update locales"
This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b.
commit dd88f8047e612022678dfabe8dda446c4b8f201b
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:26:00 2020 +0300
Update locales
commit 954ae2e97e988b53856766100c873e6d40b75123
Merge: 28f205a8 c1e56c83
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:23:50 2020 +0300
Merge branch 'master' into feature/1889
commit 28f205a858281811af7d708356e10108983c7292
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:39:57 2020 +0300
Rename systemdns-resolved ---> systemd-resolved
commit 3d62e26984f73285a7b788b6f42efcb3376ae562
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:15:10 2020 +0300
Add commas to port 53 locale
commit 457563085186244dca36a80a959e5a9486558299
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:34:13 2020 +0300
minor
commit 7aacf879951f8ab619824730cb28ea5cd2518812
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:27:55 2020 +0300
+ client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove import React, { Component, Fragment } from 'react';
</s> add import React, { Component } from 'react'; </s> remove return (
<option value={ip} key={name}>
{name} - {ip}
</option>
);
}
return false;
})
</s> add return false;
}) </s> remove const web = { ip: webIp, port: webPort, autofix: false };
const dns = { ip: dnsIp, port: dnsPort, autofix: false };
</s> add const web = {
ip: webIp,
port: webPort,
autofix: false,
};
const dns = {
ip: dnsIp,
port: dnsPort,
autofix: false,
}; </s> remove Object.keys(interfaces).map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
</s> add Object.keys(interfaces)
.map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
if (isDown) {
return (
<option value={ip} key={name} disabled>
<>
{name} - {ip} (<Trans>down</Trans>)
</>
</option>
);
} </s> remove const web = { ip: webIp, port: webPort, autofix: false };
const dns = { ip: dnsIp, port: dnsPort, autofix: false };
</s> add const web = {
ip: webIp,
port: webPort,
autofix: false,
};
const dns = {
ip: dnsIp,
port: dnsPort,
autofix: false,
}; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9 | client/src/install/Setup/Settings.js |
Object.keys(interfaces)
.map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
if (isDown) {
return (
<option value={ip} key={name} disabled>
<>
{name} - {ip} (<Trans>down</Trans>)
</>
</option>
);
} | <mask> ERROR: 'error',
<mask> };
<mask>
<mask> const renderInterfaces = ((interfaces) => (
<mask> Object.keys(interfaces).map((item) => {
<mask> const option = interfaces[item];
<mask> const {
<mask> name,
<mask> ip_addresses,
<mask> flags,
<mask> } = option;
<mask>
<mask> if (option && ip_addresses?.length > 0) {
<mask> const ip = getInterfaceIp(option);
<mask> const isDown = flags?.includes('down');
<mask>
<mask> if (isDown) {
<mask> return (
<mask> <option value={ip} key={name} disabled>
<mask> <Fragment>
</s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use
Close #1889
Squashed commit of the following:
commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:28:38 2020 +0300
Revert "Update locales"
This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b.
commit dd88f8047e612022678dfabe8dda446c4b8f201b
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:26:00 2020 +0300
Update locales
commit 954ae2e97e988b53856766100c873e6d40b75123
Merge: 28f205a8 c1e56c83
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:23:50 2020 +0300
Merge branch 'master' into feature/1889
commit 28f205a858281811af7d708356e10108983c7292
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:39:57 2020 +0300
Rename systemdns-resolved ---> systemd-resolved
commit 3d62e26984f73285a7b788b6f42efcb3376ae562
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:15:10 2020 +0300
Add commas to port 53 locale
commit 457563085186244dca36a80a959e5a9486558299
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:34:13 2020 +0300
minor
commit 7aacf879951f8ab619824730cb28ea5cd2518812
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:27:55 2020 +0300
+ client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove if (isDown) {
</s> add </s> remove <option value={ip} key={name} disabled>
<Fragment>
{name} - {ip} (<Trans>down</Trans>)
</Fragment>
</s> add <option value={ip} key={name}>
{name} - {ip} </s> remove const web = { ip: webIp, port: webPort, autofix: false };
const dns = { ip: dnsIp, port: dnsPort, autofix: false };
</s> add const web = {
ip: webIp,
port: webPort,
autofix: false,
};
const dns = {
ip: dnsIp,
port: dnsPort,
autofix: false,
}; </s> remove const web = { ip: webIp, port: webPort, autofix: false };
const dns = { ip: dnsIp, port: dnsPort, autofix: false };
</s> add const web = {
ip: webIp,
port: webPort,
autofix: false,
};
const dns = {
ip: dnsIp,
port: dnsPort,
autofix: false,
}; </s> remove </Fragment>
</s> add </> | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9 | client/src/install/Setup/Settings.js |
<mask> if (option && ip_addresses?.length > 0) {
<mask> const ip = getInterfaceIp(option);
<mask> const isDown = flags?.includes('down');
<mask>
<mask> if (isDown) {
<mask> return (
<mask> <option value={ip} key={name} disabled>
<mask> <Fragment>
<mask> {name} - {ip} (<Trans>down</Trans>)
<mask> </Fragment>
</s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use
Close #1889
Squashed commit of the following:
commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:28:38 2020 +0300
Revert "Update locales"
This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b.
commit dd88f8047e612022678dfabe8dda446c4b8f201b
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:26:00 2020 +0300
Update locales
commit 954ae2e97e988b53856766100c873e6d40b75123
Merge: 28f205a8 c1e56c83
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:23:50 2020 +0300
Merge branch 'master' into feature/1889
commit 28f205a858281811af7d708356e10108983c7292
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:39:57 2020 +0300
Rename systemdns-resolved ---> systemd-resolved
commit 3d62e26984f73285a7b788b6f42efcb3376ae562
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:15:10 2020 +0300
Add commas to port 53 locale
commit 457563085186244dca36a80a959e5a9486558299
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:34:13 2020 +0300
minor
commit 7aacf879951f8ab619824730cb28ea5cd2518812
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:27:55 2020 +0300
+ client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove Object.keys(interfaces).map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
</s> add Object.keys(interfaces)
.map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
if (isDown) {
return (
<option value={ip} key={name} disabled>
<>
{name} - {ip} (<Trans>down</Trans>)
</>
</option>
);
} </s> remove <option value={ip} key={name} disabled>
<Fragment>
{name} - {ip} (<Trans>down</Trans>)
</Fragment>
</s> add <option value={ip} key={name}>
{name} - {ip} </s> remove return (
<option value={ip} key={name}>
{name} - {ip}
</option>
);
}
return false;
})
</s> add return false;
}) </s> remove const web = { ip: webIp, port: webPort, autofix: false };
const dns = { ip: dnsIp, port: dnsPort, autofix: false };
</s> add const web = {
ip: webIp,
port: webPort,
autofix: false,
};
const dns = {
ip: dnsIp,
port: dnsPort,
autofix: false,
}; </s> remove const web = { ip: webIp, port: webPort, autofix: false };
const dns = { ip: dnsIp, port: dnsPort, autofix: false };
</s> add const web = {
ip: webIp,
port: webPort,
autofix: false,
};
const dns = {
ip: dnsIp,
port: dnsPort,
autofix: false,
}; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9 | client/src/install/Setup/Settings.js |
|
<option value={ip} key={name}>
{name} - {ip} | <mask> const isDown = flags?.includes('down');
<mask>
<mask> if (isDown) {
<mask> return (
<mask> <option value={ip} key={name} disabled>
<mask> <Fragment>
<mask> {name} - {ip} (<Trans>down</Trans>)
<mask> </Fragment>
<mask> </option>
<mask> );
<mask> }
<mask>
<mask> return (
</s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use
Close #1889
Squashed commit of the following:
commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:28:38 2020 +0300
Revert "Update locales"
This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b.
commit dd88f8047e612022678dfabe8dda446c4b8f201b
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:26:00 2020 +0300
Update locales
commit 954ae2e97e988b53856766100c873e6d40b75123
Merge: 28f205a8 c1e56c83
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:23:50 2020 +0300
Merge branch 'master' into feature/1889
commit 28f205a858281811af7d708356e10108983c7292
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:39:57 2020 +0300
Rename systemdns-resolved ---> systemd-resolved
commit 3d62e26984f73285a7b788b6f42efcb3376ae562
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:15:10 2020 +0300
Add commas to port 53 locale
commit 457563085186244dca36a80a959e5a9486558299
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:34:13 2020 +0300
minor
commit 7aacf879951f8ab619824730cb28ea5cd2518812
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:27:55 2020 +0300
+ client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove if (isDown) {
</s> add </s> remove Object.keys(interfaces).map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
</s> add Object.keys(interfaces)
.map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
if (isDown) {
return (
<option value={ip} key={name} disabled>
<>
{name} - {ip} (<Trans>down</Trans>)
</>
</option>
);
} </s> remove return (
<option value={ip} key={name}>
{name} - {ip}
</option>
);
}
return false;
})
</s> add return false;
}) </s> remove <Fragment>
</s> add <> </s> remove </Fragment>
</s> add </> | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9 | client/src/install/Setup/Settings.js |
return false;
}) | <mask> </option>
<mask> );
<mask> }
<mask>
<mask> return (
<mask> <option value={ip} key={name}>
<mask> {name} - {ip}
<mask> </option>
<mask> );
<mask> }
<mask>
<mask> return false;
<mask> })
<mask> ));
<mask>
<mask> class Settings extends Component {
<mask> componentDidMount() {
<mask> const {
</s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use
Close #1889
Squashed commit of the following:
commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:28:38 2020 +0300
Revert "Update locales"
This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b.
commit dd88f8047e612022678dfabe8dda446c4b8f201b
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:26:00 2020 +0300
Update locales
commit 954ae2e97e988b53856766100c873e6d40b75123
Merge: 28f205a8 c1e56c83
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:23:50 2020 +0300
Merge branch 'master' into feature/1889
commit 28f205a858281811af7d708356e10108983c7292
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:39:57 2020 +0300
Rename systemdns-resolved ---> systemd-resolved
commit 3d62e26984f73285a7b788b6f42efcb3376ae562
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:15:10 2020 +0300
Add commas to port 53 locale
commit 457563085186244dca36a80a959e5a9486558299
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:34:13 2020 +0300
minor
commit 7aacf879951f8ab619824730cb28ea5cd2518812
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:27:55 2020 +0300
+ client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove <option value={ip} key={name} disabled>
<Fragment>
{name} - {ip} (<Trans>down</Trans>)
</Fragment>
</s> add <option value={ip} key={name}>
{name} - {ip} </s> remove Object.keys(interfaces).map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
</s> add Object.keys(interfaces)
.map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
if (isDown) {
return (
<option value={ip} key={name} disabled>
<>
{name} - {ip} (<Trans>down</Trans>)
</>
</option>
);
} </s> remove if (isDown) {
</s> add </s> remove import React, { Component, Fragment } from 'react';
</s> add import React, { Component } from 'react'; </s> remove </Fragment>
</s> add </> | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9 | client/src/install/Setup/Settings.js |
<> | <mask> return '';
<mask> }
<mask>
<mask> return (
<mask> <Fragment>
<mask> {status === STATIC_STATUS.DISABLED && (
<mask> <Fragment>
<mask> <div className="mb-2">
<mask> <Trans values={{ ip }} components={[<strong key="0">text</strong>]}>
<mask> install_static_configure
</s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use
Close #1889
Squashed commit of the following:
commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:28:38 2020 +0300
Revert "Update locales"
This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b.
commit dd88f8047e612022678dfabe8dda446c4b8f201b
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:26:00 2020 +0300
Update locales
commit 954ae2e97e988b53856766100c873e6d40b75123
Merge: 28f205a8 c1e56c83
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:23:50 2020 +0300
Merge branch 'master' into feature/1889
commit 28f205a858281811af7d708356e10108983c7292
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:39:57 2020 +0300
Rename systemdns-resolved ---> systemd-resolved
commit 3d62e26984f73285a7b788b6f42efcb3376ae562
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:15:10 2020 +0300
Add commas to port 53 locale
commit 457563085186244dca36a80a959e5a9486558299
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:34:13 2020 +0300
minor
commit 7aacf879951f8ab619824730cb28ea5cd2518812
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:27:55 2020 +0300
+ client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove <Fragment>
</s> add <> </s> remove </Fragment>
</s> add </> </s> remove <option value={ip} key={name} disabled>
<Fragment>
{name} - {ip} (<Trans>down</Trans>)
</Fragment>
</s> add <option value={ip} key={name}>
{name} - {ip} </s> remove if (isDown) {
</s> add </s> remove Object.keys(interfaces).map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
</s> add Object.keys(interfaces)
.map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
if (isDown) {
return (
<option value={ip} key={name} disabled>
<>
{name} - {ip} (<Trans>down</Trans>)
</>
</option>
);
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9 | client/src/install/Setup/Settings.js |
<> | <mask>
<mask> return (
<mask> <Fragment>
<mask> {status === STATIC_STATUS.DISABLED && (
<mask> <Fragment>
<mask> <div className="mb-2">
<mask> <Trans values={{ ip }} components={[<strong key="0">text</strong>]}>
<mask> install_static_configure
<mask> </Trans>
<mask> </div>
</s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use
Close #1889
Squashed commit of the following:
commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:28:38 2020 +0300
Revert "Update locales"
This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b.
commit dd88f8047e612022678dfabe8dda446c4b8f201b
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:26:00 2020 +0300
Update locales
commit 954ae2e97e988b53856766100c873e6d40b75123
Merge: 28f205a8 c1e56c83
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:23:50 2020 +0300
Merge branch 'master' into feature/1889
commit 28f205a858281811af7d708356e10108983c7292
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:39:57 2020 +0300
Rename systemdns-resolved ---> systemd-resolved
commit 3d62e26984f73285a7b788b6f42efcb3376ae562
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:15:10 2020 +0300
Add commas to port 53 locale
commit 457563085186244dca36a80a959e5a9486558299
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:34:13 2020 +0300
minor
commit 7aacf879951f8ab619824730cb28ea5cd2518812
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:27:55 2020 +0300
+ client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove <Fragment>
</s> add <> </s> remove </Fragment>
</s> add </> </s> remove <hr className="divider--small" />
</Fragment>
}
</s> add </>}
{dnsPort === UBUNTU_SYSTEM_PORT && !isDnsFixAvailable
&& dnsStatus.includes(ADDRESS_IN_USE_TEXT)
&& <Trans
components={[<a href={PORT_53_FAQ_LINK} key="0">link</a>]}>
port_53_faq_link
</Trans>}
<hr className="divider--small" /> </s> remove && <Fragment>
</s> add && <> </s> remove if (isDown) {
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9 | client/src/install/Setup/Settings.js |
</> | <mask> onClick={() => this.handleStaticIp(ip)}
<mask> >
<mask> <Trans>set_static_ip</Trans>
<mask> </button>
<mask> </Fragment>
<mask> )}
<mask> {status === STATIC_STATUS.ERROR && (
<mask> <div className="text-danger">
<mask> <Trans>install_static_error</Trans>
<mask> </div>
</s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use
Close #1889
Squashed commit of the following:
commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:28:38 2020 +0300
Revert "Update locales"
This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b.
commit dd88f8047e612022678dfabe8dda446c4b8f201b
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:26:00 2020 +0300
Update locales
commit 954ae2e97e988b53856766100c873e6d40b75123
Merge: 28f205a8 c1e56c83
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:23:50 2020 +0300
Merge branch 'master' into feature/1889
commit 28f205a858281811af7d708356e10108983c7292
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:39:57 2020 +0300
Rename systemdns-resolved ---> systemd-resolved
commit 3d62e26984f73285a7b788b6f42efcb3376ae562
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:15:10 2020 +0300
Add commas to port 53 locale
commit 457563085186244dca36a80a959e5a9486558299
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:34:13 2020 +0300
minor
commit 7aacf879951f8ab619824730cb28ea5cd2518812
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:27:55 2020 +0300
+ client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove </button>
}
<hr className="divider--small" />
</div>
}
</s> add </button>}
</div>}
<hr className="divider--small" /> </s> remove </Fragment>
</s> add </> </s> remove <Fragment>
</s> add <> </s> remove <Fragment>
</s> add <> </s> remove <hr className="divider--small" />
</Fragment>
}
</s> add </>}
{dnsPort === UBUNTU_SYSTEM_PORT && !isDnsFixAvailable
&& dnsStatus.includes(ADDRESS_IN_USE_TEXT)
&& <Trans
components={[<a href={PORT_53_FAQ_LINK} key="0">link</a>]}>
port_53_faq_link
</Trans>}
<hr className="divider--small" /> | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9 | client/src/install/Setup/Settings.js |
</> | <mask> install_static_ok
<mask> </Trans>
<mask> </div>
<mask> )}
<mask> </Fragment>
<mask> );
<mask> };
<mask>
<mask> handleAutofix = (type) => {
<mask> const {
</s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use
Close #1889
Squashed commit of the following:
commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:28:38 2020 +0300
Revert "Update locales"
This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b.
commit dd88f8047e612022678dfabe8dda446c4b8f201b
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:26:00 2020 +0300
Update locales
commit 954ae2e97e988b53856766100c873e6d40b75123
Merge: 28f205a8 c1e56c83
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:23:50 2020 +0300
Merge branch 'master' into feature/1889
commit 28f205a858281811af7d708356e10108983c7292
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:39:57 2020 +0300
Rename systemdns-resolved ---> systemd-resolved
commit 3d62e26984f73285a7b788b6f42efcb3376ae562
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:15:10 2020 +0300
Add commas to port 53 locale
commit 457563085186244dca36a80a959e5a9486558299
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:34:13 2020 +0300
minor
commit 7aacf879951f8ab619824730cb28ea5cd2518812
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:27:55 2020 +0300
+ client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove </Fragment>
</s> add </> </s> remove Object.keys(interfaces).map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
</s> add Object.keys(interfaces)
.map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
if (isDown) {
return (
<option value={ip} key={name} disabled>
<>
{name} - {ip} (<Trans>down</Trans>)
</>
</option>
);
} </s> remove const web = { ip: webIp, port: webPort, autofix: false };
const dns = { ip: dnsIp, port: dnsPort, autofix: false };
</s> add const web = {
ip: webIp,
port: webPort,
autofix: false,
};
const dns = {
ip: dnsIp,
port: dnsPort,
autofix: false,
}; </s> remove const web = { ip: webIp, port: webPort, autofix: false };
const dns = { ip: dnsIp, port: dnsPort, autofix: false };
</s> add const web = {
ip: webIp,
port: webPort,
autofix: false,
};
const dns = {
ip: dnsIp,
port: dnsPort,
autofix: false,
}; </s> remove return (
<option value={ip} key={name}>
{name} - {ip}
</option>
);
}
return false;
})
</s> add return false;
}) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9 | client/src/install/Setup/Settings.js |
const web = {
ip: webIp,
port: webPort,
autofix: false,
};
const dns = {
ip: dnsIp,
port: dnsPort,
autofix: false,
}; | <mask> dnsPort,
<mask> handleFix,
<mask> } = this.props;
<mask>
<mask> const web = { ip: webIp, port: webPort, autofix: false };
<mask> const dns = { ip: dnsIp, port: dnsPort, autofix: false };
<mask> const set_static_ip = false;
<mask>
<mask> if (type === 'web') {
<mask> web.autofix = true;
<mask> } else {
</s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use
Close #1889
Squashed commit of the following:
commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:28:38 2020 +0300
Revert "Update locales"
This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b.
commit dd88f8047e612022678dfabe8dda446c4b8f201b
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:26:00 2020 +0300
Update locales
commit 954ae2e97e988b53856766100c873e6d40b75123
Merge: 28f205a8 c1e56c83
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:23:50 2020 +0300
Merge branch 'master' into feature/1889
commit 28f205a858281811af7d708356e10108983c7292
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:39:57 2020 +0300
Rename systemdns-resolved ---> systemd-resolved
commit 3d62e26984f73285a7b788b6f42efcb3376ae562
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:15:10 2020 +0300
Add commas to port 53 locale
commit 457563085186244dca36a80a959e5a9486558299
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:34:13 2020 +0300
minor
commit 7aacf879951f8ab619824730cb28ea5cd2518812
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:27:55 2020 +0300
+ client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove const web = { ip: webIp, port: webPort, autofix: false };
const dns = { ip: dnsIp, port: dnsPort, autofix: false };
</s> add const web = {
ip: webIp,
port: webPort,
autofix: false,
};
const dns = {
ip: dnsIp,
port: dnsPort,
autofix: false,
}; </s> remove Object.keys(interfaces).map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
</s> add Object.keys(interfaces)
.map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
if (isDown) {
return (
<option value={ip} key={name} disabled>
<>
{name} - {ip} (<Trans>down</Trans>)
</>
</option>
);
} </s> remove return (
<option value={ip} key={name}>
{name} - {ip}
</option>
);
}
return false;
})
</s> add return false;
}) </s> remove </Fragment>
</s> add </> </s> remove import { ALL_INTERFACES_IP, FORM_NAME } from '../../helpers/constants';
</s> add import {
ALL_INTERFACES_IP, FORM_NAME, ADDRESS_IN_USE_TEXT, PORT_53_FAQ_LINK, UBUNTU_SYSTEM_PORT,
} from '../../helpers/constants'; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9 | client/src/install/Setup/Settings.js |
const web = {
ip: webIp,
port: webPort,
autofix: false,
};
const dns = {
ip: dnsIp,
port: dnsPort,
autofix: false,
}; | <mask> dnsPort,
<mask> handleFix,
<mask> } = this.props;
<mask>
<mask> const web = { ip: webIp, port: webPort, autofix: false };
<mask> const dns = { ip: dnsIp, port: dnsPort, autofix: false };
<mask> const set_static_ip = true;
<mask>
<mask> if (window.confirm(this.props.t('confirm_static_ip', { ip }))) {
<mask> handleFix(web, dns, set_static_ip);
<mask> }
</s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use
Close #1889
Squashed commit of the following:
commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:28:38 2020 +0300
Revert "Update locales"
This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b.
commit dd88f8047e612022678dfabe8dda446c4b8f201b
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:26:00 2020 +0300
Update locales
commit 954ae2e97e988b53856766100c873e6d40b75123
Merge: 28f205a8 c1e56c83
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:23:50 2020 +0300
Merge branch 'master' into feature/1889
commit 28f205a858281811af7d708356e10108983c7292
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:39:57 2020 +0300
Rename systemdns-resolved ---> systemd-resolved
commit 3d62e26984f73285a7b788b6f42efcb3376ae562
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:15:10 2020 +0300
Add commas to port 53 locale
commit 457563085186244dca36a80a959e5a9486558299
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:34:13 2020 +0300
minor
commit 7aacf879951f8ab619824730cb28ea5cd2518812
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:27:55 2020 +0300
+ client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove const web = { ip: webIp, port: webPort, autofix: false };
const dns = { ip: dnsIp, port: dnsPort, autofix: false };
</s> add const web = {
ip: webIp,
port: webPort,
autofix: false,
};
const dns = {
ip: dnsIp,
port: dnsPort,
autofix: false,
}; </s> remove Object.keys(interfaces).map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
</s> add Object.keys(interfaces)
.map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
if (isDown) {
return (
<option value={ip} key={name} disabled>
<>
{name} - {ip} (<Trans>down</Trans>)
</>
</option>
);
} </s> remove </Fragment>
</s> add </> </s> remove if (isDown) {
</s> add </s> remove import { ALL_INTERFACES_IP, FORM_NAME } from '../../helpers/constants';
</s> add import {
ALL_INTERFACES_IP, FORM_NAME, ADDRESS_IN_USE_TEXT, PORT_53_FAQ_LINK, UBUNTU_SYSTEM_PORT,
} from '../../helpers/constants'; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9 | client/src/install/Setup/Settings.js |
</button>}
</div>}
<hr className="divider--small" /> | <mask> className="btn btn-secondary btn-sm ml-2"
<mask> onClick={() => this.handleAutofix('web')}
<mask> >
<mask> <Trans>fix</Trans>
<mask> </button>
<mask> }
<mask> <hr className="divider--small" />
<mask> </div>
<mask> }
<mask> </div>
<mask> </div>
<mask> <div className="setup__desc">
<mask> <Trans>install_settings_interface_link</Trans>
<mask> <div className="mt-1">
</s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use
Close #1889
Squashed commit of the following:
commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:28:38 2020 +0300
Revert "Update locales"
This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b.
commit dd88f8047e612022678dfabe8dda446c4b8f201b
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:26:00 2020 +0300
Update locales
commit 954ae2e97e988b53856766100c873e6d40b75123
Merge: 28f205a8 c1e56c83
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:23:50 2020 +0300
Merge branch 'master' into feature/1889
commit 28f205a858281811af7d708356e10108983c7292
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:39:57 2020 +0300
Rename systemdns-resolved ---> systemd-resolved
commit 3d62e26984f73285a7b788b6f42efcb3376ae562
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:15:10 2020 +0300
Add commas to port 53 locale
commit 457563085186244dca36a80a959e5a9486558299
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:34:13 2020 +0300
minor
commit 7aacf879951f8ab619824730cb28ea5cd2518812
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:27:55 2020 +0300
+ client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove <hr className="divider--small" />
</Fragment>
}
</s> add </>}
{dnsPort === UBUNTU_SYSTEM_PORT && !isDnsFixAvailable
&& dnsStatus.includes(ADDRESS_IN_USE_TEXT)
&& <Trans
components={[<a href={PORT_53_FAQ_LINK} key="0">link</a>]}>
port_53_faq_link
</Trans>}
<hr className="divider--small" /> </s> remove </Fragment>
</s> add </> </s> remove && <Fragment>
</s> add && <> </s> remove </Fragment>
</s> add </> </s> remove Object.keys(interfaces).map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
</s> add Object.keys(interfaces)
.map((item) => {
const option = interfaces[item];
const {
name,
ip_addresses,
flags,
} = option;
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
if (isDown) {
return (
<option value={ip} key={name} disabled>
<>
{name} - {ip} (<Trans>down</Trans>)
</>
</option>
);
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9 | client/src/install/Setup/Settings.js |
&& <> | <mask> </div>
<mask> </div>
<mask> <div className="col-12">
<mask> {dnsStatus
<mask> && <Fragment>
<mask> <div className="setup__error text-danger">
<mask> {dnsStatus}
<mask> {isDnsFixAvailable
<mask> && <button
<mask> type="button"
</s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use
Close #1889
Squashed commit of the following:
commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:28:38 2020 +0300
Revert "Update locales"
This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b.
commit dd88f8047e612022678dfabe8dda446c4b8f201b
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:26:00 2020 +0300
Update locales
commit 954ae2e97e988b53856766100c873e6d40b75123
Merge: 28f205a8 c1e56c83
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:23:50 2020 +0300
Merge branch 'master' into feature/1889
commit 28f205a858281811af7d708356e10108983c7292
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:39:57 2020 +0300
Rename systemdns-resolved ---> systemd-resolved
commit 3d62e26984f73285a7b788b6f42efcb3376ae562
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:15:10 2020 +0300
Add commas to port 53 locale
commit 457563085186244dca36a80a959e5a9486558299
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:34:13 2020 +0300
minor
commit 7aacf879951f8ab619824730cb28ea5cd2518812
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:27:55 2020 +0300
+ client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove <Fragment>
</s> add <> </s> remove <hr className="divider--small" />
</Fragment>
}
</s> add </>}
{dnsPort === UBUNTU_SYSTEM_PORT && !isDnsFixAvailable
&& dnsStatus.includes(ADDRESS_IN_USE_TEXT)
&& <Trans
components={[<a href={PORT_53_FAQ_LINK} key="0">link</a>]}>
port_53_faq_link
</Trans>}
<hr className="divider--small" /> </s> remove </Fragment>
</s> add </> </s> remove </button>
}
<hr className="divider--small" />
</div>
}
</s> add </button>}
</div>}
<hr className="divider--small" /> </s> remove <Fragment>
</s> add <> | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9 | client/src/install/Setup/Settings.js |
</>}
{dnsPort === UBUNTU_SYSTEM_PORT && !isDnsFixAvailable
&& dnsStatus.includes(ADDRESS_IN_USE_TEXT)
&& <Trans
components={[<a href={PORT_53_FAQ_LINK} key="0">link</a>]}>
port_53_faq_link
</Trans>}
<hr className="divider--small" /> | <mask> <p className="mb-1">
<mask> <Trans>autofix_warning_result</Trans>
<mask> </p>
<mask> </div>}
<mask> <hr className="divider--small" />
<mask> </Fragment>
<mask> }
<mask> </div>
<mask> </div>
<mask> <div className="setup__desc">
<mask> <Trans>install_settings_dns_desc</Trans>
<mask> <div className="mt-1">
</s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use
Close #1889
Squashed commit of the following:
commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:28:38 2020 +0300
Revert "Update locales"
This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b.
commit dd88f8047e612022678dfabe8dda446c4b8f201b
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:26:00 2020 +0300
Update locales
commit 954ae2e97e988b53856766100c873e6d40b75123
Merge: 28f205a8 c1e56c83
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 17:23:50 2020 +0300
Merge branch 'master' into feature/1889
commit 28f205a858281811af7d708356e10108983c7292
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:39:57 2020 +0300
Rename systemdns-resolved ---> systemd-resolved
commit 3d62e26984f73285a7b788b6f42efcb3376ae562
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 15:15:10 2020 +0300
Add commas to port 53 locale
commit 457563085186244dca36a80a959e5a9486558299
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:34:13 2020 +0300
minor
commit 7aacf879951f8ab619824730cb28ea5cd2518812
Author: ArtemBaskal <[email protected]>
Date: Fri Jul 17 13:27:55 2020 +0300
+ client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove </button>
}
<hr className="divider--small" />
</div>
}
</s> add </button>}
</div>}
<hr className="divider--small" /> </s> remove </Fragment>
</s> add </> </s> remove && <Fragment>
</s> add && <> </s> remove <Fragment>
</s> add <> </s> remove </Fragment>
</s> add </> | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9 | client/src/install/Setup/Settings.js |
"enter_url_or_path_hint": "Enter URL or absolute path of the list", | <mask> "add_blocklist": "Add blocklist",
<mask> "add_allowlist": "Add allowlist",
<mask> "cancel_btn": "Cancel",
<mask> "enter_name_hint": "Enter name",
<mask> "enter_url_hint": "Enter URL",
<mask> "check_updates_btn": "Check for updates",
<mask> "new_blocklist": "New blocklist",
<mask> "new_allowlist": "New allowlist",
<mask> "edit_blocklist": "Edit blocklist",
<mask> "edit_allowlist": "Edit allowlist",
</s> + client: Validate adding of absolute path to the filtering lists </s> remove import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL } from '../helpers/constants';
</s> add import {
R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6,
UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL, R_WIN_ABSOLUTE_PATH, R_UNIX_ABSOLUTE_PATH,
} from '../helpers/constants'; </s> remove <a
href={value}
target="_blank"
rel="noopener noreferrer"
className="link logs__text"
>
{value}
</a>
</s> add {isValidAbsolutePath(value) ? value :
<a
href={value}
target="_blank"
rel="noopener noreferrer"
className="link logs__text"
>
{value}
</a>} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/421ad744cb36f20167f723dee9966439d2bd14c5 | client/src/__locales/en.json |
"form_error_url_or_path_format": "Invalid url or absolute path of the list", | <mask> "edit_allowlist": "Edit allowlist",
<mask> "enter_valid_blocklist": "Enter a valid URL to the blocklist.",
<mask> "enter_valid_allowlist": "Enter a valid URL to the allowlist.",
<mask> "form_error_url_format": "Invalid url format",
<mask> "custom_filter_rules": "Custom filtering rules",
<mask> "custom_filter_rules_hint": "Enter one rule on a line. You can use either adblock rules or hosts files syntax.",
<mask> "examples_title": "Examples",
<mask> "example_meaning_filter_block": "block access to the example.org domain and all its subdomains",
<mask> "example_meaning_filter_whitelist": "unblock access to the example.org domain and all its subdomains",
</s> + client: Validate adding of absolute path to the filtering lists </s> remove "enter_url_hint": "Enter URL",
</s> add "enter_url_or_path_hint": "Enter URL or absolute path of the list", </s> remove import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL } from '../helpers/constants';
</s> add import {
R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6,
UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL, R_WIN_ABSOLUTE_PATH, R_UNIX_ABSOLUTE_PATH,
} from '../helpers/constants'; </s> remove <a
href={value}
target="_blank"
rel="noopener noreferrer"
className="link logs__text"
>
{value}
</a>
</s> add {isValidAbsolutePath(value) ? value :
<a
href={value}
target="_blank"
rel="noopener noreferrer"
className="link logs__text"
>
{value}
</a>} | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/421ad744cb36f20167f723dee9966439d2bd14c5 | client/src/__locales/en.json |
import { renderInputField, required, isValidPath } from '../../helpers/form'; | <mask> import { Field, reduxForm } from 'redux-form';
<mask> import { Trans, withNamespaces } from 'react-i18next';
<mask> import flow from 'lodash/flow';
<mask>
<mask> import { renderInputField, required, isValidUrl } from '../../helpers/form';
<mask>
<mask> const Form = (props) => {
<mask> const {
<mask> t,
<mask> closeModal,
</s> + client: Validate adding of absolute path to the filtering lists </s> remove import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL } from '../helpers/constants';
</s> add import {
R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6,
UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL, R_WIN_ABSOLUTE_PATH, R_UNIX_ABSOLUTE_PATH,
} from '../helpers/constants'; </s> remove <a
href={value}
target="_blank"
rel="noopener noreferrer"
className="link logs__text"
>
{value}
</a>
</s> add {isValidAbsolutePath(value) ? value :
<a
href={value}
target="_blank"
rel="noopener noreferrer"
className="link logs__text"
>
{value}
</a>} </s> remove placeholder={t('enter_url_hint')}
validate={[required, isValidUrl]}
</s> add placeholder={t('enter_url_or_path_hint')}
validate={[required, isValidPath]} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/421ad744cb36f20167f723dee9966439d2bd14c5 | client/src/components/Filters/Form.js |
placeholder={t('enter_url_or_path_hint')}
validate={[required, isValidPath]} | <mask> name="url"
<mask> type="text"
<mask> component={renderInputField}
<mask> className="form-control"
<mask> placeholder={t('enter_url_hint')}
<mask> validate={[required, isValidUrl]}
<mask> />
<mask> </div>
<mask> <div className="form__description">
<mask> {whitelist ? (
<mask> <Trans>enter_valid_allowlist</Trans>
</s> + client: Validate adding of absolute path to the filtering lists </s> remove <a
href={value}
target="_blank"
rel="noopener noreferrer"
className="link logs__text"
>
{value}
</a>
</s> add {isValidAbsolutePath(value) ? value :
<a
href={value}
target="_blank"
rel="noopener noreferrer"
className="link logs__text"
>
{value}
</a>} </s> remove import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL } from '../helpers/constants';
</s> add import {
R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6,
UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL, R_WIN_ABSOLUTE_PATH, R_UNIX_ABSOLUTE_PATH,
} from '../helpers/constants'; </s> remove import { renderInputField, required, isValidUrl } from '../../helpers/form';
</s> add import { renderInputField, required, isValidPath } from '../../helpers/form'; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/421ad744cb36f20167f723dee9966439d2bd14c5 | client/src/components/Filters/Form.js |
import { isValidAbsolutePath } from '../../helpers/form'; | <mask> import { withNamespaces, Trans } from 'react-i18next';
<mask> import CellWrap from '../ui/CellWrap';
<mask> import { MODAL_TYPE } from '../../helpers/constants';
<mask> import { formatDetailedDateTime } from '../../helpers/helpers';
<mask>
<mask> class Table extends Component {
<mask> getDateCell = row => CellWrap(row, formatDetailedDateTime);
<mask>
<mask> renderCheckbox = ({ original }) => {
</s> + client: Validate adding of absolute path to the filtering lists </s> remove import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL } from '../helpers/constants';
</s> add import {
R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6,
UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL, R_WIN_ABSOLUTE_PATH, R_UNIX_ABSOLUTE_PATH,
} from '../helpers/constants'; </s> remove import { renderInputField, required, isValidUrl } from '../../helpers/form';
</s> add import { renderInputField, required, isValidPath } from '../../helpers/form'; </s> remove <a
href={value}
target="_blank"
rel="noopener noreferrer"
className="link logs__text"
>
{value}
</a>
</s> add {isValidAbsolutePath(value) ? value :
<a
href={value}
target="_blank"
rel="noopener noreferrer"
className="link logs__text"
>
{value}
</a>} </s> remove placeholder={t('enter_url_hint')}
validate={[required, isValidUrl]}
</s> add placeholder={t('enter_url_or_path_hint')}
validate={[required, isValidPath]} | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/421ad744cb36f20167f723dee9966439d2bd14c5 | client/src/components/Filters/Table.js |
{isValidAbsolutePath(value) ? value :
<a
href={value}
target="_blank"
rel="noopener noreferrer"
className="link logs__text"
>
{value}
</a>} | <mask> accessor: 'url',
<mask> minWidth: 200,
<mask> Cell: ({ value }) => (
<mask> <div className="logs__row logs__row--overflow">
<mask> <a
<mask> href={value}
<mask> target="_blank"
<mask> rel="noopener noreferrer"
<mask> className="link logs__text"
<mask> >
<mask> {value}
<mask> </a>
<mask> </div>
<mask> ),
<mask> },
<mask> {
<mask> Header: <Trans>rules_count_table_header</Trans>,
</s> + client: Validate adding of absolute path to the filtering lists </s> remove placeholder={t('enter_url_hint')}
validate={[required, isValidUrl]}
</s> add placeholder={t('enter_url_or_path_hint')}
validate={[required, isValidPath]} </s> remove import { renderInputField, required, isValidUrl } from '../../helpers/form';
</s> add import { renderInputField, required, isValidPath } from '../../helpers/form'; </s> remove import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL } from '../helpers/constants';
</s> add import {
R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6,
UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL, R_WIN_ABSOLUTE_PATH, R_UNIX_ABSOLUTE_PATH,
} from '../helpers/constants'; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/421ad744cb36f20167f723dee9966439d2bd14c5 | client/src/components/Filters/Table.js |
export const R_UNIX_ABSOLUTE_PATH = /^\/([A-z0-9-_+]+\/)*([A-z0-9]+\.(txt))$/;
export const R_WIN_ABSOLUTE_PATH = /^[a-zA-Z]:\\[\\\S|*\S]?.*\.(txt)$/; | <mask> export const R_MAC = /^((([a-fA-F0-9][a-fA-F0-9]+[-]){5}|([a-fA-F0-9][a-fA-F0-9]+[:]){5})([a-fA-F0-9][a-fA-F0-9])$)|(^([a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]+[.]){2}([a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]))$/;
<mask> export const R_CIDR_IPV6 = /^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(\/(12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))$/;
<mask> export const R_PATH_LAST_PART = /\/[^/]*$/;
<mask>
<mask> export const STATS_NAMES = {
<mask> avg_processing_time: 'average_processing_time',
<mask> blocked_filtering: 'Blocked by filters',
</s> + client: Validate adding of absolute path to the filtering lists </s> remove import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL } from '../helpers/constants';
</s> add import {
R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6,
UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL, R_WIN_ABSOLUTE_PATH, R_UNIX_ABSOLUTE_PATH,
} from '../helpers/constants'; </s> remove import { renderInputField, required, isValidUrl } from '../../helpers/form';
</s> add import { renderInputField, required, isValidPath } from '../../helpers/form'; </s> remove <a
href={value}
target="_blank"
rel="noopener noreferrer"
className="link logs__text"
>
{value}
</a>
</s> add {isValidAbsolutePath(value) ? value :
<a
href={value}
target="_blank"
rel="noopener noreferrer"
className="link logs__text"
>
{value}
</a>} </s> remove placeholder={t('enter_url_hint')}
validate={[required, isValidUrl]}
</s> add placeholder={t('enter_url_or_path_hint')}
validate={[required, isValidPath]} | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/421ad744cb36f20167f723dee9966439d2bd14c5 | client/src/helpers/constants.js |
import {
R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6,
UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL, R_WIN_ABSOLUTE_PATH, R_UNIX_ABSOLUTE_PATH,
} from '../helpers/constants'; | <mask> import React, { Fragment } from 'react';
<mask> import { Trans } from 'react-i18next';
<mask> import PropTypes from 'prop-types';
<mask> import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL } from '../helpers/constants';
<mask> import { createOnBlurHandler } from './helpers';
<mask>
<mask> export const renderField = (props, elementType) => {
<mask> const {
<mask> input, id, className, placeholder, type, disabled, normalizeOnBlur,
</s> + client: Validate adding of absolute path to the filtering lists </s> remove import { renderInputField, required, isValidUrl } from '../../helpers/form';
</s> add import { renderInputField, required, isValidPath } from '../../helpers/form'; </s> remove <a
href={value}
target="_blank"
rel="noopener noreferrer"
className="link logs__text"
>
{value}
</a>
</s> add {isValidAbsolutePath(value) ? value :
<a
href={value}
target="_blank"
rel="noopener noreferrer"
className="link logs__text"
>
{value}
</a>} </s> remove placeholder={t('enter_url_hint')}
validate={[required, isValidUrl]}
</s> add placeholder={t('enter_url_or_path_hint')}
validate={[required, isValidPath]} | [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/421ad744cb36f20167f723dee9966439d2bd14c5 | client/src/helpers/form.js |
// Wait until fsnotify has triggered and processed the file-modification
// event. | <mask>
<mask> assertWriting(t, f, "127.0.0.2 newhost\n")
<mask> require.NoError(t, f.Sync())
<mask>
<mask> // Wait until fsnotify has triggerred and processed the
<mask> // file-modification event.
<mask> time.Sleep(50 * time.Millisecond)
<mask>
<mask> t.Run("notified", func(t *testing.T) {
<mask> ips := ehc.Process("newhost", dns.TypeA)
<mask> assert.NotNil(t, ips)
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove assert.Equal(t, "example.org DoT", mc.PayloadContent[0].Name)
</s> add </s> remove assert.Equal(t, "example.org DoH", mc.PayloadContent[0].Name)
</s> add </s> remove assert.Equal(t, "https://example.org/dns-query/cli42", mc.PayloadContent[0].DNSSettings.ServerURL)
</s> add s := mc.PayloadContent[0].DNSSettings
require.NotNil(t, s)
assert.Equal(t, testBootstrapDNS, s.ServerAddresses)
assert.Empty(t, s.ServerName)
assert.Equal(t, "https://example.org/dns-query/cli42", s.ServerURL) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/aghnet/etchostscontainer_test.go |
// The error returned by Exchange may be unwrapped to the Err. | <mask>
<mask> // TestErrUpstream implements upstream.Upstream interface for replacing real
<mask> // upstream in tests.
<mask> type TestErrUpstream struct {
<mask> // The error returned by Exchange may be unwraped to the Err.
<mask> Err error
<mask> }
<mask>
<mask> // Exchange always returns nil Msg and non-nil error.
<mask> func (u *TestErrUpstream) Exchange(*dns.Msg) (*dns.Msg, error) {
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/aghtest/upstream.go |
// Return the uncut value if it's either equal to zero or has | <mask> case
<mask> rounded == 0,
<mask> rounded*time.Second != d.Duration,
<mask> rounded%60 != 0:
<mask> // Return the uncutted value if it's either equal to zero or has
<mask> // fractions of a second or even whole seconds in it.
<mask> return str
<mask>
<mask> case (rounded%secsInHour)/minsInHour != 0:
<mask> return str[:len(str)-tailMin]
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove if d.clientID != "" {
d.ServerName = d.clientID + "." + d.ServerName
</s> add if clientID != "" {
d.ServerName = clientID + "." + d.ServerName </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err)
return
}
</s> add httpError(w, http.StatusBadRequest, "%s", err) </s> remove //
// See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings.
</s> add </s> remove restartHTTP := true
if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port {
// no need to rebind
restartHTTP = false
}
// validate that hosts and ports are bindable
if restartHTTP {
err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port)
if err != nil {
httpError(
w,
http.StatusBadRequest,
"can not listen on IP:port %s: %s",
netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port),
err,
)
return
}
}
</s> add </s> remove if req.Web.Port == 0 || req.DNS.Port == 0 {
httpError(w, http.StatusBadRequest, "port value can't be 0")
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/aghtime/duration.go |
defer func() { err = errors.Annotate(err, "unmarshaling duration: %w") }() | <mask> // *Duration.
<mask> //
<mask> // TODO(e.burkov): Make it able to parse larger units like days.
<mask> func (d *Duration) UnmarshalText(b []byte) (err error) {
<mask> defer func() { err = errors.Annotate(err, "unmarshalling duration: %w") }()
<mask>
<mask> d.Duration, err = time.ParseDuration(string(b))
<mask>
<mask> return err
<mask> }
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove req := applyConfigReq{}
err := json.NewDecoder(r.Body).Decode(&req)
</s> add req, restartHTTP, err := decodeApplyConfigReq(r.Body) </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err)
return
}
</s> add httpError(w, http.StatusBadRequest, "%s", err) </s> remove restartHTTP := true
if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port {
// no need to rebind
restartHTTP = false
}
// validate that hosts and ports are bindable
if restartHTTP {
err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port)
if err != nil {
httpError(
w,
http.StatusBadRequest,
"can not listen on IP:port %s: %s",
netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port),
err,
)
return
}
}
</s> add </s> remove func getMobileConfig(d dnsSettings) ([]byte, error) {
</s> add func encodeMobileConfig(d *dnsSettings, clientID string) ([]byte, error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/aghtime/duration.go |
// Duration marshalling and unmarshaling cases. | <mask> }
<mask> }
<mask>
<mask> // durationEncodingTester is a helper struct to simplify testing different
<mask> // Duration marshalling and unmarshalling cases.
<mask> type durationEncodingTester struct {
<mask> PtrMap map[string]*Duration `json:"ptr_map" yaml:"ptr_map"`
<mask> PtrSlice []*Duration `json:"ptr_slice" yaml:"ptr_slice"`
<mask> PtrValue *Duration `json:"ptr_value" yaml:"ptr_value"`
<mask> PtrArray [1]*Duration `json:"ptr_array" yaml:"ptr_array"`
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove ServerURL string `plist:",omitempty"`
ServerName string `plist:",omitempty"`
clientID string
</s> add // ServerURL is the URI template of the DoH server. It must be empty if
// DNSProtocol is not "HTTPS".
ServerURL string `plist:",omitempty"`
// ServerName is the hostname of the DoT server. It must be empty if
// DNSProtocol is not "TLS".
ServerName string `plist:",omitempty"`
// ServerAddresses is a list of plain DNS server IP addresses used to
// resolve the hostname in ServerURL or ServerName.
ServerAddresses []string `plist:",omitempty"` </s> remove Name string
PayloadDescription string
PayloadDisplayName string
PayloadIdentifier string
</s> add DNSSettings *dnsSettings
| [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/aghtime/duration_test.go |
// checkFields verifies m's fields. It expects the m to be unmarshaled from | <mask> // defaultTestDur is the default time.Duration value to be used throughout the tests of
<mask> // Duration.
<mask> const defaultTestDur = time.Millisecond
<mask>
<mask> // checkFields verifies m's fields. It expects the m to be unmarshalled from
<mask> // one of the constant strings above.
<mask> func (m *durationEncodingTester) checkFields(t *testing.T, d Duration) {
<mask> t.Run("pointers_map", func(t *testing.T) {
<mask> require.NotNil(t, m.PtrMap)
<mask>
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove ServerURL string `plist:",omitempty"`
ServerName string `plist:",omitempty"`
clientID string
</s> add // ServerURL is the URI template of the DoH server. It must be empty if
// DNSProtocol is not "HTTPS".
ServerURL string `plist:",omitempty"`
// ServerName is the hostname of the DoT server. It must be empty if
// DNSProtocol is not "TLS".
ServerName string `plist:",omitempty"`
// ServerAddresses is a list of plain DNS server IP addresses used to
// resolve the hostname in ServerURL or ServerName.
ServerAddresses []string `plist:",omitempty"` </s> remove // Return the uncutted value if it's either equal to zero or has
</s> add // Return the uncut value if it's either equal to zero or has | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/aghtime/duration_test.go |
// least don't need to be inaccessible externally. | <mask> }
<mask>
<mask> // Restrict an access to local addresses for external clients. We also
<mask> // assume that all the DHCP leases we give are locally-served or at
<mask> // least don't need to be unaccessable externally.
<mask> if s.subnetDetector.IsLocallyServedNetwork(ip) {
<mask> if !ctx.isLocalClient {
<mask> log.Debug("dns: %q requests for internal ip", d.Addr)
<mask> d.Res = s.genNXDomain(req)
<mask>
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove restartHTTP := true
if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port {
// no need to rebind
restartHTTP = false
}
// validate that hosts and ports are bindable
if restartHTTP {
err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port)
if err != nil {
httpError(
w,
http.StatusBadRequest,
"can not listen on IP:port %s: %s",
netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port),
err,
)
return
}
}
</s> add </s> remove // The error returned by Exchange may be unwraped to the Err.
</s> add // The error returned by Exchange may be unwrapped to the Err. </s> remove ServerURL string `plist:",omitempty"`
ServerName string `plist:",omitempty"`
clientID string
</s> add // ServerURL is the URI template of the DoH server. It must be empty if
// DNSProtocol is not "HTTPS".
ServerURL string `plist:",omitempty"`
// ServerName is the hostname of the DoT server. It must be empty if
// DNSProtocol is not "TLS".
ServerName string `plist:",omitempty"`
// ServerAddresses is a list of plain DNS server IP addresses used to
// resolve the hostname in ServerURL or ServerName.
ServerAddresses []string `plist:",omitempty"` | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/dnsforward/dns.go |
// config is the global configuration structure.
//
// TODO(a.garipov, e.burkov): This global is afwul and must be removed.
var config = &configuration{ | <mask>
<mask> dnsforward.TLSConfig `yaml:",inline" json:",inline"`
<mask> }
<mask>
<mask> // initialize to default values, will be changed later when reading config or parsing command line
<mask> var config = configuration{
<mask> BindPort: 3000,
<mask> BetaBindPort: 0,
<mask> BindHost: net.IP{0, 0, 0, 0},
<mask> AuthAttempts: 5,
<mask> AuthBlockMin: 15,
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove // Return the uncutted value if it's either equal to zero or has
</s> add // Return the uncut value if it's either equal to zero or has </s> remove var curConfig configuration
copyInstallSettings(&curConfig, &config)
</s> add var curConfig *configuration
copyInstallSettings(curConfig, config) </s> remove // checkFields verifies m's fields. It expects the m to be unmarshalled from
</s> add // checkFields verifies m's fields. It expects the m to be unmarshaled from </s> remove err = configureOS(&config)
</s> add err = configureOS(config) </s> remove // least don't need to be unaccessable externally.
</s> add // least don't need to be inaccessible externally. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/config.go |
"github.com/AdguardTeam/golibs/errors" | <mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> )
<mask>
<mask> // getAddrsResponse is the response for /install/get_addresses endpoint.
<mask> type getAddrsResponse struct {
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add </s> remove ServerURL string `plist:",omitempty"`
ServerName string `plist:",omitempty"`
clientID string
</s> add // ServerURL is the URI template of the DoH server. It must be empty if
// DNSProtocol is not "HTTPS".
ServerURL string `plist:",omitempty"`
// ServerName is the hostname of the DoT server. It must be empty if
// DNSProtocol is not "TLS".
ServerName string `plist:",omitempty"`
// ServerAddresses is a list of plain DNS server IP addresses used to
// resolve the hostname in ServerURL or ServerName.
ServerAddresses []string `plist:",omitempty"` | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/controlinstall.go |
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/AdguardTeam/golibs/netutil"
<mask> )
<mask>
<mask> // getAddrsResponse is the response for /install/get_addresses endpoint.
<mask> type getAddrsResponse struct {
<mask> WebPort int `json:"web_port"`
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove ServerURL string `plist:",omitempty"`
ServerName string `plist:",omitempty"`
clientID string
</s> add // ServerURL is the URI template of the DoH server. It must be empty if
// DNSProtocol is not "HTTPS".
ServerURL string `plist:",omitempty"`
// ServerName is the hostname of the DoT server. It must be empty if
// DNSProtocol is not "TLS".
ServerName string `plist:",omitempty"`
// ServerAddresses is a list of plain DNS server IP addresses used to
// resolve the hostname in ServerURL or ServerName.
ServerAddresses []string `plist:",omitempty"` | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/controlinstall.go |
|
req, restartHTTP, err := decodeApplyConfigReq(r.Body) | <mask> }
<mask>
<mask> // Apply new configuration, start DNS server, restart Web server
<mask> func (web *Web) handleInstallConfigure(w http.ResponseWriter, r *http.Request) {
<mask> req := applyConfigReq{}
<mask> err := json.NewDecoder(r.Body).Decode(&req)
<mask> if err != nil {
<mask> httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err)
<mask> return
<mask> }
<mask>
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err)
return
}
</s> add httpError(w, http.StatusBadRequest, "%s", err) </s> remove if req.Web.Port == 0 || req.DNS.Port == 0 {
httpError(w, http.StatusBadRequest, "port value can't be 0")
</s> add </s> remove restartHTTP := true
if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port {
// no need to rebind
restartHTTP = false
}
// validate that hosts and ports are bindable
if restartHTTP {
err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port)
if err != nil {
httpError(
w,
http.StatusBadRequest,
"can not listen on IP:port %s: %s",
netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port),
err,
)
return
}
}
</s> add </s> remove copyInstallSettings(&config, &curConfig)
</s> add copyInstallSettings(config, curConfig) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/controlinstall.go |
httpError(w, http.StatusBadRequest, "%s", err) | <mask> func (web *Web) handleInstallConfigure(w http.ResponseWriter, r *http.Request) {
<mask> req := applyConfigReq{}
<mask> err := json.NewDecoder(r.Body).Decode(&req)
<mask> if err != nil {
<mask> httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err)
<mask> return
<mask> }
<mask>
<mask> if req.Web.Port == 0 || req.DNS.Port == 0 {
<mask> httpError(w, http.StatusBadRequest, "port value can't be 0")
<mask> return
<mask> }
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove if req.Web.Port == 0 || req.DNS.Port == 0 {
httpError(w, http.StatusBadRequest, "port value can't be 0")
</s> add </s> remove req := applyConfigReq{}
err := json.NewDecoder(r.Body).Decode(&req)
</s> add req, restartHTTP, err := decodeApplyConfigReq(r.Body) </s> remove restartHTTP := true
if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port {
// no need to rebind
restartHTTP = false
}
// validate that hosts and ports are bindable
if restartHTTP {
err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port)
if err != nil {
httpError(
w,
http.StatusBadRequest,
"can not listen on IP:port %s: %s",
netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port),
err,
)
return
}
}
</s> add </s> remove copyInstallSettings(&config, &curConfig)
</s> add copyInstallSettings(config, curConfig) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/controlinstall.go |
<mask> httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err)
<mask> return
<mask> }
<mask>
<mask> if req.Web.Port == 0 || req.DNS.Port == 0 {
<mask> httpError(w, http.StatusBadRequest, "port value can't be 0")
<mask> return
<mask> }
<mask>
<mask> restartHTTP := true
<mask> if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port {
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err)
return
}
</s> add httpError(w, http.StatusBadRequest, "%s", err) </s> remove restartHTTP := true
if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port {
// no need to rebind
restartHTTP = false
}
// validate that hosts and ports are bindable
if restartHTTP {
err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port)
if err != nil {
httpError(
w,
http.StatusBadRequest,
"can not listen on IP:port %s: %s",
netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port),
err,
)
return
}
}
</s> add </s> remove req := applyConfigReq{}
err := json.NewDecoder(r.Body).Decode(&req)
</s> add req, restartHTTP, err := decodeApplyConfigReq(r.Body) </s> remove var curConfig configuration
copyInstallSettings(&curConfig, &config)
</s> add var curConfig *configuration
copyInstallSettings(curConfig, config) </s> remove copyInstallSettings(&config, &curConfig)
</s> add copyInstallSettings(config, curConfig) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/controlinstall.go |
|
<mask> httpError(w, http.StatusBadRequest, "port value can't be 0")
<mask> return
<mask> }
<mask>
<mask> restartHTTP := true
<mask> if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port {
<mask> // no need to rebind
<mask> restartHTTP = false
<mask> }
<mask>
<mask> // validate that hosts and ports are bindable
<mask> if restartHTTP {
<mask> err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port)
<mask> if err != nil {
<mask> httpError(
<mask> w,
<mask> http.StatusBadRequest,
<mask> "can not listen on IP:port %s: %s",
<mask> netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port),
<mask> err,
<mask> )
<mask>
<mask> return
<mask> }
<mask>
<mask> }
<mask>
<mask> err = aghnet.CheckPacketPortAvailable(req.DNS.IP, req.DNS.Port)
<mask> if err != nil {
<mask> httpError(w, http.StatusBadRequest, "%s", err)
<mask> return
<mask> }
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove if req.Web.Port == 0 || req.DNS.Port == 0 {
httpError(w, http.StatusBadRequest, "port value can't be 0")
</s> add </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err)
return
}
</s> add httpError(w, http.StatusBadRequest, "%s", err) </s> remove copyInstallSettings(&config, &curConfig)
</s> add copyInstallSettings(config, curConfig) </s> remove req := applyConfigReq{}
err := json.NewDecoder(r.Body).Decode(&req)
</s> add req, restartHTTP, err := decodeApplyConfigReq(r.Body) </s> remove copyInstallSettings(&config, &curConfig)
</s> add copyInstallSettings(config, curConfig) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/controlinstall.go |
|
var curConfig *configuration
copyInstallSettings(curConfig, config) | <mask> httpError(w, http.StatusBadRequest, "%s", err)
<mask> return
<mask> }
<mask>
<mask> var curConfig configuration
<mask> copyInstallSettings(&curConfig, &config)
<mask>
<mask> Context.firstRun = false
<mask> config.BindHost = req.Web.IP
<mask> config.BindPort = req.Web.Port
<mask> config.DNS.BindHosts = []net.IP{req.DNS.IP}
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove restartHTTP := true
if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port {
// no need to rebind
restartHTTP = false
}
// validate that hosts and ports are bindable
if restartHTTP {
err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port)
if err != nil {
httpError(
w,
http.StatusBadRequest,
"can not listen on IP:port %s: %s",
netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port),
err,
)
return
}
}
</s> add </s> remove if req.Web.Port == 0 || req.DNS.Port == 0 {
httpError(w, http.StatusBadRequest, "port value can't be 0")
</s> add </s> remove copyInstallSettings(&config, &curConfig)
</s> add copyInstallSettings(config, curConfig) </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err)
return
}
</s> add httpError(w, http.StatusBadRequest, "%s", err) </s> remove copyInstallSettings(&config, &curConfig)
</s> add copyInstallSettings(config, curConfig) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/controlinstall.go |
copyInstallSettings(config, curConfig) | <mask> // underlying functions potentially restart the HTTPS server.
<mask> err = StartMods()
<mask> if err != nil {
<mask> Context.firstRun = true
<mask> copyInstallSettings(&config, &curConfig)
<mask> httpError(w, http.StatusInternalServerError, "%s", err)
<mask> return
<mask> }
<mask>
<mask> u := User{}
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove copyInstallSettings(&config, &curConfig)
</s> add copyInstallSettings(config, curConfig) </s> remove restartHTTP := true
if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port {
// no need to rebind
restartHTTP = false
}
// validate that hosts and ports are bindable
if restartHTTP {
err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port)
if err != nil {
httpError(
w,
http.StatusBadRequest,
"can not listen on IP:port %s: %s",
netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port),
err,
)
return
}
}
</s> add </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err)
return
}
</s> add httpError(w, http.StatusBadRequest, "%s", err) </s> remove req := applyConfigReq{}
err := json.NewDecoder(r.Body).Decode(&req)
</s> add req, restartHTTP, err := decodeApplyConfigReq(r.Body) </s> remove mobileconfig, err := getMobileConfig(d)
</s> add mobileconfig, err := encodeMobileConfig(d, clientID) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/controlinstall.go |
copyInstallSettings(config, curConfig) | <mask>
<mask> err = config.write()
<mask> if err != nil {
<mask> Context.firstRun = true
<mask> copyInstallSettings(&config, &curConfig)
<mask> httpError(w, http.StatusInternalServerError, "Couldn't write config: %s", err)
<mask> return
<mask> }
<mask>
<mask> web.conf.firstRun = false
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove copyInstallSettings(&config, &curConfig)
</s> add copyInstallSettings(config, curConfig) </s> remove restartHTTP := true
if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port {
// no need to rebind
restartHTTP = false
}
// validate that hosts and ports are bindable
if restartHTTP {
err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port)
if err != nil {
httpError(
w,
http.StatusBadRequest,
"can not listen on IP:port %s: %s",
netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port),
err,
)
return
}
}
</s> add </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err)
return
}
</s> add httpError(w, http.StatusBadRequest, "%s", err) </s> remove mobileconfig, err := getMobileConfig(d)
</s> add mobileconfig, err := encodeMobileConfig(d, clientID) </s> remove req := applyConfigReq{}
err := json.NewDecoder(r.Body).Decode(&req)
</s> add req, restartHTTP, err := decodeApplyConfigReq(r.Body) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/controlinstall.go |
err = configureOS(config) | <mask> }
<mask>
<mask> setupContext(args)
<mask>
<mask> err = configureOS(&config)
<mask> fatalOnError(err)
<mask>
<mask> // clients package uses filtering package's static data (filtering.BlockedSvcKnown()),
<mask> // so we have to initialize filtering's static data first,
<mask> // but also avoid relying on automatic Go init() function
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove data := mobileConfig{
PayloadContent: []payloadContent{{
Name: dspName,
PayloadDescription: "Configures device to use AdGuard Home",
PayloadDisplayName: dspName,
PayloadIdentifier: fmt.Sprintf("com.apple.dnsSettings.managed.%s", genUUIDv4()),
PayloadType: "com.apple.dnsSettings.managed",
</s> add payloadID := fmt.Sprintf("%s.%s", dnsSettingsPayloadType, genUUIDv4())
data := &mobileConfig{
PayloadDescription: "Adds AdGuard Home to macOS Big Sur " +
"and iOS 14 or newer systems",
PayloadDisplayName: dspName,
PayloadIdentifier: genUUIDv4(),
PayloadType: "Configuration",
PayloadUUID: genUUIDv4(),
PayloadContent: []*payloadContent{{
PayloadType: dnsSettingsPayloadType,
PayloadIdentifier: payloadID, </s> remove // least don't need to be unaccessable externally.
</s> add // least don't need to be inaccessible externally. </s> remove restartHTTP := true
if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port {
// no need to rebind
restartHTTP = false
}
// validate that hosts and ports are bindable
if restartHTTP {
err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port)
if err != nil {
httpError(
w,
http.StatusBadRequest,
"can not listen on IP:port %s: %s",
netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port),
err,
)
return
}
}
</s> add </s> remove // initialize to default values, will be changed later when reading config or parsing command line
var config = configuration{
</s> add // config is the global configuration structure.
//
// TODO(a.garipov, e.burkov): This global is afwul and must be removed.
var config = &configuration{ </s> remove defer func() { err = errors.Annotate(err, "unmarshalling duration: %w") }()
</s> add defer func() { err = errors.Annotate(err, "unmarshaling duration: %w") }() | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/home.go |
"github.com/AdguardTeam/golibs/stringutil" | <mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward"
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/golibs/log"
<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: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add </s> remove ServerURL string `plist:",omitempty"`
ServerName string `plist:",omitempty"`
clientID string
</s> add // ServerURL is the URI template of the DoH server. It must be empty if
// DNSProtocol is not "HTTPS".
ServerURL string `plist:",omitempty"`
// ServerName is the hostname of the DoT server. It must be empty if
// DNSProtocol is not "TLS".
ServerName string `plist:",omitempty"`
// ServerAddresses is a list of plain DNS server IP addresses used to
// resolve the hostname in ServerURL or ServerName.
ServerAddresses []string `plist:",omitempty"` | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/mobileconfig.go |
// dnsSettings is the DNSSetting.DNSSettings mobileconfig profile.
//
// See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings. | <mask> "howett.net/plist"
<mask> )
<mask>
<mask> type dnsSettings struct {
<mask> // DNSProtocol is the required protocol to be used. The valid values
<mask> // are "HTTPS" and "TLS".
<mask> DNSProtocol string
<mask>
<mask> // ServerURL is the URI template of the DoH server. It must be empty if
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove ServerURL string `plist:",omitempty"`
ServerName string `plist:",omitempty"`
clientID string
</s> add // ServerURL is the URI template of the DoH server. It must be empty if
// DNSProtocol is not "HTTPS".
ServerURL string `plist:",omitempty"`
// ServerName is the hostname of the DoT server. It must be empty if
// DNSProtocol is not "TLS".
ServerName string `plist:",omitempty"`
// ServerAddresses is a list of plain DNS server IP addresses used to
// resolve the hostname in ServerURL or ServerName.
ServerAddresses []string `plist:",omitempty"` </s> remove // checkFields verifies m's fields. It expects the m to be unmarshalled from
</s> add // checkFields verifies m's fields. It expects the m to be unmarshaled from </s> remove // The error returned by Exchange may be unwraped to the Err.
</s> add // The error returned by Exchange may be unwrapped to the Err. | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/mobileconfig.go |
// DNSProtocol is the required protocol to be used. The valid values
// are "HTTPS" and "TLS". | <mask> //
<mask> // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings.
<mask> type dnsSettings struct {
<mask> DNSProtocol string
<mask>
<mask> // ServerURL is the URI template of the DoH server. It must be empty if
<mask> // DNSProtocol is not "HTTPS".
<mask> ServerURL string `plist:",omitempty"`
<mask>
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove ServerURL string `plist:",omitempty"`
ServerName string `plist:",omitempty"`
clientID string
</s> add // ServerURL is the URI template of the DoH server. It must be empty if
// DNSProtocol is not "HTTPS".
ServerURL string `plist:",omitempty"`
// ServerName is the hostname of the DoT server. It must be empty if
// DNSProtocol is not "TLS".
ServerName string `plist:",omitempty"`
// ServerAddresses is a list of plain DNS server IP addresses used to
// resolve the hostname in ServerURL or ServerName.
ServerAddresses []string `plist:",omitempty"` </s> remove DNSSettings dnsSettings
</s> add PayloadDisplayName string
PayloadDescription string | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/mobileconfig.go |
// ServerURL is the URI template of the DoH server. It must be empty if
// DNSProtocol is not "HTTPS".
ServerURL string `plist:",omitempty"`
// ServerName is the hostname of the DoT server. It must be empty if
// DNSProtocol is not "TLS".
ServerName string `plist:",omitempty"`
// ServerAddresses is a list of plain DNS server IP addresses used to
// resolve the hostname in ServerURL or ServerName.
ServerAddresses []string `plist:",omitempty"` | <mask> )
<mask>
<mask> type dnsSettings struct {
<mask> DNSProtocol string
<mask> ServerURL string `plist:",omitempty"`
<mask> ServerName string `plist:",omitempty"`
<mask> clientID string
<mask> }
<mask>
<mask> type payloadContent struct {
<mask> Name string
<mask> PayloadDescription string
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove Name string
PayloadDescription string
PayloadDisplayName string
PayloadIdentifier string
</s> add DNSSettings *dnsSettings
</s> remove DNSSettings dnsSettings
</s> add PayloadDisplayName string
PayloadDescription string | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/mobileconfig.go |
// payloadContent is a Device Management Profile payload.
//
// See https://developer.apple.com/documentation/devicemanagement/configuring_multiple_devices_using_profiles#3234127. | <mask> }
<mask>
<mask> type payloadContent struct {
<mask> DNSSettings *dnsSettings
<mask>
<mask> PayloadType string
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove Name string
PayloadDescription string
PayloadDisplayName string
PayloadIdentifier string
</s> add DNSSettings *dnsSettings
</s> remove DNSSettings dnsSettings
</s> add PayloadDisplayName string
PayloadDescription string </s> remove ServerURL string `plist:",omitempty"`
ServerName string `plist:",omitempty"`
clientID string
</s> add // ServerURL is the URI template of the DoH server. It must be empty if
// DNSProtocol is not "HTTPS".
ServerURL string `plist:",omitempty"`
// ServerName is the hostname of the DoT server. It must be empty if
// DNSProtocol is not "TLS".
ServerName string `plist:",omitempty"`
// ServerAddresses is a list of plain DNS server IP addresses used to
// resolve the hostname in ServerURL or ServerName.
ServerAddresses []string `plist:",omitempty"` </s> remove PayloadContent []payloadContent
</s> add PayloadContent []*payloadContent | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/mobileconfig.go |
DNSSettings *dnsSettings
| <mask> clientID string
<mask> }
<mask>
<mask> type payloadContent struct {
<mask> Name string
<mask> PayloadDescription string
<mask> PayloadDisplayName string
<mask> PayloadIdentifier string
<mask> PayloadType string
<mask> PayloadUUID string
<mask> DNSSettings dnsSettings
<mask> PayloadVersion int
<mask> }
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove DNSSettings dnsSettings
</s> add PayloadDisplayName string
PayloadDescription string </s> remove PayloadContent []payloadContent
</s> add PayloadContent []*payloadContent </s> remove ServerURL string `plist:",omitempty"`
ServerName string `plist:",omitempty"`
clientID string
</s> add // ServerURL is the URI template of the DoH server. It must be empty if
// DNSProtocol is not "HTTPS".
ServerURL string `plist:",omitempty"`
// ServerName is the hostname of the DoT server. It must be empty if
// DNSProtocol is not "TLS".
ServerName string `plist:",omitempty"`
// ServerAddresses is a list of plain DNS server IP addresses used to
// resolve the hostname in ServerURL or ServerName.
ServerAddresses []string `plist:",omitempty"` | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/mobileconfig.go |
PayloadIdentifier string | <mask>
<mask> PayloadType string
<mask> PayloadUUID string
<mask> PayloadDisplayName string
<mask> PayloadDescription string
<mask> PayloadVersion int
<mask> }
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove DNSSettings dnsSettings
</s> add PayloadDisplayName string
PayloadDescription string </s> remove Name string
PayloadDescription string
PayloadDisplayName string
PayloadIdentifier string
</s> add DNSSettings *dnsSettings
</s> remove PayloadContent []payloadContent
</s> add PayloadContent []*payloadContent </s> remove ServerURL string `plist:",omitempty"`
ServerName string `plist:",omitempty"`
clientID string
</s> add // ServerURL is the URI template of the DoH server. It must be empty if
// DNSProtocol is not "HTTPS".
ServerURL string `plist:",omitempty"`
// ServerName is the hostname of the DoT server. It must be empty if
// DNSProtocol is not "TLS".
ServerName string `plist:",omitempty"`
// ServerAddresses is a list of plain DNS server IP addresses used to
// resolve the hostname in ServerURL or ServerName.
ServerAddresses []string `plist:",omitempty"` | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/mobileconfig.go |
PayloadDisplayName string
PayloadDescription string | <mask> PayloadDisplayName string
<mask> PayloadIdentifier string
<mask> PayloadType string
<mask> PayloadUUID string
<mask> DNSSettings dnsSettings
<mask> PayloadVersion int
<mask> }
<mask>
<mask> type mobileConfig struct {
<mask> PayloadDescription string
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove Name string
PayloadDescription string
PayloadDisplayName string
PayloadIdentifier string
</s> add DNSSettings *dnsSettings
</s> remove PayloadContent []payloadContent
</s> add PayloadContent []*payloadContent | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/mobileconfig.go |
// dnsSettingsPayloadType is the payload type for a DNSSettings profile.
const dnsSettingsPayloadType = "com.apple.dnsSettings.managed"
// mobileConfig contains the TopLevel properties for configuring Device
// Management Profiles.
//
// See https://developer.apple.com/documentation/devicemanagement/toplevel. | <mask> }
<mask>
<mask> type mobileConfig struct {
<mask> PayloadDescription string
<mask> PayloadDisplayName string
<mask> PayloadIdentifier string
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove DNSSettings dnsSettings
</s> add PayloadDisplayName string
PayloadDescription string </s> remove Name string
PayloadDescription string
PayloadDisplayName string
PayloadIdentifier string
</s> add DNSSettings *dnsSettings
</s> remove PayloadContent []payloadContent
</s> add PayloadContent []*payloadContent </s> remove ServerURL string `plist:",omitempty"`
ServerName string `plist:",omitempty"`
clientID string
</s> add // ServerURL is the URI template of the DoH server. It must be empty if
// DNSProtocol is not "HTTPS".
ServerURL string `plist:",omitempty"`
// ServerName is the hostname of the DoT server. It must be empty if
// DNSProtocol is not "TLS".
ServerName string `plist:",omitempty"`
// ServerAddresses is a list of plain DNS server IP addresses used to
// resolve the hostname in ServerURL or ServerName.
ServerAddresses []string `plist:",omitempty"` | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/mobileconfig.go |
PayloadContent []*payloadContent | <mask> PayloadDisplayName string
<mask> PayloadIdentifier string
<mask> PayloadType string
<mask> PayloadUUID string
<mask> PayloadContent []payloadContent
<mask> PayloadVersion int
<mask> PayloadRemovalDisallowed bool
<mask> }
<mask>
<mask> func genUUIDv4() string {
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove DNSSettings dnsSettings
</s> add PayloadDisplayName string
PayloadDescription string </s> remove Name string
PayloadDescription string
PayloadDisplayName string
PayloadIdentifier string
</s> add DNSSettings *dnsSettings
</s> remove ServerURL string `plist:",omitempty"`
ServerName string `plist:",omitempty"`
clientID string
</s> add // ServerURL is the URI template of the DoH server. It must be empty if
// DNSProtocol is not "HTTPS".
ServerURL string `plist:",omitempty"`
// ServerName is the hostname of the DoT server. It must be empty if
// DNSProtocol is not "TLS".
ServerName string `plist:",omitempty"`
// ServerAddresses is a list of plain DNS server IP addresses used to
// resolve the hostname in ServerURL or ServerName.
ServerAddresses []string `plist:",omitempty"` | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/mobileconfig.go |
func encodeMobileConfig(d *dnsSettings, clientID string) ([]byte, error) { | <mask> dnsProtoHTTPS = "HTTPS"
<mask> dnsProtoTLS = "TLS"
<mask> )
<mask>
<mask> func getMobileConfig(d dnsSettings) ([]byte, error) {
<mask> var dspName string
<mask> switch proto := d.DNSProtocol; proto {
<mask> case dnsProtoHTTPS:
<mask> dspName = fmt.Sprintf("%s DoH", d.ServerName)
<mask> u := &url.URL{
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove Path: path.Join("/dns-query", d.clientID),
</s> add Path: path.Join("/dns-query", clientID), </s> remove if d.clientID != "" {
d.ServerName = d.clientID + "." + d.ServerName
</s> add if clientID != "" {
d.ServerName = clientID + "." + d.ServerName </s> remove //
// See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings.
</s> add </s> remove assert.Equal(t, "https://example.org/dns-query", mc.PayloadContent[0].DNSSettings.ServerURL)
</s> add s := mc.PayloadContent[0].DNSSettings
require.NotNil(t, s)
assert.Equal(t, testBootstrapDNS, s.ServerAddresses)
assert.Empty(t, s.ServerName)
assert.Equal(t, "https://example.org/dns-query", s.ServerURL) </s> remove assert.Equal(t, "https://example.org/dns-query/cli42", mc.PayloadContent[0].DNSSettings.ServerURL)
</s> add s := mc.PayloadContent[0].DNSSettings
require.NotNil(t, s)
assert.Equal(t, testBootstrapDNS, s.ServerAddresses)
assert.Empty(t, s.ServerName)
assert.Equal(t, "https://example.org/dns-query/cli42", s.ServerURL) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/mobileconfig.go |
Path: path.Join("/dns-query", clientID), | <mask> dspName = fmt.Sprintf("%s DoH", d.ServerName)
<mask> u := &url.URL{
<mask> Scheme: schemeHTTPS,
<mask> Host: d.ServerName,
<mask> Path: path.Join("/dns-query", d.clientID),
<mask> }
<mask> d.ServerURL = u.String()
<mask> // Empty the ServerName field since it is only must be presented
<mask> // in DNS-over-TLS configuration.
<mask> //
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove //
// See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings.
</s> add </s> remove func getMobileConfig(d dnsSettings) ([]byte, error) {
</s> add func encodeMobileConfig(d *dnsSettings, clientID string) ([]byte, error) { </s> remove ServerURL string `plist:",omitempty"`
ServerName string `plist:",omitempty"`
clientID string
</s> add // ServerURL is the URI template of the DoH server. It must be empty if
// DNSProtocol is not "HTTPS".
ServerURL string `plist:",omitempty"`
// ServerName is the hostname of the DoT server. It must be empty if
// DNSProtocol is not "TLS".
ServerName string `plist:",omitempty"`
// ServerAddresses is a list of plain DNS server IP addresses used to
// resolve the hostname in ServerURL or ServerName.
ServerAddresses []string `plist:",omitempty"` </s> remove if d.clientID != "" {
d.ServerName = d.clientID + "." + d.ServerName
</s> add if clientID != "" {
d.ServerName = clientID + "." + d.ServerName </s> remove // initialize to default values, will be changed later when reading config or parsing command line
var config = configuration{
</s> add // config is the global configuration structure.
//
// TODO(a.garipov, e.burkov): This global is afwul and must be removed.
var config = &configuration{ | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/mobileconfig.go |
<mask> }
<mask> d.ServerURL = u.String()
<mask> // Empty the ServerName field since it is only must be presented
<mask> // in DNS-over-TLS configuration.
<mask> //
<mask> // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings.
<mask> d.ServerName = ""
<mask> case dnsProtoTLS:
<mask> dspName = fmt.Sprintf("%s DoT", d.ServerName)
<mask> if d.clientID != "" {
<mask> d.ServerName = d.clientID + "." + d.ServerName
</s> Pull request: home: add bootstrap to mobileconfig, imp code
Updates #3568.
Squashed commit of the following:
commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 15:16:07 2021 +0300
home: imp tests
commit 67cd771e631938d3e8a5340315314210de796174
Author: Ainar Garipov <[email protected]>
Date: Mon Sep 13 14:34:03 2021 +0300
home: add bootstrap to mobileconfig, imp code </s> remove if d.clientID != "" {
d.ServerName = d.clientID + "." + d.ServerName
</s> add if clientID != "" {
d.ServerName = clientID + "." + d.ServerName </s> remove Path: path.Join("/dns-query", d.clientID),
</s> add Path: path.Join("/dns-query", clientID), </s> remove func getMobileConfig(d dnsSettings) ([]byte, error) {
</s> add func encodeMobileConfig(d *dnsSettings, clientID string) ([]byte, error) { </s> remove ServerURL string `plist:",omitempty"`
ServerName string `plist:",omitempty"`
clientID string
</s> add // ServerURL is the URI template of the DoH server. It must be empty if
// DNSProtocol is not "HTTPS".
ServerURL string `plist:",omitempty"`
// ServerName is the hostname of the DoT server. It must be empty if
// DNSProtocol is not "TLS".
ServerName string `plist:",omitempty"`
// ServerAddresses is a list of plain DNS server IP addresses used to
// resolve the hostname in ServerURL or ServerName.
ServerAddresses []string `plist:",omitempty"` | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196 | internal/home/mobileconfig.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.