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