docstring_tokens
stringlengths
0
76.5k
code_tokens
stringlengths
75
1.81M
label_window
sequencelengths
4
2.12k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
updated, err := filter.update(force)
<mask> // fetch URLs <mask> updateCount := 0 <mask> for i := range config.Filters { <mask> filter := &config.Filters[i] // otherwise we will be operating on a copy <mask> updated, err := filter.update(false) <mask> if err != nil { <mask> log.Printf("Failed to update filter %s: %s\n", filter.URL, err) <mask> continue <mask> } <mask> if updated { </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove // deduplicate // TODO: move it somewhere else { i := 0 // output index, used for deletion later urls := map[string]bool{} for _, filter := range config.Filters { if _, ok := urls[filter.URL]; !ok { // we didn't see it before, keep it urls[filter.URL] = true // remember the URL config.Filters[i] = filter i++ } } // all entries we want to keep are at front, delete the rest config.Filters = config.Filters[:i] } </s> add </s> remove if force != "" { config.Lock() for i := range config.Filters { filter := &config.Filters[i] // otherwise we will be operating on a copy filter.LastUpdated = time.Unix(0, 0) } config.Unlock() // not defer because refreshFiltersIfNeccessary locks it too } updated := refreshFiltersIfNeccessary() </s> add updated := checkFiltersUpdates(force != "") </s> remove errortext := fmt.Sprintf("Couldn't fetch filter from url %s: %s", filter.URL, err) log.Println(errortext) http.Error(w, errortext, http.StatusBadRequest) </s> add errorText := fmt.Sprintf("Couldn't fetch filter from url %s: %s", filter.URL, err) log.Println(errorText) http.Error(w, errorText, http.StatusBadRequest)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
// Saving it to the filters dir now err = filter.save() if err != nil { log.Printf("Failed to save the updated filter %d: %s", filter.ID, err) continue }
<mask> } <mask> if updated { <mask> updateCount++ <mask> } <mask> } <mask> config.Unlock() <mask> <mask> if updateCount > 0 { </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove jsonentry["status"] = status.String() </s> add jsonEntry["status"] = status.String() </s> remove jsonentry["rule"] = entry.Result.Rule </s> add jsonEntry["rule"] = entry.Result.Rule jsonEntry["filterId"] = entry.Result.FilterID </s> remove // Count lines in the filter for _, line := range lines { line = strings.TrimSpace(line) if len(line) > 0 && line[0] == '!' { if m := filterTitle.FindAllStringSubmatch(line, -1); len(m) > 0 && len(m[0]) >= 2 && !seenTitle { filter.Name = m[0][1] seenTitle = true } } else if len(line) != 0 { rulesCount++ } </s> add if filterName != "" { filter.Name = filterName </s> remove updated, err := filter.update(false) </s> add updated, err := filter.update(force) </s> remove if force != "" { config.Lock() for i := range config.Filters { filter := &config.Filters[i] // otherwise we will be operating on a copy filter.LastUpdated = time.Unix(0, 0) } config.Unlock() // not defer because refreshFiltersIfNeccessary locks it too } updated := refreshFiltersIfNeccessary() </s> add updated := checkFiltersUpdates(force != "")
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
// Call "save" to persist the filter contents
<mask> // Checks for filters updates <mask> // If "force" is true -- does not check the filter's LastUpdated field <mask> func (filter *filter) update(force bool) (bool, error) { <mask> if !filter.Enabled { <mask> return false, nil <mask> } <mask> if !force && time.Since(filter.LastUpdated) <= updatePeriod { </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove func refreshFiltersIfNeccessary() int { </s> add // Checks filters updates if necessary // If force is true, it ignores the filter.LastUpdated field value func checkFiltersUpdates(force bool) int { </s> remove log.Printf("Downloading update for filter %d", filter.ID) </s> add log.Printf("Downloading update for filter %d from %s", filter.ID, filter.URL) </s> remove // check for duplicates </s> add // Check for duplicates </s> remove // Saving it to the filters dir now err = filter.save() if err != nil { return false, nil } </s> add </s> remove return nil; </s> add return nil
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
log.Printf("Downloading update for filter %d from %s", filter.ID, filter.URL)
<mask> if !force && time.Since(filter.LastUpdated) <= updatePeriod { <mask> return false, nil <mask> } <mask> <mask> log.Printf("Downloading update for filter %d", filter.ID) <mask> <mask> // use same update period for failed filter downloads to avoid flooding with requests <mask> filter.LastUpdated = time.Now() <mask> <mask> resp, err := client.Get(filter.URL) </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove // use same update period for failed filter downloads to avoid flooding with requests </s> add // use the same update period for failed filter downloads to avoid flooding with requests </s> remove updated, err := filter.update(false) </s> add updated, err := filter.update(force) </s> remove // Count lines in the filter for _, line := range lines { line = strings.TrimSpace(line) if len(line) > 0 && line[0] == '!' { if m := filterTitle.FindAllStringSubmatch(line, -1); len(m) > 0 && len(m[0]) >= 2 && !seenTitle { filter.Name = m[0][1] seenTitle = true } } else if len(line) != 0 { rulesCount++ } </s> add if filterName != "" { filter.Name = filterName
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
// use the same update period for failed filter downloads to avoid flooding with requests
<mask> } <mask> <mask> log.Printf("Downloading update for filter %d", filter.ID) <mask> <mask> // use same update period for failed filter downloads to avoid flooding with requests <mask> filter.LastUpdated = time.Now() <mask> <mask> resp, err := client.Get(filter.URL) <mask> if resp != nil && resp.Body != nil { <mask> defer resp.Body.Close() </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove log.Printf("Downloading update for filter %d", filter.ID) </s> add log.Printf("Downloading update for filter %d from %s", filter.ID, filter.URL) </s> remove updated, err := filter.update(false) </s> add updated, err := filter.update(force) </s> remove // Count lines in the filter for _, line := range lines { line = strings.TrimSpace(line) if len(line) > 0 && line[0] == '!' { if m := filterTitle.FindAllStringSubmatch(line, -1); len(m) > 0 && len(m[0]) >= 2 && !seenTitle { filter.Name = m[0][1] seenTitle = true } } else if len(line) != 0 { rulesCount++ } </s> add if filterName != "" { filter.Name = filterName </s> remove log.Printf("Filter %d length is %d", filter.ID, len(filterFile)) filter.contents = filterFile </s> add log.Printf("Filter %d length is %d", filter.ID, len(filterFileContents)) filter.contents = filterFileContents // Now extract the rules count rulesCount, _ := parseFilterContents(filter.contents) filter.RulesCount = rulesCount </s> remove if force != "" { config.Lock() for i := range config.Filters { filter := &config.Filters[i] // otherwise we will be operating on a copy filter.LastUpdated = time.Unix(0, 0) } config.Unlock() // not defer because refreshFiltersIfNeccessary locks it too } updated := refreshFiltersIfNeccessary() </s> add updated := checkFiltersUpdates(force != "")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
rulesCount, filterName := parseFilterContents(body)
<mask> return false, err <mask> } <mask> <mask> // Extract filter name and count number of rules <mask> lines := strings.Split(string(body), "\n") <mask> rulesCount := 0 <mask> seenTitle := false <mask> <mask> // Count lines in the filter <mask> for _, line := range lines { <mask> line = strings.TrimSpace(line) <mask> if len(line) > 0 && line[0] == '!' { </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove // Count lines in the filter for _, line := range lines { line = strings.TrimSpace(line) if len(line) > 0 && line[0] == '!' { if m := filterTitle.FindAllStringSubmatch(line, -1); len(m) > 0 && len(m[0]) >= 2 && !seenTitle { filter.Name = m[0][1] seenTitle = true } } else if len(line) != 0 { rulesCount++ } </s> add if filterName != "" { filter.Name = filterName </s> remove jsonentry["rule"] = entry.Result.Rule </s> add jsonEntry["rule"] = entry.Result.Rule jsonEntry["filterId"] = entry.Result.FilterID </s> remove // deduplicate // TODO: move it somewhere else { i := 0 // output index, used for deletion later urls := map[string]bool{} for _, filter := range config.Filters { if _, ok := urls[filter.URL]; !ok { // we didn't see it before, keep it urls[filter.URL] = true // remember the URL config.Filters[i] = filter i++ } } // all entries we want to keep are at front, delete the rest config.Filters = config.Filters[:i] } </s> add </s> remove configtext := configBytes.String() </s> add configText := configBytes.String() </s> remove configtext = removeEmptyLines.ReplaceAllString(configtext, "\n") return configtext, nil </s> add configText = removeEmptyLines.ReplaceAllString(configText, "\n") return configText, nil
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
if filterName != "" { filter.Name = filterName
<mask> lines := strings.Split(string(body), "\n") <mask> rulesCount := 0 <mask> seenTitle := false <mask> <mask> // Count lines in the filter <mask> for _, line := range lines { <mask> line = strings.TrimSpace(line) <mask> if len(line) > 0 && line[0] == '!' { <mask> if m := filterTitle.FindAllStringSubmatch(line, -1); len(m) > 0 && len(m[0]) >= 2 && !seenTitle { <mask> filter.Name = m[0][1] <mask> seenTitle = true <mask> } <mask> } else if len(line) != 0 { <mask> rulesCount++ <mask> } <mask> } <mask> <mask> // Check if the filter was really changed <mask> if bytes.Equal(filter.contents, body) { <mask> return false, nil </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove lines := strings.Split(string(body), "\n") rulesCount := 0 seenTitle := false </s> add rulesCount, filterName := parseFilterContents(body) </s> remove jsonentry["rule"] = entry.Result.Rule </s> add jsonEntry["rule"] = entry.Result.Rule jsonEntry["filterId"] = entry.Result.FilterID </s> remove // Check if the filter was really changed </s> add // Check if the filter has been really changed </s> remove jsonentry["status"] = status.String() </s> add jsonEntry["status"] = status.String() </s> remove // deduplicate // TODO: move it somewhere else { i := 0 // output index, used for deletion later urls := map[string]bool{} for _, filter := range config.Filters { if _, ok := urls[filter.URL]; !ok { // we didn't see it before, keep it urls[filter.URL] = true // remember the URL config.Filters[i] = filter i++ } } // all entries we want to keep are at front, delete the rest config.Filters = config.Filters[:i] } </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
// Check if the filter has been really changed
<mask> rulesCount++ <mask> } <mask> } <mask> <mask> // Check if the filter was really changed <mask> if bytes.Equal(filter.contents, body) { <mask> return false, nil <mask> } <mask> <mask> log.Printf("Filter %s updated: %d bytes, %d rules", filter.URL, len(body), rulesCount) </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove log.Printf("Filter %s updated: %d bytes, %d rules", filter.URL, len(body), rulesCount) </s> add log.Printf("Filter %d has been updated: %d bytes, %d rules", filter.ID, len(body), rulesCount) </s> remove // Saving it to the filters dir now err = filter.save() if err != nil { return false, nil } </s> add </s> remove // Count lines in the filter for _, line := range lines { line = strings.TrimSpace(line) if len(line) > 0 && line[0] == '!' { if m := filterTitle.FindAllStringSubmatch(line, -1); len(m) > 0 && len(m[0]) >= 2 && !seenTitle { filter.Name = m[0][1] seenTitle = true } } else if len(line) != 0 { rulesCount++ } </s> add if filterName != "" { filter.Name = filterName </s> remove log.Printf("Filter %d length is %d", filter.ID, len(filterFile)) filter.contents = filterFile </s> add log.Printf("Filter %d length is %d", filter.ID, len(filterFileContents)) filter.contents = filterFileContents // Now extract the rules count rulesCount, _ := parseFilterContents(filter.contents) filter.RulesCount = rulesCount
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
log.Printf("The filter %d text has not changed", filter.ID)
<mask> // Check if the filter has been really changed <mask> if bytes.Equal(filter.contents, body) { <mask> return false, nil <mask> } <mask> <mask> log.Printf("Filter %d has been updated: %d bytes, %d rules", filter.ID, len(body), rulesCount) <mask> filter.RulesCount = rulesCount <mask> filter.contents = body </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove log.Printf("Filter %s updated: %d bytes, %d rules", filter.URL, len(body), rulesCount) </s> add log.Printf("Filter %d has been updated: %d bytes, %d rules", filter.ID, len(body), rulesCount) </s> remove // Check if the filter was really changed </s> add // Check if the filter has been really changed </s> remove // Saving it to the filters dir now err = filter.save() if err != nil { return false, nil } </s> add </s> remove log.Printf("Filter %d length is %d", filter.ID, len(filterFile)) filter.contents = filterFile </s> add log.Printf("Filter %d length is %d", filter.ID, len(filterFileContents)) filter.contents = filterFileContents // Now extract the rules count rulesCount, _ := parseFilterContents(filter.contents) filter.RulesCount = rulesCount </s> remove // Count lines in the filter for _, line := range lines { line = strings.TrimSpace(line) if len(line) > 0 && line[0] == '!' { if m := filterTitle.FindAllStringSubmatch(line, -1); len(m) > 0 && len(m[0]) >= 2 && !seenTitle { filter.Name = m[0][1] seenTitle = true } } else if len(line) != 0 { rulesCount++ } </s> add if filterName != "" { filter.Name = filterName
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
log.Printf("Filter %d has been updated: %d bytes, %d rules", filter.ID, len(body), rulesCount)
<mask> if bytes.Equal(filter.contents, body) { <mask> return false, nil <mask> } <mask> <mask> log.Printf("Filter %s updated: %d bytes, %d rules", filter.URL, len(body), rulesCount) <mask> filter.RulesCount = rulesCount <mask> filter.contents = body <mask> <mask> // Saving it to the filters dir now <mask> err = filter.save() </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove // Saving it to the filters dir now err = filter.save() if err != nil { return false, nil } </s> add </s> remove // Check if the filter was really changed </s> add // Check if the filter has been really changed </s> remove log.Printf("Filter %d length is %d", filter.ID, len(filterFile)) filter.contents = filterFile </s> add log.Printf("Filter %d length is %d", filter.ID, len(filterFileContents)) filter.contents = filterFileContents // Now extract the rules count rulesCount, _ := parseFilterContents(filter.contents) filter.RulesCount = rulesCount
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
<mask> log.Printf("Filter %s updated: %d bytes, %d rules", filter.URL, len(body), rulesCount) <mask> filter.RulesCount = rulesCount <mask> filter.contents = body <mask> <mask> // Saving it to the filters dir now <mask> err = filter.save() <mask> if err != nil { <mask> return false, nil <mask> } <mask> <mask> return true, nil <mask> } <mask> <mask> // saves filter contents to the file in config.ourDataDir <mask> func (filter *filter) save() error { </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove log.Printf("Filter %s updated: %d bytes, %d rules", filter.URL, len(body), rulesCount) </s> add log.Printf("Filter %d has been updated: %d bytes, %d rules", filter.ID, len(body), rulesCount) </s> remove // Check if the filter was really changed </s> add // Check if the filter has been really changed </s> remove log.Printf("Filter %d length is %d", filter.ID, len(filterFile)) filter.contents = filterFile </s> add log.Printf("Filter %d length is %d", filter.ID, len(filterFileContents)) filter.contents = filterFileContents // Now extract the rules count rulesCount, _ := parseFilterContents(filter.contents) filter.RulesCount = rulesCount </s> remove return nil; </s> add return nil
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
return nil
<mask> if err != nil { <mask> return err <mask> } <mask> <mask> return nil; <mask> } <mask> <mask> // loads filter contents from the file in config.ourDataDir <mask> func (filter *filter) load() error { <mask> </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove // Saving it to the filters dir now err = filter.save() if err != nil { return false, nil } </s> add </s> remove log.Printf("Filter %d length is %d", filter.ID, len(filterFile)) filter.contents = filterFile </s> add log.Printf("Filter %d length is %d", filter.ID, len(filterFileContents)) filter.contents = filterFileContents // Now extract the rules count rulesCount, _ := parseFilterContents(filter.contents) filter.RulesCount = rulesCount
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
filterFileContents, err := ioutil.ReadFile(filterFilePath)
<mask> // do nothing, file doesn't exist <mask> return err <mask> } <mask> <mask> filterFile, err := ioutil.ReadFile(filterFilePath) <mask> if err != nil { <mask> return err <mask> } <mask> <mask> log.Printf("Filter %d length is %d", filter.ID, len(filterFile)) </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove log.Printf("Filter %d length is %d", filter.ID, len(filterFile)) filter.contents = filterFile </s> add log.Printf("Filter %d length is %d", filter.ID, len(filterFileContents)) filter.contents = filterFileContents // Now extract the rules count rulesCount, _ := parseFilterContents(filter.contents) filter.RulesCount = rulesCount </s> remove yamlFile, err := ioutil.ReadFile(configfile) </s> add yamlFile, err := ioutil.ReadFile(configFile) </s> remove log.Printf("YAML file doesn't exist, skipping: %s", configfile) </s> add log.Printf("YAML file doesn't exist, skipping: %s", configFile) </s> remove configfile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename) log.Printf("Reading YAML file: %s", configfile) if _, err := os.Stat(configfile); os.IsNotExist(err) { </s> add configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename) log.Printf("Reading YAML file: %s", configFile) if _, err := os.Stat(configFile); os.IsNotExist(err) { </s> remove // Saving it to the filters dir now err = filter.save() if err != nil { return false, nil } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
log.Printf("Filter %d length is %d", filter.ID, len(filterFileContents)) filter.contents = filterFileContents // Now extract the rules count rulesCount, _ := parseFilterContents(filter.contents) filter.RulesCount = rulesCount
<mask> if err != nil { <mask> return err <mask> } <mask> <mask> log.Printf("Filter %d length is %d", filter.ID, len(filterFile)) <mask> filter.contents = filterFile <mask> return nil <mask> } <mask> <mask> // Path to the filter contents <mask> func (filter *filter) getFilterFilePath() string { </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove filterFile, err := ioutil.ReadFile(filterFilePath) </s> add filterFileContents, err := ioutil.ReadFile(filterFilePath) </s> remove // Saving it to the filters dir now err = filter.save() if err != nil { return false, nil } </s> add </s> remove return filepath.Join(config.ourBinaryDir, config.ourDataDir, FiltersDir, strconv.Itoa(filter.ID) + ".txt") </s> add return filepath.Join(config.ourBinaryDir, config.ourDataDir, FiltersDir, strconv.Itoa(filter.ID)+".txt") </s> remove return nil; </s> add return nil </s> remove log.Printf("Filter %s updated: %d bytes, %d rules", filter.URL, len(body), rulesCount) </s> add log.Printf("Filter %d has been updated: %d bytes, %d rules", filter.ID, len(body), rulesCount)
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
return filepath.Join(config.ourBinaryDir, config.ourDataDir, FiltersDir, strconv.Itoa(filter.ID)+".txt")
<mask> } <mask> <mask> // Path to the filter contents <mask> func (filter *filter) getFilterFilePath() string { <mask> return filepath.Join(config.ourBinaryDir, config.ourDataDir, FiltersDir, strconv.Itoa(filter.ID) + ".txt") <mask> } <mask> <mask> // ------------ <mask> // safebrowsing <mask> // ------------ </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove log.Printf("Filter %d length is %d", filter.ID, len(filterFile)) filter.contents = filterFile </s> add log.Printf("Filter %d length is %d", filter.ID, len(filterFileContents)) filter.contents = filterFileContents // Now extract the rules count rulesCount, _ := parseFilterContents(filter.contents) filter.RulesCount = rulesCount </s> remove return nil; </s> add return nil </s> remove // Saving it to the filters dir now err = filter.save() if err != nil { return false, nil } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
//noinspection GoUnusedParameter
<mask> } <mask> <mask> func handleSafeBrowsingStatus(w http.ResponseWriter, r *http.Request) { <mask> data := map[string]interface{}{ <mask> "enabled": config.CoreDNS.SafeBrowsingEnabled, <mask> } <mask> jsonVal, err := json.Marshal(data) </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove data = append(data, jsonentry) </s> add data = append(data, jsonEntry)
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
//noinspection GoUnusedParameter
<mask> config.CoreDNS.ParentalEnabled = false <mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleParentalStatus(w http.ResponseWriter, r *http.Request) { <mask> data := map[string]interface{}{ <mask> "enabled": config.CoreDNS.ParentalEnabled, <mask> } <mask> if config.CoreDNS.ParentalEnabled { <mask> data["sensitivity"] = config.CoreDNS.ParentalSensitivity </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove // TODO: Start using filter ID </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
//noinspection GoUnusedParameter
<mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleSafeSearchStatus(w http.ResponseWriter, r *http.Request) { <mask> data := map[string]interface{}{ <mask> "enabled": config.CoreDNS.SafeSearchEnabled, <mask> } <mask> jsonVal, err := json.Marshal(data) </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove data = append(data, jsonentry) </s> add data = append(data, jsonEntry)
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
http.HandleFunc("/control/querylog", optionalAuth(ensureGET(coreDnsPlugin.HandleQueryLog)))
<mask> func registerControlHandlers() { <mask> http.HandleFunc("/control/status", optionalAuth(ensureGET(handleStatus))) <mask> http.HandleFunc("/control/enable_protection", optionalAuth(ensurePOST(handleProtectionEnable))) <mask> http.HandleFunc("/control/disable_protection", optionalAuth(ensurePOST(handleProtectionDisable))) <mask> http.HandleFunc("/control/querylog", optionalAuth(ensureGET(coredns_plugin.HandleQueryLog))) <mask> http.HandleFunc("/control/querylog_enable", optionalAuth(ensurePOST(handleQueryLogEnable))) <mask> http.HandleFunc("/control/querylog_disable", optionalAuth(ensurePOST(handleQueryLogDisable))) <mask> http.HandleFunc("/control/set_upstream_dns", optionalAuth(ensurePOST(handleSetUpstreamDNS))) <mask> http.HandleFunc("/control/test_upstream_dns", optionalAuth(ensurePOST(handleTestUpstreamDNS))) <mask> http.HandleFunc("/control/stats_top", optionalAuth(ensureGET(coredns_plugin.HandleStatsTop))) </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove http.HandleFunc("/control/stats_top", optionalAuth(ensureGET(coredns_plugin.HandleStatsTop))) http.HandleFunc("/control/stats", optionalAuth(ensureGET(coredns_plugin.HandleStats))) http.HandleFunc("/control/stats_history", optionalAuth(ensureGET(coredns_plugin.HandleStatsHistory))) http.HandleFunc("/control/stats_reset", optionalAuth(ensurePOST(coredns_plugin.HandleStatsReset))) </s> add http.HandleFunc("/control/stats_top", optionalAuth(ensureGET(coreDnsPlugin.HandleStatsTop))) http.HandleFunc("/control/stats", optionalAuth(ensureGET(coreDnsPlugin.HandleStats))) http.HandleFunc("/control/stats_history", optionalAuth(ensureGET(coreDnsPlugin.HandleStatsHistory))) http.HandleFunc("/control/stats_reset", optionalAuth(ensurePOST(coreDnsPlugin.HandleStatsReset))) </s> remove runFilterRefreshers() </s> add runFiltersUpdatesTimer() </s> remove for range time.Tick(time.Second) { refreshFiltersIfNeccessary() </s> add for range time.Tick(time.Minute) { checkFiltersUpdates(false) </s> remove func runFilterRefreshers() { </s> add // Sets up a timer that will be checking for filters updates periodically func runFiltersUpdatesTimer() { </s> remove coredns_plugin.Reload <- true </s> add coreDnsPlugin.Reload <- true
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
http.HandleFunc("/control/stats_top", optionalAuth(ensureGET(coreDnsPlugin.HandleStatsTop))) http.HandleFunc("/control/stats", optionalAuth(ensureGET(coreDnsPlugin.HandleStats))) http.HandleFunc("/control/stats_history", optionalAuth(ensureGET(coreDnsPlugin.HandleStatsHistory))) http.HandleFunc("/control/stats_reset", optionalAuth(ensurePOST(coreDnsPlugin.HandleStatsReset)))
<mask> http.HandleFunc("/control/querylog_enable", optionalAuth(ensurePOST(handleQueryLogEnable))) <mask> http.HandleFunc("/control/querylog_disable", optionalAuth(ensurePOST(handleQueryLogDisable))) <mask> http.HandleFunc("/control/set_upstream_dns", optionalAuth(ensurePOST(handleSetUpstreamDNS))) <mask> http.HandleFunc("/control/test_upstream_dns", optionalAuth(ensurePOST(handleTestUpstreamDNS))) <mask> http.HandleFunc("/control/stats_top", optionalAuth(ensureGET(coredns_plugin.HandleStatsTop))) <mask> http.HandleFunc("/control/stats", optionalAuth(ensureGET(coredns_plugin.HandleStats))) <mask> http.HandleFunc("/control/stats_history", optionalAuth(ensureGET(coredns_plugin.HandleStatsHistory))) <mask> http.HandleFunc("/control/stats_reset", optionalAuth(ensurePOST(coredns_plugin.HandleStatsReset))) <mask> http.HandleFunc("/control/version.json", optionalAuth(handleGetVersionJSON)) <mask> http.HandleFunc("/control/filtering/enable", optionalAuth(ensurePOST(handleFilteringEnable))) <mask> http.HandleFunc("/control/filtering/disable", optionalAuth(ensurePOST(handleFilteringDisable))) <mask> http.HandleFunc("/control/filtering/add_url", optionalAuth(ensurePUT(handleFilteringAddURL))) <mask> http.HandleFunc("/control/filtering/remove_url", optionalAuth(ensureDELETE(handleFilteringRemoveURL))) </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove http.HandleFunc("/control/querylog", optionalAuth(ensureGET(coredns_plugin.HandleQueryLog))) </s> add http.HandleFunc("/control/querylog", optionalAuth(ensureGET(coreDnsPlugin.HandleQueryLog))) </s> remove urls: - 'https://filters.adtidy.org/windows/filters/1.txt' - 'https://filters.adtidy.org/windows/filters/2.txt' </s> add - filters: enabled: true id: 1 lastUpdated: "2018-10-30T12:18:57.223101822+03:00" name: "AdGuard Simplified Domain Names filter" rulesCount: 24896 url: "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt" </s> remove var filterTitle = regexp.MustCompile(`^! Title: +(.*)$`) </s> add var filterTitleRegexp = regexp.MustCompile(`^! Title: +(.*)$`) </s> remove coredns_plugin.Reload <- true </s> add coreDnsPlugin.Reload <- true
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
control.go
<mask> queryLogRotationPeriod = time.Hour * 24 // rotate the log every 24 hours <mask> queryLogFileName = "querylog.json" // .gz added during compression <mask> queryLogSize = 5000 // maximum API response for /querylog <mask> queryLogTopSize = 500 // Keep in memory only top N values <mask> queryLogAPIPort = "8618" // 8618 is sha512sum of "querylog" then each byte summed <mask> ) <mask> <mask> var ( <mask> logBufferLock sync.RWMutex <mask> logBuffer []*logEntry </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove var filterTitle = regexp.MustCompile(`^! Title: +(.*)$`) </s> add var filterTitleRegexp = regexp.MustCompile(`^! Title: +(.*)$`) </s> remove queryLogTime time.Time </s> add </s> remove lines := strings.Split(string(body), "\n") rulesCount := 0 seenTitle := false </s> add rulesCount, filterName := parseFilterContents(body) </s> remove contents := []byte{} </s> add var contents []byte
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
coredns_plugin/querylog.go
<mask> logBuffer []*logEntry <mask> <mask> queryLogCache []*logEntry <mask> queryLogLock sync.RWMutex <mask> queryLogTime time.Time <mask> ) <mask> <mask> type logEntry struct { <mask> Question []byte <mask> Answer []byte `json:",omitempty"` // sometimes empty answers happen like binerdunt.top or rev2.globalrootservers.net </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove queryLogAPIPort = "8618" // 8618 is sha512sum of "querylog" then each byte summed </s> add </s> remove LastUpdated time.Time `json:"last_updated" yaml:"-"` </s> add LastUpdated time.Time `json:"lastUpdated" yaml:"last_updated"` </s> remove var filterTitle = regexp.MustCompile(`^! Title: +(.*)$`) </s> add var filterTitleRegexp = regexp.MustCompile(`^! Title: +(.*)$`) </s> remove ID int `json:"ID"` // auto-assigned when filter is added </s> add ID int `json:"id" yaml:"id"` // auto-assigned when filter is added (see NextFilterId) </s> remove RulesCount int `json:"rules_count" yaml:"-"` </s> add RulesCount int `json:"rulesCount" yaml:"-"`
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
coredns_plugin/querylog.go
//noinspection GoUnusedParameter
<mask> } <mask> } <mask> <mask> func HandleQueryLog(w http.ResponseWriter, r *http.Request) { <mask> queryLogLock.RLock() <mask> values := make([]*logEntry, len(queryLogCache)) <mask> copy(values, queryLogCache) <mask> queryLogLock.RUnlock() <mask> </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
coredns_plugin/querylog.go
jsonEntry := map[string]interface{}{
<mask> a = nil <mask> } <mask> } <mask> <mask> jsonentry := map[string]interface{}{ <mask> "reason": entry.Result.Reason.String(), <mask> "elapsed_ms": strconv.FormatFloat(entry.Elapsed.Seconds()*1000, 'f', -1, 64), <mask> "time": entry.Time.Format(time.RFC3339), <mask> "client": entry.IP, <mask> } </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove "elapsed_ms": strconv.FormatFloat(entry.Elapsed.Seconds()*1000, 'f', -1, 64), </s> add "elapsedMs": strconv.FormatFloat(entry.Elapsed.Seconds()*1000, 'f', -1, 64), </s> remove jsonentry["question"] = map[string]interface{}{ </s> add jsonEntry["question"] = map[string]interface{}{ </s> remove jsonentry["status"] = status.String() </s> add jsonEntry["status"] = status.String()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
coredns_plugin/querylog.go
"elapsedMs": strconv.FormatFloat(entry.Elapsed.Seconds()*1000, 'f', -1, 64),
<mask> } <mask> <mask> jsonentry := map[string]interface{}{ <mask> "reason": entry.Result.Reason.String(), <mask> "elapsed_ms": strconv.FormatFloat(entry.Elapsed.Seconds()*1000, 'f', -1, 64), <mask> "time": entry.Time.Format(time.RFC3339), <mask> "client": entry.IP, <mask> } <mask> if q != nil { <mask> jsonentry["question"] = map[string]interface{}{ </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove jsonentry := map[string]interface{}{ </s> add jsonEntry := map[string]interface{}{ </s> remove jsonentry["question"] = map[string]interface{}{ </s> add jsonEntry["question"] = map[string]interface{}{
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
coredns_plugin/querylog.go
jsonEntry["question"] = map[string]interface{}{
<mask> "time": entry.Time.Format(time.RFC3339), <mask> "client": entry.IP, <mask> } <mask> if q != nil { <mask> jsonentry["question"] = map[string]interface{}{ <mask> "host": strings.ToLower(strings.TrimSuffix(q.Question[0].Name, ".")), <mask> "type": dns.Type(q.Question[0].Qtype).String(), <mask> "class": dns.Class(q.Question[0].Qclass).String(), <mask> } <mask> } </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove "elapsed_ms": strconv.FormatFloat(entry.Elapsed.Seconds()*1000, 'f', -1, 64), </s> add "elapsedMs": strconv.FormatFloat(entry.Elapsed.Seconds()*1000, 'f', -1, 64), </s> remove jsonentry := map[string]interface{}{ </s> add jsonEntry := map[string]interface{}{ </s> remove jsonentry["status"] = status.String() </s> add jsonEntry["status"] = status.String()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
coredns_plugin/querylog.go
jsonEntry["status"] = status.String()
<mask> } <mask> <mask> if a != nil { <mask> status, _ := response.Typify(a, time.Now().UTC()) <mask> jsonentry["status"] = status.String() <mask> } <mask> if len(entry.Result.Rule) > 0 { <mask> jsonentry["rule"] = entry.Result.Rule <mask> } <mask> </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove jsonentry["rule"] = entry.Result.Rule </s> add jsonEntry["rule"] = entry.Result.Rule jsonEntry["filterId"] = entry.Result.FilterID </s> remove // Count lines in the filter for _, line := range lines { line = strings.TrimSpace(line) if len(line) > 0 && line[0] == '!' { if m := filterTitle.FindAllStringSubmatch(line, -1); len(m) > 0 && len(m[0]) >= 2 && !seenTitle { filter.Name = m[0][1] seenTitle = true } } else if len(line) != 0 { rulesCount++ } </s> add if filterName != "" { filter.Name = filterName </s> remove log.Printf("Filter %d length is %d", filter.ID, len(filterFile)) filter.contents = filterFile </s> add log.Printf("Filter %d length is %d", filter.ID, len(filterFileContents)) filter.contents = filterFileContents // Now extract the rules count rulesCount, _ := parseFilterContents(filter.contents) filter.RulesCount = rulesCount
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
coredns_plugin/querylog.go
jsonEntry["rule"] = entry.Result.Rule jsonEntry["filterId"] = entry.Result.FilterID
<mask> status, _ := response.Typify(a, time.Now().UTC()) <mask> jsonentry["status"] = status.String() <mask> } <mask> if len(entry.Result.Rule) > 0 { <mask> jsonentry["rule"] = entry.Result.Rule <mask> } <mask> <mask> if a != nil && len(a.Answer) > 0 { <mask> var answers = []map[string]interface{}{} <mask> for _, k := range a.Answer { </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove jsonentry["status"] = status.String() </s> add jsonEntry["status"] = status.String() </s> remove // Count lines in the filter for _, line := range lines { line = strings.TrimSpace(line) if len(line) > 0 && line[0] == '!' { if m := filterTitle.FindAllStringSubmatch(line, -1); len(m) > 0 && len(m[0]) >= 2 && !seenTitle { filter.Name = m[0][1] seenTitle = true } } else if len(line) != 0 { rulesCount++ } </s> add if filterName != "" { filter.Name = filterName </s> remove lines := strings.Split(string(body), "\n") rulesCount := 0 seenTitle := false </s> add rulesCount, filterName := parseFilterContents(body) </s> remove // deduplicate // TODO: move it somewhere else { i := 0 // output index, used for deletion later urls := map[string]bool{} for _, filter := range config.Filters { if _, ok := urls[filter.URL]; !ok { // we didn't see it before, keep it urls[filter.URL] = true // remember the URL config.Filters[i] = filter i++ } } // all entries we want to keep are at front, delete the rest config.Filters = config.Filters[:i] } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
coredns_plugin/querylog.go
jsonEntry["answer"] = answers
<mask> answer["value"] = v <mask> } <mask> answers = append(answers, answer) <mask> } <mask> jsonentry["answer"] = answers <mask> } <mask> <mask> data = append(data, jsonentry) <mask> } <mask> </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove data = append(data, jsonentry) </s> add data = append(data, jsonEntry) </s> remove jsonentry["rule"] = entry.Result.Rule </s> add jsonEntry["rule"] = entry.Result.Rule jsonEntry["filterId"] = entry.Result.FilterID </s> remove jsonentry["status"] = status.String() </s> add jsonEntry["status"] = status.String()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
coredns_plugin/querylog.go
data = append(data, jsonEntry)
<mask> } <mask> jsonentry["answer"] = answers <mask> } <mask> <mask> data = append(data, jsonentry) <mask> } <mask> <mask> jsonVal, err := json.Marshal(data) <mask> if err != nil { <mask> errortext := fmt.Sprintf("Couldn't marshal data into json: %s", err) </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove errortext := fmt.Sprintf("Couldn't marshal data into json: %s", err) log.Println(errortext) http.Error(w, errortext, http.StatusInternalServerError) </s> add errorText := fmt.Sprintf("Couldn't marshal data into json: %s", err) log.Println(errorText) http.Error(w, errorText, http.StatusInternalServerError) </s> remove jsonentry["answer"] = answers </s> add jsonEntry["answer"] = answers </s> remove errortext := fmt.Sprintf("Unable to write response json: %s", err) log.Println(errortext) http.Error(w, errortext, http.StatusInternalServerError) </s> add errorText := fmt.Sprintf("Unable to write response json: %s", err) log.Println(errorText) http.Error(w, errorText, http.StatusInternalServerError)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
coredns_plugin/querylog.go
errorText := fmt.Sprintf("Couldn't marshal data into json: %s", err) log.Println(errorText) http.Error(w, errorText, http.StatusInternalServerError)
<mask> } <mask> <mask> jsonVal, err := json.Marshal(data) <mask> if err != nil { <mask> errortext := fmt.Sprintf("Couldn't marshal data into json: %s", err) <mask> log.Println(errortext) <mask> http.Error(w, errortext, http.StatusInternalServerError) <mask> return <mask> } <mask> <mask> w.Header().Set("Content-Type", "application/json") <mask> _, err = w.Write(jsonVal) </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove data = append(data, jsonentry) </s> add data = append(data, jsonEntry) </s> remove errortext := fmt.Sprintf("Unable to write response json: %s", err) log.Println(errortext) http.Error(w, errortext, http.StatusInternalServerError) </s> add errorText := fmt.Sprintf("Unable to write response json: %s", err) log.Println(errorText) http.Error(w, errorText, http.StatusInternalServerError) </s> remove errortext := fmt.Sprintf("Couldn't write body: %s", err) log.Println(errortext) http.Error(w, errortext, http.StatusInternalServerError) </s> add errorText := fmt.Sprintf("Couldn't write body: %s", err) log.Println(errorText) http.Error(w, errorText, http.StatusInternalServerError) </s> remove errortext := fmt.Sprintf("Couldn't remove the filter file: %s", err) http.Error(w, errortext, http.StatusInternalServerError) </s> add errorText := fmt.Sprintf("Couldn't remove the filter file: %s", err) http.Error(w, errorText, http.StatusInternalServerError) </s> remove errortext := fmt.Sprintf("Couldn't write config file: %s", err) log.Println(errortext) http.Error(w, errortext, http.StatusInternalServerError) </s> add errorText := fmt.Sprintf("Couldn't write config file: %s", err) log.Println(errorText) http.Error(w, errorText, http.StatusInternalServerError)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
coredns_plugin/querylog.go
errorText := fmt.Sprintf("Unable to write response json: %s", err) log.Println(errorText) http.Error(w, errorText, http.StatusInternalServerError)
<mask> <mask> w.Header().Set("Content-Type", "application/json") <mask> _, err = w.Write(jsonVal) <mask> if err != nil { <mask> errortext := fmt.Sprintf("Unable to write response json: %s", err) <mask> log.Println(errortext) <mask> http.Error(w, errortext, http.StatusInternalServerError) <mask> } <mask> } <mask> <mask> func trace(format string, args ...interface{}) { <mask> pc := make([]uintptr, 10) // at least 1 entry needed </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove errortext := fmt.Sprintf("Couldn't marshal data into json: %s", err) log.Println(errortext) http.Error(w, errortext, http.StatusInternalServerError) </s> add errorText := fmt.Sprintf("Couldn't marshal data into json: %s", err) log.Println(errorText) http.Error(w, errorText, http.StatusInternalServerError) </s> remove errortext := fmt.Sprintf("Couldn't write body: %s", err) log.Println(errortext) http.Error(w, errortext, http.StatusInternalServerError) </s> add errorText := fmt.Sprintf("Couldn't write body: %s", err) log.Println(errorText) http.Error(w, errorText, http.StatusInternalServerError) </s> remove errortext := fmt.Sprintf("Couldn't write config file: %s", err) log.Println(errortext) http.Error(w, errortext, http.StatusInternalServerError) </s> add errorText := fmt.Sprintf("Couldn't write config file: %s", err) log.Println(errorText) http.Error(w, errorText, http.StatusInternalServerError) </s> remove // TODO: Start using filter ID </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
coredns_plugin/querylog.go
res.FilterID = rule.listID
<mask> res.Reason = FilteredBlackList <mask> res.IsFiltered = true <mask> if rule.isWhitelist { <mask> res.Reason = NotFilteredWhiteList <mask> res.IsFiltered = false <mask> } <mask> res.Rule = rule.text </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove // Count lines in the filter for _, line := range lines { line = strings.TrimSpace(line) if len(line) > 0 && line[0] == '!' { if m := filterTitle.FindAllStringSubmatch(line, -1); len(m) > 0 && len(m[0]) >= 2 && !seenTitle { filter.Name = m[0][1] seenTitle = true } } else if len(line) != 0 { rulesCount++ } </s> add if filterName != "" { filter.Name = filterName </s> remove jsonentry["status"] = status.String() </s> add jsonEntry["status"] = status.String() </s> remove jsonentry["rule"] = entry.Result.Rule </s> add jsonEntry["rule"] = entry.Result.Rule jsonEntry["filterId"] = entry.Result.FilterID
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
dnsfilter/dnsfilter.go
elapsedMs: '65.469556'
<mask> value: 94.100.180.201 <mask> - ttl: 55 <mask> type: A <mask> value: 217.69.139.200 <mask> elapsed_ms: '65.469556' <mask> question: <mask> class: IN <mask> host: mail.ru <mask> type: A <mask> reason: DNSFILTER_NOTFILTERED_NOTFOUND </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove elapsed_ms: '132.110929' </s> add elapsedMs: '132.110929' </s> remove - elapsed_ms: '0.15716999999999998' </s> add - elapsedMs: '0.15716999999999998' </s> remove urls: - 'https://filters.adtidy.org/windows/filters/1.txt' - 'https://filters.adtidy.org/windows/filters/2.txt' </s> add - filters: enabled: true id: 1 lastUpdated: "2018-10-30T12:18:57.223101822+03:00" name: "AdGuard Simplified Domain Names filter" rulesCount: 24896 url: "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt" </s> remove filter.Enabled = true </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
openapi.yaml
- elapsedMs: '0.15716999999999998'
<mask> type: A <mask> reason: DNSFILTER_NOTFILTERED_NOTFOUND <mask> status: NOERROR <mask> time: '2018-07-16T22:24:02+03:00' <mask> - elapsed_ms: '0.15716999999999998' <mask> question: <mask> class: IN <mask> host: doubleclick.net <mask> type: A <mask> reason: DNSFILTER_FILTERED_BLACKLIST </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove elapsed_ms: '65.469556' </s> add elapsedMs: '65.469556' </s> remove elapsed_ms: '132.110929' </s> add elapsedMs: '132.110929' </s> remove urls: - 'https://filters.adtidy.org/windows/filters/1.txt' - 'https://filters.adtidy.org/windows/filters/2.txt' </s> add - filters: enabled: true id: 1 lastUpdated: "2018-10-30T12:18:57.223101822+03:00" name: "AdGuard Simplified Domain Names filter" rulesCount: 24896 url: "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt" </s> remove filter.Enabled = true </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
openapi.yaml
elapsedMs: '132.110929'
<mask> - answer: <mask> - ttl: 299 <mask> type: A <mask> value: 176.103.133.78 <mask> elapsed_ms: '132.110929' <mask> question: <mask> class: IN <mask> host: wmconvirus.narod.ru <mask> type: A <mask> reason: DNSFILTER_FILTERED_SAFEBROWSING </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove elapsed_ms: '65.469556' </s> add elapsedMs: '65.469556' </s> remove - elapsed_ms: '0.15716999999999998' </s> add - elapsedMs: '0.15716999999999998' </s> remove urls: - 'https://filters.adtidy.org/windows/filters/1.txt' - 'https://filters.adtidy.org/windows/filters/2.txt' </s> add - filters: enabled: true id: 1 lastUpdated: "2018-10-30T12:18:57.223101822+03:00" name: "AdGuard Simplified Domain Names filter" rulesCount: 24896 url: "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt" </s> remove filter.Enabled = true </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
openapi.yaml
filterId: 1
<mask> host: wmconvirus.narod.ru <mask> type: A <mask> reason: DNSFILTER_FILTERED_SAFEBROWSING <mask> rule: adguard-malware-shavar <mask> status: NOERROR <mask> time: '2018-07-16T22:24:02+03:00' <mask> /querylog_enable: <mask> post: <mask> tags: <mask> - global </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove - elapsed_ms: '0.15716999999999998' </s> add - elapsedMs: '0.15716999999999998' </s> remove elapsed_ms: '132.110929' </s> add elapsedMs: '132.110929' </s> remove elapsed_ms: '65.469556' </s> add elapsedMs: '65.469556' </s> remove urls: - 'https://filters.adtidy.org/windows/filters/1.txt' - 'https://filters.adtidy.org/windows/filters/2.txt' </s> add - filters: enabled: true id: 1 lastUpdated: "2018-10-30T12:18:57.223101822+03:00" name: "AdGuard Simplified Domain Names filter" rulesCount: 24896 url: "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt" </s> remove filter.Enabled = true </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
openapi.yaml
- filters: enabled: true id: 1 lastUpdated: "2018-10-30T12:18:57.223101822+03:00" name: "AdGuard Simplified Domain Names filter" rulesCount: 24896 url: "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt"
<mask> description: OK <mask> examples: <mask> application/json: <mask> enabled: false <mask> urls: <mask> - 'https://filters.adtidy.org/windows/filters/1.txt' <mask> - 'https://filters.adtidy.org/windows/filters/2.txt' <mask> rules: <mask> - '@@||yandex.ru^|' <mask> /filtering/set_rules: <mask> put: <mask> tags: </s> Added filterId to the querylog Updated the openapi.yaml accordingly Some minor refactoring/renaming Fix other review comments </s> remove elapsed_ms: '132.110929' </s> add elapsedMs: '132.110929' </s> remove - elapsed_ms: '0.15716999999999998' </s> add - elapsedMs: '0.15716999999999998' </s> remove elapsed_ms: '65.469556' </s> add elapsedMs: '65.469556'
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
openapi.yaml
"encoding/json" "fmt"
<mask> <mask> import ( <mask> "encoding/hex" <mask> "net" <mask> "net/http" <mask> "path/filepath" <mask> "runtime" </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove "time" </s> add </s> remove staticIPStatus := "yes" </s> add </s> remove lj := staticLeaseJSON{} </s> add lj := Lease{} </s> remove othSrv["found"] = foundVal v6["other_server"] = othSrv result := map[string]interface{}{} result["v4"] = v4 result["v6"] = v6 </s> add </s> remove foundVal = "error" othSrv["error"] = err6.Error() </s> add result.V6.OtherServer.Found = "error" result.V6.OtherServer.Error = err6.Error()
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcpd.go
<mask> "net" <mask> "net/http" <mask> "os" <mask> "strings" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/sysutil" <mask> "github.com/AdguardTeam/AdGuardHome/internal/util" <mask> "github.com/AdguardTeam/golibs/jsonutil" <mask> "github.com/AdguardTeam/golibs/log" </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove staticIPStatus := "yes" </s> add </s> remove lj := staticLeaseJSON{} </s> add lj := Lease{} </s> remove othSrv["found"] = foundVal v6["other_server"] = othSrv result := map[string]interface{}{} result["v4"] = v4 result["v6"] = v6 </s> add </s> remove foundVal = "error" othSrv["error"] = err6.Error() </s> add result.V6.OtherServer.Found = "error" result.V6.OtherServer.Error = err6.Error()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
<mask> log.Info("DHCP: %s %s: %s", r.Method, r.URL, text) <mask> http.Error(w, text, code) <mask> } <mask> <mask> // []Lease -> JSON <mask> func convertLeases(inputLeases []Lease, includeExpires bool) []map[string]string { <mask> leases := []map[string]string{} <mask> for _, l := range inputLeases { <mask> lease := map[string]string{ <mask> "mac": l.HWAddr.String(), <mask> "ip": l.IP.String(), <mask> "hostname": l.Hostname, <mask> } <mask> <mask> if includeExpires { <mask> lease["expires"] = l.Expiry.Format(time.RFC3339) <mask> } <mask> <mask> leases = append(leases, lease) <mask> } <mask> return leases <mask> } <mask> <mask> type v4ServerConfJSON struct { <mask> GatewayIP net.IP `json:"gateway_ip"` <mask> SubnetMask net.IP `json:"subnet_mask"` <mask> RangeStart net.IP `json:"range_start"` <mask> RangeEnd net.IP `json:"range_end"` </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove GatewayIP net.IP `yaml:"gateway_ip"` SubnetMask net.IP `yaml:"subnet_mask"` </s> add GatewayIP net.IP `yaml:"gateway_ip" json:"gateway_ip"` SubnetMask net.IP `yaml:"subnet_mask" json:"subnet_mask"` </s> remove Enabled bool `yaml:"-"` InterfaceName string `yaml:"-"` </s> add Enabled bool `yaml:"-" json:"-"` InterfaceName string `yaml:"-" json:"-"` </s> remove func v4ServerConfToJSON(c V4ServerConf) v4ServerConfJSON { return v4ServerConfJSON{ GatewayIP: c.GatewayIP, SubnetMask: c.SubnetMask, RangeStart: c.RangeStart, RangeEnd: c.RangeEnd, LeaseDuration: c.LeaseDuration, } } </s> add </s> remove type staticLeaseJSON struct { HWAddr string `json:"mac"` IP net.IP `json:"ip"` Hostname string `json:"hostname"` } </s> add </s> remove var result []Lease </s> add // The function shouldn't return nil value because zero-length slice // behaves differently in cases like marshalling. Our front-end also // requires non-nil value in the response. result := []Lease{}
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
<mask> RangeEnd net.IP `json:"range_end"` <mask> LeaseDuration uint32 `json:"lease_duration"` <mask> } <mask> <mask> func v4ServerConfToJSON(c V4ServerConf) v4ServerConfJSON { <mask> return v4ServerConfJSON{ <mask> GatewayIP: c.GatewayIP, <mask> SubnetMask: c.SubnetMask, <mask> RangeStart: c.RangeStart, <mask> RangeEnd: c.RangeEnd, <mask> LeaseDuration: c.LeaseDuration, <mask> } <mask> } <mask> <mask> func v4JSONToServerConf(j v4ServerConfJSON) V4ServerConf { <mask> return V4ServerConf{ <mask> GatewayIP: j.GatewayIP.To4(), <mask> SubnetMask: j.SubnetMask.To4(), <mask> RangeStart: j.RangeStart.To4(), </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove GatewayIP: j.GatewayIP.To4(), SubnetMask: j.SubnetMask.To4(), RangeStart: j.RangeStart.To4(), RangeEnd: j.RangeEnd.To4(), </s> add GatewayIP: j.GatewayIP, SubnetMask: j.SubnetMask, RangeStart: j.RangeStart, RangeEnd: j.RangeEnd, </s> remove func v6ServerConfToJSON(c V6ServerConf) v6ServerConfJSON { return v6ServerConfJSON{ RangeStart: c.RangeStart, LeaseDuration: c.LeaseDuration, } } </s> add </s> remove // []Lease -> JSON func convertLeases(inputLeases []Lease, includeExpires bool) []map[string]string { leases := []map[string]string{} for _, l := range inputLeases { lease := map[string]string{ "mac": l.HWAddr.String(), "ip": l.IP.String(), "hostname": l.Hostname, } if includeExpires { lease["expires"] = l.Expiry.Format(time.RFC3339) } leases = append(leases, lease) } return leases } </s> add </s> remove type staticLeaseJSON struct { HWAddr string `json:"mac"` IP net.IP `json:"ip"` Hostname string `json:"hostname"` } </s> add </s> remove func (s *Server) handleDHCPStatus(w http.ResponseWriter, r *http.Request) { leases := convertLeases(s.Leases(LeasesDynamic), true) staticLeases := convertLeases(s.Leases(LeasesStatic), false) </s> add // dhcpStatusResponse is the response for /control/dhcp/status endpoint. type dhcpStatusResponse struct { Enabled bool `json:"enabled"` IfaceName string `json:"interface_name"` V4 V4ServerConf `json:"v4"` V6 V6ServerConf `json:"v6"` Leases []Lease `json:"leases"` StaticLeases []Lease `json:"static_leases"` }
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
GatewayIP: j.GatewayIP, SubnetMask: j.SubnetMask, RangeStart: j.RangeStart, RangeEnd: j.RangeEnd,
<mask> } <mask> <mask> func v4JSONToServerConf(j v4ServerConfJSON) V4ServerConf { <mask> return V4ServerConf{ <mask> GatewayIP: j.GatewayIP.To4(), <mask> SubnetMask: j.SubnetMask.To4(), <mask> RangeStart: j.RangeStart.To4(), <mask> RangeEnd: j.RangeEnd.To4(), <mask> LeaseDuration: j.LeaseDuration, <mask> } <mask> } <mask> <mask> type v6ServerConfJSON struct { </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove func v4ServerConfToJSON(c V4ServerConf) v4ServerConfJSON { return v4ServerConfJSON{ GatewayIP: c.GatewayIP, SubnetMask: c.SubnetMask, RangeStart: c.RangeStart, RangeEnd: c.RangeEnd, LeaseDuration: c.LeaseDuration, } } </s> add </s> remove func v6ServerConfToJSON(c V6ServerConf) v6ServerConfJSON { return v6ServerConfJSON{ RangeStart: c.RangeStart, LeaseDuration: c.LeaseDuration, } } </s> add </s> remove func (s *Server) handleDHCPStatus(w http.ResponseWriter, r *http.Request) { leases := convertLeases(s.Leases(LeasesDynamic), true) staticLeases := convertLeases(s.Leases(LeasesStatic), false) </s> add // dhcpStatusResponse is the response for /control/dhcp/status endpoint. type dhcpStatusResponse struct { Enabled bool `json:"enabled"` IfaceName string `json:"interface_name"` V4 V4ServerConf `json:"v4"` V6 V6ServerConf `json:"v6"` Leases []Lease `json:"leases"` StaticLeases []Lease `json:"static_leases"` } </s> remove type staticLeaseJSON struct { HWAddr string `json:"mac"` IP net.IP `json:"ip"` Hostname string `json:"hostname"` } </s> add </s> remove Enabled bool `yaml:"-"` InterfaceName string `yaml:"-"` </s> add Enabled bool `yaml:"-" json:"-"` InterfaceName string `yaml:"-" json:"-"`
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
<mask> RangeStart string `json:"range_start"` <mask> LeaseDuration uint32 `json:"lease_duration"` <mask> } <mask> <mask> func v6ServerConfToJSON(c V6ServerConf) v6ServerConfJSON { <mask> return v6ServerConfJSON{ <mask> RangeStart: c.RangeStart, <mask> LeaseDuration: c.LeaseDuration, <mask> } <mask> } <mask> <mask> func v6JSONToServerConf(j v6ServerConfJSON) V6ServerConf { <mask> return V6ServerConf{ <mask> RangeStart: j.RangeStart, <mask> LeaseDuration: j.LeaseDuration, <mask> } </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove func v4ServerConfToJSON(c V4ServerConf) v4ServerConfJSON { return v4ServerConfJSON{ GatewayIP: c.GatewayIP, SubnetMask: c.SubnetMask, RangeStart: c.RangeStart, RangeEnd: c.RangeEnd, LeaseDuration: c.LeaseDuration, } } </s> add </s> remove GatewayIP: j.GatewayIP.To4(), SubnetMask: j.SubnetMask.To4(), RangeStart: j.RangeStart.To4(), RangeEnd: j.RangeEnd.To4(), </s> add GatewayIP: j.GatewayIP, SubnetMask: j.SubnetMask, RangeStart: j.RangeStart, RangeEnd: j.RangeEnd, </s> remove func (s *Server) handleDHCPStatus(w http.ResponseWriter, r *http.Request) { leases := convertLeases(s.Leases(LeasesDynamic), true) staticLeases := convertLeases(s.Leases(LeasesStatic), false) </s> add // dhcpStatusResponse is the response for /control/dhcp/status endpoint. type dhcpStatusResponse struct { Enabled bool `json:"enabled"` IfaceName string `json:"interface_name"` V4 V4ServerConf `json:"v4"` V6 V6ServerConf `json:"v6"` Leases []Lease `json:"leases"` StaticLeases []Lease `json:"static_leases"` } </s> remove type staticLeaseJSON struct { HWAddr string `json:"mac"` IP net.IP `json:"ip"` Hostname string `json:"hostname"` } </s> add </s> remove // []Lease -> JSON func convertLeases(inputLeases []Lease, includeExpires bool) []map[string]string { leases := []map[string]string{} for _, l := range inputLeases { lease := map[string]string{ "mac": l.HWAddr.String(), "ip": l.IP.String(), "hostname": l.Hostname, } if includeExpires { lease["expires"] = l.Expiry.Format(time.RFC3339) } leases = append(leases, lease) } return leases } </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
// dhcpStatusResponse is the response for /control/dhcp/status endpoint. type dhcpStatusResponse struct { Enabled bool `json:"enabled"` IfaceName string `json:"interface_name"` V4 V4ServerConf `json:"v4"` V6 V6ServerConf `json:"v6"` Leases []Lease `json:"leases"` StaticLeases []Lease `json:"static_leases"` }
<mask> LeaseDuration: j.LeaseDuration, <mask> } <mask> } <mask> <mask> func (s *Server) handleDHCPStatus(w http.ResponseWriter, r *http.Request) { <mask> leases := convertLeases(s.Leases(LeasesDynamic), true) <mask> staticLeases := convertLeases(s.Leases(LeasesStatic), false) <mask> <mask> v4conf := V4ServerConf{} <mask> s.srv4.WriteDiskConfig4(&v4conf) <mask> <mask> v6conf := V6ServerConf{} </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove v4conf := V4ServerConf{} s.srv4.WriteDiskConfig4(&v4conf) </s> add func (s *Server) handleDHCPStatus(w http.ResponseWriter, r *http.Request) { status := &dhcpStatusResponse{ Enabled: s.conf.Enabled, IfaceName: s.conf.InterfaceName, V4: V4ServerConf{}, V6: V6ServerConf{}, } </s> remove v6conf := V6ServerConf{} s.srv6.WriteDiskConfig6(&v6conf) </s> add s.srv4.WriteDiskConfig4(&status.V4) s.srv6.WriteDiskConfig6(&status.V6) </s> remove lj := staticLeaseJSON{} </s> add lj := Lease{} </s> remove lj := staticLeaseJSON{} </s> add lj := Lease{} </s> remove response := map[string]interface{}{} </s> add response := map[string]netInterfaceJSON{}
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
func (s *Server) handleDHCPStatus(w http.ResponseWriter, r *http.Request) { status := &dhcpStatusResponse{ Enabled: s.conf.Enabled, IfaceName: s.conf.InterfaceName, V4: V4ServerConf{}, V6: V6ServerConf{}, }
<mask> func (s *Server) handleDHCPStatus(w http.ResponseWriter, r *http.Request) { <mask> leases := convertLeases(s.Leases(LeasesDynamic), true) <mask> staticLeases := convertLeases(s.Leases(LeasesStatic), false) <mask> <mask> v4conf := V4ServerConf{} <mask> s.srv4.WriteDiskConfig4(&v4conf) <mask> <mask> v6conf := V6ServerConf{} <mask> s.srv6.WriteDiskConfig6(&v6conf) <mask> <mask> status := map[string]interface{}{ </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove func (s *Server) handleDHCPStatus(w http.ResponseWriter, r *http.Request) { leases := convertLeases(s.Leases(LeasesDynamic), true) staticLeases := convertLeases(s.Leases(LeasesStatic), false) </s> add // dhcpStatusResponse is the response for /control/dhcp/status endpoint. type dhcpStatusResponse struct { Enabled bool `json:"enabled"` IfaceName string `json:"interface_name"` V4 V4ServerConf `json:"v4"` V6 V6ServerConf `json:"v6"` Leases []Lease `json:"leases"` StaticLeases []Lease `json:"static_leases"` } </s> remove v6conf := V6ServerConf{} s.srv6.WriteDiskConfig6(&v6conf) </s> add s.srv4.WriteDiskConfig4(&status.V4) s.srv6.WriteDiskConfig6(&status.V6) </s> remove lj := staticLeaseJSON{} </s> add lj := Lease{} </s> remove lj := staticLeaseJSON{} </s> add lj := Lease{} </s> remove response := map[string]interface{}{} </s> add response := map[string]netInterfaceJSON{}
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
s.srv4.WriteDiskConfig4(&status.V4) s.srv6.WriteDiskConfig6(&status.V6)
<mask> <mask> v4conf := V4ServerConf{} <mask> s.srv4.WriteDiskConfig4(&v4conf) <mask> <mask> v6conf := V6ServerConf{} <mask> s.srv6.WriteDiskConfig6(&v6conf) <mask> <mask> status := map[string]interface{}{ <mask> "enabled": s.conf.Enabled, <mask> "interface_name": s.conf.InterfaceName, <mask> "v4": v4ServerConfToJSON(v4conf), </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove status := map[string]interface{}{ "enabled": s.conf.Enabled, "interface_name": s.conf.InterfaceName, "v4": v4ServerConfToJSON(v4conf), "v6": v6ServerConfToJSON(v6conf), "leases": leases, "static_leases": staticLeases, } </s> add status.Leases = s.Leases(LeasesDynamic) status.StaticLeases = s.Leases(LeasesStatic) </s> remove v4conf := V4ServerConf{} s.srv4.WriteDiskConfig4(&v4conf) </s> add func (s *Server) handleDHCPStatus(w http.ResponseWriter, r *http.Request) { status := &dhcpStatusResponse{ Enabled: s.conf.Enabled, IfaceName: s.conf.InterfaceName, V4: V4ServerConf{}, V6: V6ServerConf{}, } </s> remove func (s *Server) handleDHCPStatus(w http.ResponseWriter, r *http.Request) { leases := convertLeases(s.Leases(LeasesDynamic), true) staticLeases := convertLeases(s.Leases(LeasesStatic), false) </s> add // dhcpStatusResponse is the response for /control/dhcp/status endpoint. type dhcpStatusResponse struct { Enabled bool `json:"enabled"` IfaceName string `json:"interface_name"` V4 V4ServerConf `json:"v4"` V6 V6ServerConf `json:"v6"` Leases []Lease `json:"leases"` StaticLeases []Lease `json:"static_leases"` } </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeBrowsingEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) } </s> add </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeSearchEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) return } </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
status.Leases = s.Leases(LeasesDynamic) status.StaticLeases = s.Leases(LeasesStatic)
<mask> <mask> v6conf := V6ServerConf{} <mask> s.srv6.WriteDiskConfig6(&v6conf) <mask> <mask> status := map[string]interface{}{ <mask> "enabled": s.conf.Enabled, <mask> "interface_name": s.conf.InterfaceName, <mask> "v4": v4ServerConfToJSON(v4conf), <mask> "v6": v6ServerConfToJSON(v6conf), <mask> "leases": leases, <mask> "static_leases": staticLeases, <mask> } <mask> <mask> w.Header().Set("Content-Type", "application/json") <mask> err := json.NewEncoder(w).Encode(status) <mask> if err != nil { <mask> httpError(r, w, http.StatusInternalServerError, "Unable to marshal DHCP status json: %s", err) </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove v6conf := V6ServerConf{} s.srv6.WriteDiskConfig6(&v6conf) </s> add s.srv4.WriteDiskConfig4(&status.V4) s.srv6.WriteDiskConfig6(&status.V6) </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeBrowsingEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) } </s> add </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeSearchEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) return } </s> add </s> remove data := map[string]interface{}{ "enabled": d.Config.ParentalEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) return } </s> add </s> remove _, err = w.Write(jsonVal) </s> add err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.SafeBrowsingEnabled, })
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
<mask> return <mask> } <mask> } <mask> <mask> type staticLeaseJSON struct { <mask> HWAddr string `json:"mac"` <mask> IP net.IP `json:"ip"` <mask> Hostname string `json:"hostname"` <mask> } <mask> <mask> type dhcpServerConfigJSON struct { <mask> Enabled bool `json:"enabled"` <mask> InterfaceName string `json:"interface_name"` <mask> V4 v4ServerConfJSON `json:"v4"` <mask> V6 v6ServerConfJSON `json:"v6"` </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove func (s *Server) handleDHCPStatus(w http.ResponseWriter, r *http.Request) { leases := convertLeases(s.Leases(LeasesDynamic), true) staticLeases := convertLeases(s.Leases(LeasesStatic), false) </s> add // dhcpStatusResponse is the response for /control/dhcp/status endpoint. type dhcpStatusResponse struct { Enabled bool `json:"enabled"` IfaceName string `json:"interface_name"` V4 V4ServerConf `json:"v4"` V6 V6ServerConf `json:"v6"` Leases []Lease `json:"leases"` StaticLeases []Lease `json:"static_leases"` } </s> remove Enabled bool `yaml:"-"` InterfaceName string `yaml:"-"` </s> add Enabled bool `yaml:"-" json:"-"` InterfaceName string `yaml:"-" json:"-"` </s> remove Enabled bool `yaml:"-"` InterfaceName string `yaml:"-"` </s> add Enabled bool `yaml:"-" json:"-"` InterfaceName string `yaml:"-" json:"-"` </s> remove GatewayIP net.IP `yaml:"gateway_ip"` SubnetMask net.IP `yaml:"subnet_mask"` </s> add GatewayIP net.IP `yaml:"gateway_ip" json:"gateway_ip"` SubnetMask net.IP `yaml:"subnet_mask" json:"subnet_mask"` </s> remove GatewayIP: j.GatewayIP.To4(), SubnetMask: j.SubnetMask.To4(), RangeStart: j.RangeStart.To4(), RangeEnd: j.RangeEnd.To4(), </s> add GatewayIP: j.GatewayIP, SubnetMask: j.SubnetMask, RangeStart: j.RangeStart, RangeEnd: j.RangeEnd,
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
response := map[string]netInterfaceJSON{}
<mask> Flags string `json:"flags"` <mask> } <mask> <mask> func (s *Server) handleDHCPInterfaces(w http.ResponseWriter, r *http.Request) { <mask> response := map[string]interface{}{} <mask> <mask> ifaces, err := util.GetValidNetInterfaces() <mask> if err != nil { <mask> httpError(r, w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) <mask> return </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove lj := staticLeaseJSON{} </s> add lj := Lease{} </s> remove lj := staticLeaseJSON{} </s> add lj := Lease{} </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeBrowsingEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) } </s> add </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeSearchEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) return } </s> add </s> remove data := map[string]interface{}{ "enabled": d.Config.ParentalEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) return } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
result := dhcpSearchResult{ V4: dhcpSearchV4Result{ OtherServer: dhcpSearchOtherResult{}, StaticIP: dhcpStaticIPStatus{}, }, V6: dhcpSearchV6Result{ OtherServer: dhcpSearchOtherResult{}, }, }
<mask> return <mask> } <mask> <mask> found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName) <mask> <mask> isStaticIP, err := sysutil.IfaceHasStaticIP(interfaceName) <mask> if err != nil { <mask> result.V4.StaticIP.Static = "error" <mask> result.V4.StaticIP.Error = err.Error() </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove staticIP := map[string]interface{}{} </s> add </s> remove staticIPStatus := "yes" </s> add </s> remove staticIPStatus = "error" staticIP["error"] = err.Error() </s> add result.V4.StaticIP.Static = "error" result.V4.StaticIP.Error = err.Error() </s> remove staticIPStatus = "no" staticIP["ip"] = util.GetSubnet(interfaceName) </s> add result.V4.StaticIP.Static = "no" result.V4.StaticIP.IP = util.GetSubnet(interfaceName) </s> remove v4 := map[string]interface{}{} othSrv := map[string]interface{}{} foundVal := "no" </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
<mask> } <mask> <mask> found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName) <mask> <mask> staticIP := map[string]interface{}{} <mask> isStaticIP, err := sysutil.IfaceHasStaticIP(interfaceName) <mask> staticIPStatus := "yes" <mask> if err != nil { <mask> staticIPStatus = "error" <mask> staticIP["error"] = err.Error() </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove staticIPStatus := "yes" </s> add </s> remove staticIPStatus = "error" staticIP["error"] = err.Error() </s> add result.V4.StaticIP.Static = "error" result.V4.StaticIP.Error = err.Error() </s> remove staticIPStatus = "no" staticIP["ip"] = util.GetSubnet(interfaceName) </s> add result.V4.StaticIP.Static = "no" result.V4.StaticIP.IP = util.GetSubnet(interfaceName) </s> remove v4 := map[string]interface{}{} othSrv := map[string]interface{}{} foundVal := "no" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
<mask> found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName) <mask> <mask> staticIP := map[string]interface{}{} <mask> isStaticIP, err := sysutil.IfaceHasStaticIP(interfaceName) <mask> staticIPStatus := "yes" <mask> if err != nil { <mask> staticIPStatus = "error" <mask> staticIP["error"] = err.Error() <mask> } else if !isStaticIP { <mask> staticIPStatus = "no" </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove staticIP := map[string]interface{}{} </s> add </s> remove staticIPStatus = "error" staticIP["error"] = err.Error() </s> add result.V4.StaticIP.Static = "error" result.V4.StaticIP.Error = err.Error() </s> remove staticIPStatus = "no" staticIP["ip"] = util.GetSubnet(interfaceName) </s> add result.V4.StaticIP.Static = "no" result.V4.StaticIP.IP = util.GetSubnet(interfaceName) </s> remove staticIP["static"] = staticIPStatus </s> add </s> remove v4 := map[string]interface{}{} othSrv := map[string]interface{}{} foundVal := "no" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
result.V4.StaticIP.Static = "error" result.V4.StaticIP.Error = err.Error()
<mask> staticIP := map[string]interface{}{} <mask> isStaticIP, err := sysutil.IfaceHasStaticIP(interfaceName) <mask> staticIPStatus := "yes" <mask> if err != nil { <mask> staticIPStatus = "error" <mask> staticIP["error"] = err.Error() <mask> } else if !isStaticIP { <mask> staticIPStatus = "no" <mask> staticIP["ip"] = util.GetSubnet(interfaceName) <mask> } <mask> staticIP["static"] = staticIPStatus </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove staticIPStatus := "yes" </s> add </s> remove staticIPStatus = "no" staticIP["ip"] = util.GetSubnet(interfaceName) </s> add result.V4.StaticIP.Static = "no" result.V4.StaticIP.IP = util.GetSubnet(interfaceName) </s> remove staticIP := map[string]interface{}{} </s> add </s> remove staticIP["static"] = staticIPStatus </s> add </s> remove v4 := map[string]interface{}{} othSrv := map[string]interface{}{} foundVal := "no" </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
result.V4.StaticIP.Static = "no" result.V4.StaticIP.IP = util.GetSubnet(interfaceName)
<mask> if err != nil { <mask> staticIPStatus = "error" <mask> staticIP["error"] = err.Error() <mask> } else if !isStaticIP { <mask> staticIPStatus = "no" <mask> staticIP["ip"] = util.GetSubnet(interfaceName) <mask> } <mask> staticIP["static"] = staticIPStatus <mask> <mask> v4 := map[string]interface{}{} <mask> othSrv := map[string]interface{}{} </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove staticIPStatus = "error" staticIP["error"] = err.Error() </s> add result.V4.StaticIP.Static = "error" result.V4.StaticIP.Error = err.Error() </s> remove staticIP["static"] = staticIPStatus </s> add </s> remove v4 := map[string]interface{}{} othSrv := map[string]interface{}{} foundVal := "no" </s> add </s> remove staticIPStatus := "yes" </s> add </s> remove staticIP := map[string]interface{}{} </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
<mask> } else if !isStaticIP { <mask> staticIPStatus = "no" <mask> staticIP["ip"] = util.GetSubnet(interfaceName) <mask> } <mask> staticIP["static"] = staticIPStatus <mask> <mask> v4 := map[string]interface{}{} <mask> othSrv := map[string]interface{}{} <mask> foundVal := "no" <mask> if found4 { </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove staticIPStatus = "no" staticIP["ip"] = util.GetSubnet(interfaceName) </s> add result.V4.StaticIP.Static = "no" result.V4.StaticIP.IP = util.GetSubnet(interfaceName) </s> remove v4 := map[string]interface{}{} othSrv := map[string]interface{}{} foundVal := "no" </s> add </s> remove staticIPStatus = "error" staticIP["error"] = err.Error() </s> add result.V4.StaticIP.Static = "error" result.V4.StaticIP.Error = err.Error() </s> remove foundVal = "yes" </s> add result.V4.OtherServer.Found = "yes" </s> remove staticIPStatus := "yes" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
<mask> staticIP["ip"] = util.GetSubnet(interfaceName) <mask> } <mask> staticIP["static"] = staticIPStatus <mask> <mask> v4 := map[string]interface{}{} <mask> othSrv := map[string]interface{}{} <mask> foundVal := "no" <mask> if found4 { <mask> foundVal = "yes" <mask> } else if err4 != nil { <mask> foundVal = "error" <mask> othSrv["error"] = err4.Error() </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove foundVal = "yes" </s> add result.V4.OtherServer.Found = "yes" </s> remove staticIP["static"] = staticIPStatus </s> add </s> remove foundVal = "error" othSrv["error"] = err4.Error() </s> add result.V4.OtherServer.Found = "error" result.V4.OtherServer.Error = err4.Error() </s> remove staticIPStatus = "no" staticIP["ip"] = util.GetSubnet(interfaceName) </s> add result.V4.StaticIP.Static = "no" result.V4.StaticIP.IP = util.GetSubnet(interfaceName) </s> remove foundVal = "yes" </s> add result.V6.OtherServer.Found = "yes"
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
result.V4.OtherServer.Found = "yes"
<mask> v4 := map[string]interface{}{} <mask> othSrv := map[string]interface{}{} <mask> foundVal := "no" <mask> if found4 { <mask> foundVal = "yes" <mask> } else if err4 != nil { <mask> foundVal = "error" <mask> othSrv["error"] = err4.Error() <mask> } <mask> othSrv["found"] = foundVal </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove v4 := map[string]interface{}{} othSrv := map[string]interface{}{} foundVal := "no" </s> add </s> remove foundVal = "error" othSrv["error"] = err4.Error() </s> add result.V4.OtherServer.Found = "error" result.V4.OtherServer.Error = err4.Error() </s> remove foundVal = "yes" </s> add result.V6.OtherServer.Found = "yes" </s> remove othSrv["found"] = foundVal v4["other_server"] = othSrv v4["static_ip"] = staticIP </s> add </s> remove foundVal = "error" othSrv["error"] = err6.Error() </s> add result.V6.OtherServer.Found = "error" result.V6.OtherServer.Error = err6.Error()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
result.V4.OtherServer.Found = "error" result.V4.OtherServer.Error = err4.Error()
<mask> foundVal := "no" <mask> if found4 { <mask> foundVal = "yes" <mask> } else if err4 != nil { <mask> foundVal = "error" <mask> othSrv["error"] = err4.Error() <mask> } <mask> othSrv["found"] = foundVal <mask> v4["other_server"] = othSrv <mask> v4["static_ip"] = staticIP <mask> </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove foundVal = "yes" </s> add result.V4.OtherServer.Found = "yes" </s> remove othSrv["found"] = foundVal v4["other_server"] = othSrv v4["static_ip"] = staticIP </s> add </s> remove v4 := map[string]interface{}{} othSrv := map[string]interface{}{} foundVal := "no" </s> add </s> remove v6 := map[string]interface{}{} othSrv = map[string]interface{}{} foundVal = "no" </s> add </s> remove foundVal = "yes" </s> add result.V6.OtherServer.Found = "yes"
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
<mask> } else if err4 != nil { <mask> foundVal = "error" <mask> othSrv["error"] = err4.Error() <mask> } <mask> othSrv["found"] = foundVal <mask> v4["other_server"] = othSrv <mask> v4["static_ip"] = staticIP <mask> <mask> found6, err6 := CheckIfOtherDHCPServersPresentV6(interfaceName) <mask> <mask> v6 := map[string]interface{}{} <mask> othSrv = map[string]interface{}{} </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove v6 := map[string]interface{}{} othSrv = map[string]interface{}{} foundVal = "no" </s> add </s> remove foundVal = "error" othSrv["error"] = err4.Error() </s> add result.V4.OtherServer.Found = "error" result.V4.OtherServer.Error = err4.Error() </s> remove foundVal = "yes" </s> add result.V4.OtherServer.Found = "yes" </s> remove foundVal = "yes" </s> add result.V6.OtherServer.Found = "yes" </s> remove v4 := map[string]interface{}{} othSrv := map[string]interface{}{} foundVal := "no" </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
<mask> v4["static_ip"] = staticIP <mask> <mask> found6, err6 := CheckIfOtherDHCPServersPresentV6(interfaceName) <mask> <mask> v6 := map[string]interface{}{} <mask> othSrv = map[string]interface{}{} <mask> foundVal = "no" <mask> if found6 { <mask> foundVal = "yes" <mask> } else if err6 != nil { <mask> foundVal = "error" <mask> othSrv["error"] = err6.Error() </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove othSrv["found"] = foundVal v4["other_server"] = othSrv v4["static_ip"] = staticIP </s> add </s> remove foundVal = "yes" </s> add result.V6.OtherServer.Found = "yes" </s> remove foundVal = "error" othSrv["error"] = err6.Error() </s> add result.V6.OtherServer.Found = "error" result.V6.OtherServer.Error = err6.Error() </s> remove foundVal = "error" othSrv["error"] = err4.Error() </s> add result.V4.OtherServer.Found = "error" result.V4.OtherServer.Error = err4.Error() </s> remove foundVal = "yes" </s> add result.V4.OtherServer.Found = "yes"
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
result.V6.OtherServer.Found = "yes"
<mask> v6 := map[string]interface{}{} <mask> othSrv = map[string]interface{}{} <mask> foundVal = "no" <mask> if found6 { <mask> foundVal = "yes" <mask> } else if err6 != nil { <mask> foundVal = "error" <mask> othSrv["error"] = err6.Error() <mask> } <mask> othSrv["found"] = foundVal </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove v6 := map[string]interface{}{} othSrv = map[string]interface{}{} foundVal = "no" </s> add </s> remove foundVal = "error" othSrv["error"] = err6.Error() </s> add result.V6.OtherServer.Found = "error" result.V6.OtherServer.Error = err6.Error() </s> remove foundVal = "yes" </s> add result.V4.OtherServer.Found = "yes" </s> remove othSrv["found"] = foundVal v4["other_server"] = othSrv v4["static_ip"] = staticIP </s> add </s> remove v4 := map[string]interface{}{} othSrv := map[string]interface{}{} foundVal := "no" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
result.V6.OtherServer.Found = "error" result.V6.OtherServer.Error = err6.Error()
<mask> foundVal = "no" <mask> if found6 { <mask> foundVal = "yes" <mask> } else if err6 != nil { <mask> foundVal = "error" <mask> othSrv["error"] = err6.Error() <mask> } <mask> othSrv["found"] = foundVal <mask> v6["other_server"] = othSrv <mask> <mask> result := map[string]interface{}{} </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove foundVal = "yes" </s> add result.V6.OtherServer.Found = "yes" </s> remove v6 := map[string]interface{}{} othSrv = map[string]interface{}{} foundVal = "no" </s> add </s> remove foundVal = "yes" </s> add result.V4.OtherServer.Found = "yes" </s> remove othSrv["found"] = foundVal v6["other_server"] = othSrv result := map[string]interface{}{} result["v4"] = v4 result["v6"] = v6 </s> add </s> remove foundVal = "error" othSrv["error"] = err4.Error() </s> add result.V4.OtherServer.Found = "error" result.V4.OtherServer.Error = err4.Error()
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
<mask> } else if err6 != nil { <mask> foundVal = "error" <mask> othSrv["error"] = err6.Error() <mask> } <mask> othSrv["found"] = foundVal <mask> v6["other_server"] = othSrv <mask> <mask> result := map[string]interface{}{} <mask> result["v4"] = v4 <mask> result["v6"] = v6 <mask> <mask> w.Header().Set("Content-Type", "application/json") <mask> err = json.NewEncoder(w).Encode(result) <mask> if err != nil { <mask> httpError(r, w, http.StatusInternalServerError, "Failed to marshal DHCP found json: %s", err) </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove foundVal = "error" othSrv["error"] = err6.Error() </s> add result.V6.OtherServer.Found = "error" result.V6.OtherServer.Error = err6.Error() </s> remove foundVal = "yes" </s> add result.V6.OtherServer.Found = "yes" </s> remove v6 := map[string]interface{}{} othSrv = map[string]interface{}{} foundVal = "no" </s> add </s> remove othSrv["found"] = foundVal v4["other_server"] = othSrv v4["static_ip"] = staticIP </s> add </s> remove foundVal = "yes" </s> add result.V4.OtherServer.Found = "yes"
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
lj := Lease{}
<mask> } <mask> } <mask> <mask> func (s *Server) handleDHCPAddStaticLease(w http.ResponseWriter, r *http.Request) { <mask> lj := staticLeaseJSON{} <mask> err := json.NewDecoder(r.Body).Decode(&lj) <mask> if err != nil { <mask> httpError(r, w, http.StatusBadRequest, "json.Decode: %s", err) <mask> <mask> return </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove lj := staticLeaseJSON{} </s> add lj := Lease{} </s> remove response := map[string]interface{}{} </s> add response := map[string]netInterfaceJSON{} </s> remove v4conf := V4ServerConf{} s.srv4.WriteDiskConfig4(&v4conf) </s> add func (s *Server) handleDHCPStatus(w http.ResponseWriter, r *http.Request) { status := &dhcpStatusResponse{ Enabled: s.conf.Enabled, IfaceName: s.conf.InterfaceName, V4: V4ServerConf{}, V6: V6ServerConf{}, } </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeBrowsingEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) } </s> add </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeSearchEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) return } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
<mask> } <mask> <mask> ip4 := lj.IP.To4() <mask> <mask> mac, err := net.ParseMAC(lj.HWAddr) <mask> lease := Lease{ <mask> HWAddr: mac, <mask> } <mask> <mask> if ip4 == nil { <mask> lease.IP = lj.IP.To16() <mask> <mask> if err != nil { <mask> httpError(r, w, http.StatusBadRequest, "invalid MAC") </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove mac, err := net.ParseMAC(lj.HWAddr) lease := Lease{ HWAddr: mac, } </s> add </s> remove lease.IP = lj.IP.To16() </s> add lj.IP = lj.IP.To16() </s> remove lease.IP = lj.IP.To16() if err != nil { httpError(r, w, http.StatusBadRequest, "invalid MAC") return } </s> add lj.IP = lj.IP.To16() </s> remove if err != nil { httpError(r, w, http.StatusBadRequest, "invalid MAC") return } err = s.srv6.AddStaticLease(lease) </s> add err = s.srv6.AddStaticLease(lj) </s> remove lease.IP = ip4 lease.Hostname = lj.Hostname err = s.srv4.RemoveStaticLease(lease) </s> add lj.IP = ip4 err = s.srv4.RemoveStaticLease(lj)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
lj.IP = lj.IP.To16()
<mask> HWAddr: mac, <mask> } <mask> <mask> if ip4 == nil { <mask> lease.IP = lj.IP.To16() <mask> <mask> if err != nil { <mask> httpError(r, w, http.StatusBadRequest, "invalid MAC") <mask> <mask> return </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove lease.IP = lj.IP.To16() if err != nil { httpError(r, w, http.StatusBadRequest, "invalid MAC") return } </s> add lj.IP = lj.IP.To16() </s> remove mac, err := net.ParseMAC(lj.HWAddr) lease := Lease{ HWAddr: mac, } </s> add </s> remove mac, err := net.ParseMAC(lj.HWAddr) lease := Lease{ HWAddr: mac, } </s> add </s> remove if err != nil { httpError(r, w, http.StatusBadRequest, "invalid MAC") return } err = s.srv6.AddStaticLease(lease) </s> add err = s.srv6.AddStaticLease(lj) </s> remove lease.IP = ip4 lease.Hostname = lj.Hostname err = s.srv4.RemoveStaticLease(lease) </s> add lj.IP = ip4 err = s.srv4.RemoveStaticLease(lj)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
err = s.srv6.AddStaticLease(lj)
<mask> <mask> if ip4 == nil { <mask> lease.IP = lj.IP.To16() <mask> <mask> if err != nil { <mask> httpError(r, w, http.StatusBadRequest, "invalid MAC") <mask> <mask> return <mask> } <mask> <mask> err = s.srv6.AddStaticLease(lease) <mask> if err != nil { <mask> httpError(r, w, http.StatusBadRequest, "%s", err) <mask> } <mask> <mask> return </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove lease.IP = lj.IP.To16() if err != nil { httpError(r, w, http.StatusBadRequest, "invalid MAC") return } </s> add lj.IP = lj.IP.To16() </s> remove lease.IP = lj.IP.To16() </s> add lj.IP = lj.IP.To16() </s> remove mac, err := net.ParseMAC(lj.HWAddr) lease := Lease{ HWAddr: mac, } </s> add </s> remove mac, err := net.ParseMAC(lj.HWAddr) lease := Lease{ HWAddr: mac, } </s> add </s> remove lease.IP = ip4 lease.Hostname = lj.Hostname err = s.srv4.RemoveStaticLease(lease) </s> add lj.IP = ip4 err = s.srv4.RemoveStaticLease(lj)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
lj.IP = ip4 err = s.srv4.AddStaticLease(lj)
<mask> <mask> return <mask> } <mask> <mask> lease.IP = ip4 <mask> lease.Hostname = lj.Hostname <mask> err = s.srv4.AddStaticLease(lease) <mask> if err != nil { <mask> httpError(r, w, http.StatusBadRequest, "%s", err) <mask> <mask> return <mask> } </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove lease.IP = ip4 lease.Hostname = lj.Hostname err = s.srv4.RemoveStaticLease(lease) </s> add lj.IP = ip4 err = s.srv4.RemoveStaticLease(lj) </s> remove if err != nil { httpError(r, w, http.StatusBadRequest, "invalid MAC") return } err = s.srv6.AddStaticLease(lease) </s> add err = s.srv6.AddStaticLease(lj) </s> remove lease.IP = lj.IP.To16() if err != nil { httpError(r, w, http.StatusBadRequest, "invalid MAC") return } </s> add lj.IP = lj.IP.To16() </s> remove err = s.srv6.RemoveStaticLease(lease) </s> add err = s.srv6.RemoveStaticLease(lj) </s> remove lease.IP = lj.IP.To16() </s> add lj.IP = lj.IP.To16()
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
lj := Lease{}
<mask> } <mask> } <mask> <mask> func (s *Server) handleDHCPRemoveStaticLease(w http.ResponseWriter, r *http.Request) { <mask> lj := staticLeaseJSON{} <mask> err := json.NewDecoder(r.Body).Decode(&lj) <mask> if err != nil { <mask> httpError(r, w, http.StatusBadRequest, "json.Decode: %s", err) <mask> <mask> return </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove lj := staticLeaseJSON{} </s> add lj := Lease{} </s> remove response := map[string]interface{}{} </s> add response := map[string]netInterfaceJSON{} </s> remove v4conf := V4ServerConf{} s.srv4.WriteDiskConfig4(&v4conf) </s> add func (s *Server) handleDHCPStatus(w http.ResponseWriter, r *http.Request) { status := &dhcpStatusResponse{ Enabled: s.conf.Enabled, IfaceName: s.conf.InterfaceName, V4: V4ServerConf{}, V6: V6ServerConf{}, } </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeBrowsingEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) } </s> add </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeSearchEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) return } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
<mask> } <mask> <mask> ip4 := lj.IP.To4() <mask> <mask> mac, err := net.ParseMAC(lj.HWAddr) <mask> lease := Lease{ <mask> HWAddr: mac, <mask> } <mask> <mask> if ip4 == nil { <mask> lease.IP = lj.IP.To16() <mask> <mask> if err != nil { <mask> httpError(r, w, http.StatusBadRequest, "invalid MAC") </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
lj.IP = lj.IP.To16()
<mask> HWAddr: mac, <mask> } <mask> <mask> if ip4 == nil { <mask> lease.IP = lj.IP.To16() <mask> <mask> if err != nil { <mask> httpError(r, w, http.StatusBadRequest, "invalid MAC") <mask> <mask> return <mask> } <mask> <mask> err = s.srv6.RemoveStaticLease(lease) <mask> if err != nil { <mask> httpError(r, w, http.StatusBadRequest, "%s", err) <mask> } </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove lease.IP = lj.IP.To16() </s> add lj.IP = lj.IP.To16() </s> remove if err != nil { httpError(r, w, http.StatusBadRequest, "invalid MAC") return } err = s.srv6.AddStaticLease(lease) </s> add err = s.srv6.AddStaticLease(lj) </s> remove mac, err := net.ParseMAC(lj.HWAddr) lease := Lease{ HWAddr: mac, } </s> add </s> remove mac, err := net.ParseMAC(lj.HWAddr) lease := Lease{ HWAddr: mac, } </s> add </s> remove err = s.srv6.RemoveStaticLease(lease) </s> add err = s.srv6.RemoveStaticLease(lj)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
err = s.srv6.RemoveStaticLease(lj)
<mask> <mask> return <mask> } <mask> <mask> err = s.srv6.RemoveStaticLease(lease) <mask> if err != nil { <mask> httpError(r, w, http.StatusBadRequest, "%s", err) <mask> } <mask> <mask> return </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove lease.IP = lj.IP.To16() if err != nil { httpError(r, w, http.StatusBadRequest, "invalid MAC") return } </s> add lj.IP = lj.IP.To16() </s> remove if err != nil { httpError(r, w, http.StatusBadRequest, "invalid MAC") return } err = s.srv6.AddStaticLease(lease) </s> add err = s.srv6.AddStaticLease(lj) </s> remove lease.IP = ip4 lease.Hostname = lj.Hostname err = s.srv4.RemoveStaticLease(lease) </s> add lj.IP = ip4 err = s.srv4.RemoveStaticLease(lj) </s> remove lease.IP = ip4 lease.Hostname = lj.Hostname err = s.srv4.AddStaticLease(lease) </s> add lj.IP = ip4 err = s.srv4.AddStaticLease(lj) </s> remove lease.IP = lj.IP.To16() </s> add lj.IP = lj.IP.To16()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
lj.IP = ip4 err = s.srv4.RemoveStaticLease(lj)
<mask> <mask> return <mask> } <mask> <mask> lease.IP = ip4 <mask> lease.Hostname = lj.Hostname <mask> err = s.srv4.RemoveStaticLease(lease) <mask> if err != nil { <mask> httpError(r, w, http.StatusBadRequest, "%s", err) <mask> <mask> return <mask> } </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove lease.IP = ip4 lease.Hostname = lj.Hostname err = s.srv4.AddStaticLease(lease) </s> add lj.IP = ip4 err = s.srv4.AddStaticLease(lj) </s> remove if err != nil { httpError(r, w, http.StatusBadRequest, "invalid MAC") return } err = s.srv6.AddStaticLease(lease) </s> add err = s.srv6.AddStaticLease(lj) </s> remove lease.IP = lj.IP.To16() if err != nil { httpError(r, w, http.StatusBadRequest, "invalid MAC") return } </s> add lj.IP = lj.IP.To16() </s> remove err = s.srv6.RemoveStaticLease(lease) </s> add err = s.srv6.RemoveStaticLease(lj) </s> remove lease.IP = lj.IP.To16() </s> add lj.IP = lj.IP.To16()
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/dhcphttp.go
Enabled bool `yaml:"-" json:"-"` InterfaceName string `yaml:"-" json:"-"`
<mask> } <mask> <mask> // V4ServerConf - server configuration <mask> type V4ServerConf struct { <mask> Enabled bool `yaml:"-"` <mask> InterfaceName string `yaml:"-"` <mask> <mask> GatewayIP net.IP `yaml:"gateway_ip"` <mask> SubnetMask net.IP `yaml:"subnet_mask"` <mask> <mask> // The first & the last IP address for dynamic leases </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove GatewayIP net.IP `yaml:"gateway_ip"` SubnetMask net.IP `yaml:"subnet_mask"` </s> add GatewayIP net.IP `yaml:"gateway_ip" json:"gateway_ip"` SubnetMask net.IP `yaml:"subnet_mask" json:"subnet_mask"` </s> remove Enabled bool `yaml:"-"` InterfaceName string `yaml:"-"` </s> add Enabled bool `yaml:"-" json:"-"` InterfaceName string `yaml:"-" json:"-"` </s> remove RangeStart net.IP `yaml:"range_start"` RangeEnd net.IP `yaml:"range_end"` </s> add RangeStart net.IP `yaml:"range_start" json:"range_start"` RangeEnd net.IP `yaml:"range_end" json:"range_end"` </s> remove RangeStart string `yaml:"range_start"` </s> add RangeStart string `yaml:"range_start" json:"range_start"` </s> remove LeaseDuration uint32 `yaml:"lease_duration"` // in seconds </s> add LeaseDuration uint32 `yaml:"lease_duration" json:"lease_duration"` // in seconds
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/server.go
GatewayIP net.IP `yaml:"gateway_ip" json:"gateway_ip"` SubnetMask net.IP `yaml:"subnet_mask" json:"subnet_mask"`
<mask> type V4ServerConf struct { <mask> Enabled bool `yaml:"-"` <mask> InterfaceName string `yaml:"-"` <mask> <mask> GatewayIP net.IP `yaml:"gateway_ip"` <mask> SubnetMask net.IP `yaml:"subnet_mask"` <mask> <mask> // The first & the last IP address for dynamic leases <mask> // Bytes [0..2] of the last allowed IP address must match the first IP <mask> RangeStart net.IP `yaml:"range_start"` <mask> RangeEnd net.IP `yaml:"range_end"` </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove Enabled bool `yaml:"-"` InterfaceName string `yaml:"-"` </s> add Enabled bool `yaml:"-" json:"-"` InterfaceName string `yaml:"-" json:"-"` </s> remove RangeStart net.IP `yaml:"range_start"` RangeEnd net.IP `yaml:"range_end"` </s> add RangeStart net.IP `yaml:"range_start" json:"range_start"` RangeEnd net.IP `yaml:"range_end" json:"range_end"` </s> remove LeaseDuration uint32 `yaml:"lease_duration"` // in seconds </s> add LeaseDuration uint32 `yaml:"lease_duration" json:"lease_duration"` // in seconds </s> remove Enabled bool `yaml:"-"` InterfaceName string `yaml:"-"` </s> add Enabled bool `yaml:"-" json:"-"` InterfaceName string `yaml:"-" json:"-"` </s> remove RangeStart string `yaml:"range_start"` </s> add RangeStart string `yaml:"range_start" json:"range_start"`
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/server.go
RangeStart net.IP `yaml:"range_start" json:"range_start"` RangeEnd net.IP `yaml:"range_end" json:"range_end"`
<mask> SubnetMask net.IP `yaml:"subnet_mask"` <mask> <mask> // The first & the last IP address for dynamic leases <mask> // Bytes [0..2] of the last allowed IP address must match the first IP <mask> RangeStart net.IP `yaml:"range_start"` <mask> RangeEnd net.IP `yaml:"range_end"` <mask> <mask> LeaseDuration uint32 `yaml:"lease_duration"` // in seconds <mask> <mask> // IP conflict detector: time (ms) to wait for ICMP reply <mask> // 0: disable </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove LeaseDuration uint32 `yaml:"lease_duration"` // in seconds </s> add LeaseDuration uint32 `yaml:"lease_duration" json:"lease_duration"` // in seconds </s> remove GatewayIP net.IP `yaml:"gateway_ip"` SubnetMask net.IP `yaml:"subnet_mask"` </s> add GatewayIP net.IP `yaml:"gateway_ip" json:"gateway_ip"` SubnetMask net.IP `yaml:"subnet_mask" json:"subnet_mask"` </s> remove LeaseDuration uint32 `yaml:"lease_duration"` // in seconds </s> add LeaseDuration uint32 `yaml:"lease_duration" json:"lease_duration"` // in seconds </s> remove ICMPTimeout uint32 `yaml:"icmp_timeout_msec"` </s> add ICMPTimeout uint32 `yaml:"icmp_timeout_msec" json:"-"` </s> remove Enabled bool `yaml:"-"` InterfaceName string `yaml:"-"` </s> add Enabled bool `yaml:"-" json:"-"` InterfaceName string `yaml:"-" json:"-"`
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/server.go
LeaseDuration uint32 `yaml:"lease_duration" json:"lease_duration"` // in seconds
<mask> // Bytes [0..2] of the last allowed IP address must match the first IP <mask> RangeStart net.IP `yaml:"range_start"` <mask> RangeEnd net.IP `yaml:"range_end"` <mask> <mask> LeaseDuration uint32 `yaml:"lease_duration"` // in seconds <mask> <mask> // IP conflict detector: time (ms) to wait for ICMP reply <mask> // 0: disable <mask> ICMPTimeout uint32 `yaml:"icmp_timeout_msec"` <mask> </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove RangeStart net.IP `yaml:"range_start"` RangeEnd net.IP `yaml:"range_end"` </s> add RangeStart net.IP `yaml:"range_start" json:"range_start"` RangeEnd net.IP `yaml:"range_end" json:"range_end"` </s> remove ICMPTimeout uint32 `yaml:"icmp_timeout_msec"` </s> add ICMPTimeout uint32 `yaml:"icmp_timeout_msec" json:"-"` </s> remove GatewayIP net.IP `yaml:"gateway_ip"` SubnetMask net.IP `yaml:"subnet_mask"` </s> add GatewayIP net.IP `yaml:"gateway_ip" json:"gateway_ip"` SubnetMask net.IP `yaml:"subnet_mask" json:"subnet_mask"` </s> remove LeaseDuration uint32 `yaml:"lease_duration"` // in seconds </s> add LeaseDuration uint32 `yaml:"lease_duration" json:"lease_duration"` // in seconds </s> remove RangeStart string `yaml:"range_start"` </s> add RangeStart string `yaml:"range_start" json:"range_start"`
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/server.go
ICMPTimeout uint32 `yaml:"icmp_timeout_msec" json:"-"`
<mask> LeaseDuration uint32 `yaml:"lease_duration"` // in seconds <mask> <mask> // IP conflict detector: time (ms) to wait for ICMP reply <mask> // 0: disable <mask> ICMPTimeout uint32 `yaml:"icmp_timeout_msec"` <mask> <mask> // Custom Options. <mask> // <mask> // Option with arbitrary hexadecimal data: <mask> // DEC_CODE hex HEX_DATA </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove LeaseDuration uint32 `yaml:"lease_duration"` // in seconds </s> add LeaseDuration uint32 `yaml:"lease_duration" json:"lease_duration"` // in seconds </s> remove RangeStart net.IP `yaml:"range_start"` RangeEnd net.IP `yaml:"range_end"` </s> add RangeStart net.IP `yaml:"range_start" json:"range_start"` RangeEnd net.IP `yaml:"range_end" json:"range_end"` </s> remove LeaseDuration uint32 `yaml:"lease_duration"` // in seconds </s> add LeaseDuration uint32 `yaml:"lease_duration" json:"lease_duration"` // in seconds </s> remove RangeStart string `yaml:"range_start"` </s> add RangeStart string `yaml:"range_start" json:"range_start"` </s> remove Options []string `yaml:"options"` </s> add Options []string `yaml:"options" json:"-"`
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/server.go
Options []string `yaml:"options" json:"-"`
<mask> // where DEC_CODE is a decimal DHCPv4 option code in range [1..255] <mask> // <mask> // Option with IP data (only 1 IP is supported): <mask> // DEC_CODE ip IP_ADDR <mask> Options []string `yaml:"options"` <mask> <mask> ipStart net.IP // starting IP address for dynamic leases <mask> ipEnd net.IP // ending IP address for dynamic leases <mask> leaseTime time.Duration // the time during which a dynamic lease is considered valid <mask> dnsIPAddrs []net.IP // IPv4 addresses to return to DHCP clients as DNS server addresses </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove RaSlaacOnly bool `yaml:"ra_slaac_only"` // send ICMPv6.RA packets without MO flags RaAllowSlaac bool `yaml:"ra_allow_slaac"` // send ICMPv6.RA packets with MO flags </s> add RaSlaacOnly bool `yaml:"ra_slaac_only" json:"-"` // send ICMPv6.RA packets without MO flags RaAllowSlaac bool `yaml:"ra_allow_slaac" json:"-"` // send ICMPv6.RA packets with MO flags </s> remove LeaseDuration uint32 `yaml:"lease_duration"` // in seconds </s> add LeaseDuration uint32 `yaml:"lease_duration" json:"lease_duration"` // in seconds </s> remove RangeStart net.IP `yaml:"range_start"` RangeEnd net.IP `yaml:"range_end"` </s> add RangeStart net.IP `yaml:"range_start" json:"range_start"` RangeEnd net.IP `yaml:"range_end" json:"range_end"` </s> remove ICMPTimeout uint32 `yaml:"icmp_timeout_msec"` </s> add ICMPTimeout uint32 `yaml:"icmp_timeout_msec" json:"-"` </s> remove LeaseDuration uint32 `yaml:"lease_duration"` // in seconds </s> add LeaseDuration uint32 `yaml:"lease_duration" json:"lease_duration"` // in seconds
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/server.go
Enabled bool `yaml:"-" json:"-"` InterfaceName string `yaml:"-" json:"-"`
<mask> } <mask> <mask> // V6ServerConf - server configuration <mask> type V6ServerConf struct { <mask> Enabled bool `yaml:"-"` <mask> InterfaceName string `yaml:"-"` <mask> <mask> // The first IP address for dynamic leases <mask> // The last allowed IP address ends with 0xff byte <mask> RangeStart string `yaml:"range_start"` <mask> </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove Enabled bool `yaml:"-"` InterfaceName string `yaml:"-"` </s> add Enabled bool `yaml:"-" json:"-"` InterfaceName string `yaml:"-" json:"-"` </s> remove RangeStart string `yaml:"range_start"` </s> add RangeStart string `yaml:"range_start" json:"range_start"` </s> remove GatewayIP net.IP `yaml:"gateway_ip"` SubnetMask net.IP `yaml:"subnet_mask"` </s> add GatewayIP net.IP `yaml:"gateway_ip" json:"gateway_ip"` SubnetMask net.IP `yaml:"subnet_mask" json:"subnet_mask"` </s> remove LeaseDuration uint32 `yaml:"lease_duration"` // in seconds </s> add LeaseDuration uint32 `yaml:"lease_duration" json:"lease_duration"` // in seconds </s> remove RangeStart net.IP `yaml:"range_start"` RangeEnd net.IP `yaml:"range_end"` </s> add RangeStart net.IP `yaml:"range_start" json:"range_start"` RangeEnd net.IP `yaml:"range_end" json:"range_end"`
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/server.go
RangeStart string `yaml:"range_start" json:"range_start"`
<mask> InterfaceName string `yaml:"-"` <mask> <mask> // The first IP address for dynamic leases <mask> // The last allowed IP address ends with 0xff byte <mask> RangeStart string `yaml:"range_start"` <mask> <mask> LeaseDuration uint32 `yaml:"lease_duration"` // in seconds <mask> <mask> RaSlaacOnly bool `yaml:"ra_slaac_only"` // send ICMPv6.RA packets without MO flags <mask> RaAllowSlaac bool `yaml:"ra_allow_slaac"` // send ICMPv6.RA packets with MO flags </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove LeaseDuration uint32 `yaml:"lease_duration"` // in seconds </s> add LeaseDuration uint32 `yaml:"lease_duration" json:"lease_duration"` // in seconds </s> remove RaSlaacOnly bool `yaml:"ra_slaac_only"` // send ICMPv6.RA packets without MO flags RaAllowSlaac bool `yaml:"ra_allow_slaac"` // send ICMPv6.RA packets with MO flags </s> add RaSlaacOnly bool `yaml:"ra_slaac_only" json:"-"` // send ICMPv6.RA packets without MO flags RaAllowSlaac bool `yaml:"ra_allow_slaac" json:"-"` // send ICMPv6.RA packets with MO flags </s> remove Enabled bool `yaml:"-"` InterfaceName string `yaml:"-"` </s> add Enabled bool `yaml:"-" json:"-"` InterfaceName string `yaml:"-" json:"-"` </s> remove RangeStart net.IP `yaml:"range_start"` RangeEnd net.IP `yaml:"range_end"` </s> add RangeStart net.IP `yaml:"range_start" json:"range_start"` RangeEnd net.IP `yaml:"range_end" json:"range_end"` </s> remove GatewayIP net.IP `yaml:"gateway_ip"` SubnetMask net.IP `yaml:"subnet_mask"` </s> add GatewayIP net.IP `yaml:"gateway_ip" json:"gateway_ip"` SubnetMask net.IP `yaml:"subnet_mask" json:"subnet_mask"`
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/server.go
LeaseDuration uint32 `yaml:"lease_duration" json:"lease_duration"` // in seconds
<mask> // The first IP address for dynamic leases <mask> // The last allowed IP address ends with 0xff byte <mask> RangeStart string `yaml:"range_start"` <mask> <mask> LeaseDuration uint32 `yaml:"lease_duration"` // in seconds <mask> <mask> RaSlaacOnly bool `yaml:"ra_slaac_only"` // send ICMPv6.RA packets without MO flags <mask> RaAllowSlaac bool `yaml:"ra_allow_slaac"` // send ICMPv6.RA packets with MO flags <mask> <mask> ipStart net.IP // starting IP address for dynamic leases </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove RangeStart string `yaml:"range_start"` </s> add RangeStart string `yaml:"range_start" json:"range_start"` </s> remove RaSlaacOnly bool `yaml:"ra_slaac_only"` // send ICMPv6.RA packets without MO flags RaAllowSlaac bool `yaml:"ra_allow_slaac"` // send ICMPv6.RA packets with MO flags </s> add RaSlaacOnly bool `yaml:"ra_slaac_only" json:"-"` // send ICMPv6.RA packets without MO flags RaAllowSlaac bool `yaml:"ra_allow_slaac" json:"-"` // send ICMPv6.RA packets with MO flags </s> remove Enabled bool `yaml:"-"` InterfaceName string `yaml:"-"` </s> add Enabled bool `yaml:"-" json:"-"` InterfaceName string `yaml:"-" json:"-"` </s> remove RangeStart net.IP `yaml:"range_start"` RangeEnd net.IP `yaml:"range_end"` </s> add RangeStart net.IP `yaml:"range_start" json:"range_start"` RangeEnd net.IP `yaml:"range_end" json:"range_end"` </s> remove LeaseDuration uint32 `yaml:"lease_duration"` // in seconds </s> add LeaseDuration uint32 `yaml:"lease_duration" json:"lease_duration"` // in seconds
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/server.go
RaSlaacOnly bool `yaml:"ra_slaac_only" json:"-"` // send ICMPv6.RA packets without MO flags RaAllowSlaac bool `yaml:"ra_allow_slaac" json:"-"` // send ICMPv6.RA packets with MO flags
<mask> RangeStart string `yaml:"range_start"` <mask> <mask> LeaseDuration uint32 `yaml:"lease_duration"` // in seconds <mask> <mask> RaSlaacOnly bool `yaml:"ra_slaac_only"` // send ICMPv6.RA packets without MO flags <mask> RaAllowSlaac bool `yaml:"ra_allow_slaac"` // send ICMPv6.RA packets with MO flags <mask> <mask> ipStart net.IP // starting IP address for dynamic leases <mask> leaseTime time.Duration // the time during which a dynamic lease is considered valid <mask> dnsIPAddrs []net.IP // IPv6 addresses to return to DHCP clients as DNS server addresses <mask> </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove LeaseDuration uint32 `yaml:"lease_duration"` // in seconds </s> add LeaseDuration uint32 `yaml:"lease_duration" json:"lease_duration"` // in seconds </s> remove RangeStart string `yaml:"range_start"` </s> add RangeStart string `yaml:"range_start" json:"range_start"` </s> remove Options []string `yaml:"options"` </s> add Options []string `yaml:"options" json:"-"` </s> remove RangeStart net.IP `yaml:"range_start"` RangeEnd net.IP `yaml:"range_end"` </s> add RangeStart net.IP `yaml:"range_start" json:"range_start"` RangeEnd net.IP `yaml:"range_end" json:"range_end"` </s> remove LeaseDuration uint32 `yaml:"lease_duration"` // in seconds </s> add LeaseDuration uint32 `yaml:"lease_duration" json:"lease_duration"` // in seconds
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/server.go
// The function shouldn't return nil value because zero-length slice // behaves differently in cases like marshalling. Our front-end also // requires non-nil value in the response. result := []Lease{}
<mask> } <mask> <mask> // GetLeases returns the list of current DHCP leases (thread-safe) <mask> func (s *v4Server) GetLeases(flags int) []Lease { <mask> var result []Lease <mask> now := time.Now().Unix() <mask> <mask> s.leasesLock.Lock() <mask> for _, lease := range s.leases { <mask> if ((flags&LeasesDynamic) != 0 && lease.Expiry.Unix() > now && !s.blacklisted(lease)) || </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove var result []Lease </s> add // The function shouldn't return nil value because zero-length slice // behaves differently in cases like marshalling. Our front-end also // requires non-nil value in the response. result := []Lease{} </s> remove // []Lease -> JSON func convertLeases(inputLeases []Lease, includeExpires bool) []map[string]string { leases := []map[string]string{} for _, l := range inputLeases { lease := map[string]string{ "mac": l.HWAddr.String(), "ip": l.IP.String(), "hostname": l.Hostname, } if includeExpires { lease["expires"] = l.Expiry.Format(time.RFC3339) } leases = append(leases, lease) } return leases } </s> add </s> remove func (s *Server) handleDHCPStatus(w http.ResponseWriter, r *http.Request) { leases := convertLeases(s.Leases(LeasesDynamic), true) staticLeases := convertLeases(s.Leases(LeasesStatic), false) </s> add // dhcpStatusResponse is the response for /control/dhcp/status endpoint. type dhcpStatusResponse struct { Enabled bool `json:"enabled"` IfaceName string `json:"interface_name"` V4 V4ServerConf `json:"v4"` V6 V6ServerConf `json:"v6"` Leases []Lease `json:"leases"` StaticLeases []Lease `json:"static_leases"` } </s> remove lj := staticLeaseJSON{} </s> add lj := Lease{} </s> remove lj := staticLeaseJSON{} </s> add lj := Lease{}
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/v4.go
// The function shouldn't return nil value because zero-length slice // behaves differently in cases like marshalling. Our front-end also // requires non-nil value in the response. result := []Lease{}
<mask> } <mask> <mask> // GetLeases - get current leases <mask> func (s *v6Server) GetLeases(flags int) []Lease { <mask> var result []Lease <mask> s.leasesLock.Lock() <mask> for _, lease := range s.leases { <mask> if lease.Expiry.Unix() == leaseExpireStatic { <mask> if (flags & LeasesStatic) != 0 { <mask> result = append(result, *lease) </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove var result []Lease </s> add // The function shouldn't return nil value because zero-length slice // behaves differently in cases like marshalling. Our front-end also // requires non-nil value in the response. result := []Lease{} </s> remove // []Lease -> JSON func convertLeases(inputLeases []Lease, includeExpires bool) []map[string]string { leases := []map[string]string{} for _, l := range inputLeases { lease := map[string]string{ "mac": l.HWAddr.String(), "ip": l.IP.String(), "hostname": l.Hostname, } if includeExpires { lease["expires"] = l.Expiry.Format(time.RFC3339) } leases = append(leases, lease) } return leases } </s> add </s> remove func (s *Server) handleDHCPStatus(w http.ResponseWriter, r *http.Request) { leases := convertLeases(s.Leases(LeasesDynamic), true) staticLeases := convertLeases(s.Leases(LeasesStatic), false) </s> add // dhcpStatusResponse is the response for /control/dhcp/status endpoint. type dhcpStatusResponse struct { Enabled bool `json:"enabled"` IfaceName string `json:"interface_name"` V4 V4ServerConf `json:"v4"` V6 V6ServerConf `json:"v6"` Leases []Lease `json:"leases"` StaticLeases []Lease `json:"static_leases"` } </s> remove mac, err := net.ParseMAC(lj.HWAddr) lease := Lease{ HWAddr: mac, } </s> add </s> remove mac, err := net.ParseMAC(lj.HWAddr) lease := Lease{ HWAddr: mac, } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dhcpd/v6.go
<mask> d.Config.ConfigModified() <mask> } <mask> <mask> func (d *DNSFilter) handleSafeBrowsingStatus(w http.ResponseWriter, r *http.Request) { <mask> data := map[string]interface{}{ <mask> "enabled": d.Config.SafeBrowsingEnabled, <mask> } <mask> jsonVal, err := json.Marshal(data) <mask> if err != nil { <mask> httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) <mask> } <mask> <mask> w.Header().Set("Content-Type", "application/json") <mask> _, err = w.Write(jsonVal) <mask> if err != nil { <mask> httpError(r, w, http.StatusInternalServerError, "Unable to write response json: %s", err) <mask> return </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeSearchEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) return } </s> add </s> remove data := map[string]interface{}{ "enabled": d.Config.ParentalEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) return } </s> add </s> remove _, err = w.Write(jsonVal) </s> add err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.SafeBrowsingEnabled, }) </s> remove _, err = w.Write(jsonVal) </s> add err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.SafeSearchEnabled, }) </s> remove _, err = w.Write(jsonVal) </s> add err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.ParentalEnabled, })
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dnsfilter/safebrowsing.go
err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.SafeBrowsingEnabled, })
<mask> httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) <mask> } <mask> <mask> w.Header().Set("Content-Type", "application/json") <mask> _, err = w.Write(jsonVal) <mask> if err != nil { <mask> httpError(r, w, http.StatusInternalServerError, "Unable to write response json: %s", err) <mask> return <mask> } <mask> } </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeBrowsingEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) } </s> add </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeSearchEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) return } </s> add </s> remove data := map[string]interface{}{ "enabled": d.Config.ParentalEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) return } </s> add </s> remove _, err = w.Write(jsonVal) </s> add err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.SafeSearchEnabled, }) </s> remove _, err = w.Write(jsonVal) </s> add err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.ParentalEnabled, })
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dnsfilter/safebrowsing.go
<mask> d.Config.ConfigModified() <mask> } <mask> <mask> func (d *DNSFilter) handleParentalStatus(w http.ResponseWriter, r *http.Request) { <mask> data := map[string]interface{}{ <mask> "enabled": d.Config.ParentalEnabled, <mask> } <mask> jsonVal, err := json.Marshal(data) <mask> if err != nil { <mask> httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) <mask> return <mask> } <mask> <mask> w.Header().Set("Content-Type", "application/json") <mask> _, err = w.Write(jsonVal) <mask> if err != nil { <mask> httpError(r, w, http.StatusInternalServerError, "Unable to write response json: %s", err) <mask> return </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeBrowsingEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) } </s> add </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeSearchEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) return } </s> add </s> remove _, err = w.Write(jsonVal) </s> add err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.SafeBrowsingEnabled, }) </s> remove _, err = w.Write(jsonVal) </s> add err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.ParentalEnabled, }) </s> remove _, err = w.Write(jsonVal) </s> add err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.SafeSearchEnabled, })
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dnsfilter/safebrowsing.go
err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.ParentalEnabled, })
<mask> return <mask> } <mask> <mask> w.Header().Set("Content-Type", "application/json") <mask> _, err = w.Write(jsonVal) <mask> if err != nil { <mask> httpError(r, w, http.StatusInternalServerError, "Unable to write response json: %s", err) <mask> return <mask> } <mask> } </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove _, err = w.Write(jsonVal) </s> add err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.SafeBrowsingEnabled, }) </s> remove _, err = w.Write(jsonVal) </s> add err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.SafeSearchEnabled, }) </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeSearchEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) return } </s> add </s> remove data := map[string]interface{}{ "enabled": d.Config.ParentalEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) return } </s> add </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeBrowsingEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dnsfilter/safebrowsing.go
<mask> d.Config.ConfigModified() <mask> } <mask> <mask> func (d *DNSFilter) handleSafeSearchStatus(w http.ResponseWriter, r *http.Request) { <mask> data := map[string]interface{}{ <mask> "enabled": d.Config.SafeSearchEnabled, <mask> } <mask> jsonVal, err := json.Marshal(data) <mask> if err != nil { <mask> httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) <mask> return <mask> } <mask> <mask> w.Header().Set("Content-Type", "application/json") <mask> _, err = w.Write(jsonVal) <mask> if err != nil { <mask> httpError(r, w, http.StatusInternalServerError, "Unable to write response json: %s", err) <mask> return </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeBrowsingEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) } </s> add </s> remove data := map[string]interface{}{ "enabled": d.Config.ParentalEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) return } </s> add </s> remove _, err = w.Write(jsonVal) </s> add err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.SafeBrowsingEnabled, }) </s> remove _, err = w.Write(jsonVal) </s> add err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.SafeSearchEnabled, }) </s> remove _, err = w.Write(jsonVal) </s> add err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.ParentalEnabled, })
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dnsfilter/safesearch.go
err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.SafeSearchEnabled, })
<mask> return <mask> } <mask> <mask> w.Header().Set("Content-Type", "application/json") <mask> _, err = w.Write(jsonVal) <mask> if err != nil { <mask> httpError(r, w, http.StatusInternalServerError, "Unable to write response json: %s", err) <mask> return <mask> } <mask> } </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove _, err = w.Write(jsonVal) </s> add err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.SafeBrowsingEnabled, }) </s> remove _, err = w.Write(jsonVal) </s> add err := json.NewEncoder(w).Encode(&struct { Enabled bool `json:"enabled"` }{ Enabled: d.Config.ParentalEnabled, }) </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeSearchEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) return } </s> add </s> remove data := map[string]interface{}{ "enabled": d.Config.ParentalEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) return } </s> add </s> remove data := map[string]interface{}{ "enabled": d.Config.SafeBrowsingEnabled, } jsonVal, err := json.Marshal(data) if err != nil { httpError(r, w, http.StatusInternalServerError, "Unable to marshal status json: %s", err) } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
internal/dnsfilter/safesearch.go
'500': 'content': 'application/json': 'schema': '$ref': '#/components/schemas/Error' 'description': 'Not implemented (for example, on Windows).' '/dhcp/interfaces': 'get': 'tags': - 'dhcp' 'operationId': 'dhcpInterfaces' 'summary': 'Gets the available interfaces' 'responses': '200': 'description': 'OK.' 'content': 'application/json': 'schema': '$ref': '#/components/schemas/NetInterfaces' '500':
<mask> 'content': <mask> 'application/json': <mask> 'schema': <mask> '$ref': '#/components/schemas/DhcpStatus' <mask> '501': <mask> 'content': <mask> 'application/json': <mask> 'schema': <mask> '$ref': '#/components/schemas/Error' <mask> 'description': 'Not implemented (for example, on Windows).' </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove 'type': 'object' 'description': > Network interfaces dictionary, keys are interface names. 'additionalProperties': '$ref': '#/components/schemas/NetInterface' </s> add '$ref': '#/components/schemas/NetInterfaces' </s> remove 'description': 'yes|no|error' </s> add 'enum': - 'yes' - 'no' - 'error' 'description': > The result of determining static IP address. </s> remove 'description': 'yes|no|error' </s> add 'enum': - 'yes' - 'no' - 'error' 'description': > The result of searching the other DHCP server. </s> remove foundVal = "yes" </s> add result.V4.OtherServer.Found = "yes"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
openapi/openapi.yaml
'NetInterfaces': 'type': 'object' 'description': > Network interfaces dictionary, keys are interface names. 'additionalProperties': '$ref': '#/components/schemas/NetInterface'
<mask> 'items': <mask> '$ref': '#/components/schemas/DhcpStaticLease' <mask> <mask> 'DhcpSearchResult': <mask> 'type': 'object' <mask> 'description': > <mask> Information about a DHCP server discovered in the current network. </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove 'type': 'object' 'description': > Network interfaces dictionary, keys are interface names. 'additionalProperties': '$ref': '#/components/schemas/NetInterface' </s> add '$ref': '#/components/schemas/NetInterfaces' </s> remove 'description': 'yes|no|error' </s> add 'enum': - 'yes' - 'no' - 'error' 'description': > The result of searching the other DHCP server. </s> remove 'description': 'yes|no|error' </s> add 'enum': - 'yes' - 'no' - 'error' 'description': > The result of determining static IP address. </s> remove '501': </s> add '500': 'content': 'application/json': 'schema': '$ref': '#/components/schemas/Error' 'description': 'Not implemented (for example, on Windows).' '/dhcp/interfaces': 'get': 'tags': - 'dhcp' 'operationId': 'dhcpInterfaces' 'summary': 'Gets the available interfaces' 'responses': '200': 'description': 'OK.' 'content': 'application/json': 'schema': '$ref': '#/components/schemas/NetInterfaces' '500': </s> remove var result []Lease </s> add // The function shouldn't return nil value because zero-length slice // behaves differently in cases like marshalling. Our front-end also // requires non-nil value in the response. result := []Lease{}
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
openapi/openapi.yaml
'enum': - 'yes' - 'no' - 'error' 'description': > The result of searching the other DHCP server.
<mask> 'type': 'object' <mask> 'properties': <mask> 'found': <mask> 'type': 'string' <mask> 'description': 'yes|no|error' <mask> 'example': 'no' <mask> 'error': <mask> 'type': 'string' <mask> 'description': 'Set if found=error' <mask> 'example': '' </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove 'description': 'yes|no|error' </s> add 'enum': - 'yes' - 'no' - 'error' 'description': > The result of determining static IP address. </s> remove 'type': 'object' 'description': > Network interfaces dictionary, keys are interface names. 'additionalProperties': '$ref': '#/components/schemas/NetInterface' </s> add '$ref': '#/components/schemas/NetInterfaces' </s> remove '501': </s> add '500': 'content': 'application/json': 'schema': '$ref': '#/components/schemas/Error' 'description': 'Not implemented (for example, on Windows).' '/dhcp/interfaces': 'get': 'tags': - 'dhcp' 'operationId': 'dhcpInterfaces' 'summary': 'Gets the available interfaces' 'responses': '200': 'description': 'OK.' 'content': 'application/json': 'schema': '$ref': '#/components/schemas/NetInterfaces' '500': </s> remove if err != nil { httpError(r, w, http.StatusBadRequest, "invalid MAC") return } err = s.srv6.AddStaticLease(lease) </s> add err = s.srv6.AddStaticLease(lj)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
openapi/openapi.yaml
'enum': - 'yes' - 'no' - 'error' 'description': > The result of determining static IP address.
<mask> 'type': 'object' <mask> 'properties': <mask> 'static': <mask> 'type': 'string' <mask> 'description': 'yes|no|error' <mask> 'example': 'yes' <mask> 'ip': <mask> 'type': 'string' <mask> 'description': 'Set if static=no' <mask> 'example': '' </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove 'description': 'yes|no|error' </s> add 'enum': - 'yes' - 'no' - 'error' 'description': > The result of searching the other DHCP server. </s> remove 'type': 'object' 'description': > Network interfaces dictionary, keys are interface names. 'additionalProperties': '$ref': '#/components/schemas/NetInterface' </s> add '$ref': '#/components/schemas/NetInterfaces' </s> remove '501': </s> add '500': 'content': 'application/json': 'schema': '$ref': '#/components/schemas/Error' 'description': 'Not implemented (for example, on Windows).' '/dhcp/interfaces': 'get': 'tags': - 'dhcp' 'operationId': 'dhcpInterfaces' 'summary': 'Gets the available interfaces' 'responses': '200': 'description': 'OK.' 'content': 'application/json': 'schema': '$ref': '#/components/schemas/NetInterfaces' '500': </s> remove if err != nil { httpError(r, w, http.StatusBadRequest, "invalid MAC") return } err = s.srv6.AddStaticLease(lease) </s> add err = s.srv6.AddStaticLease(lj)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
openapi/openapi.yaml
'$ref': '#/components/schemas/NetInterfaces'
<mask> 'type': 'integer' <mask> 'format': 'uint16' <mask> 'example': 80 <mask> 'interfaces': <mask> 'type': 'object' <mask> 'description': > <mask> Network interfaces dictionary, keys are interface names. <mask> 'additionalProperties': <mask> '$ref': '#/components/schemas/NetInterface' <mask> 'AddressesInfoBeta': <mask> 'type': 'object' <mask> 'description': 'AdGuard Home addresses configuration' <mask> 'required': <mask> - 'dns_port' </s> Pull request: 2509 type-safety vol.1 Merge in DNS/adguard-home from 2509-type-safety to master Updates #2509. Squashed commit of the following: commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 15:06:16 2021 +0300 dhcpd: fix comments commit dc79b80381fe7a8ecec6f9659fd23710c9229f59 Author: Eugene Burkov <[email protected]> Date: Wed Jan 20 14:08:10 2021 +0300 all: improve docs commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6 Author: Eugene Burkov <[email protected]> Date: Tue Jan 19 17:08:15 2021 +0300 all: improve JSON encoding and decoding </s> remove 'description': 'yes|no|error' </s> add 'enum': - 'yes' - 'no' - 'error' 'description': > The result of determining static IP address. </s> remove 'description': 'yes|no|error' </s> add 'enum': - 'yes' - 'no' - 'error' 'description': > The result of searching the other DHCP server. </s> remove '501': </s> add '500': 'content': 'application/json': 'schema': '$ref': '#/components/schemas/Error' 'description': 'Not implemented (for example, on Windows).' '/dhcp/interfaces': 'get': 'tags': - 'dhcp' 'operationId': 'dhcpInterfaces' 'summary': 'Gets the available interfaces' 'responses': '200': 'description': 'OK.' 'content': 'application/json': 'schema': '$ref': '#/components/schemas/NetInterfaces' '500': </s> remove Options []string `yaml:"options"` </s> add Options []string `yaml:"options" json:"-"`
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5a50efadb2be6493d4c6f5fd2104b6d5861471f5
openapi/openapi.yaml
github.com/AdguardTeam/dnsproxy v0.37.4
<mask> <mask> go 1.15 <mask> <mask> require ( <mask> github.com/AdguardTeam/dnsproxy v0.37.2 <mask> github.com/AdguardTeam/golibs v0.4.5 <mask> github.com/AdguardTeam/urlfilter v0.14.5 <mask> github.com/NYTimes/gziphandler v1.1.1 <mask> github.com/ameshkov/dnscrypt/v2 v2.1.3 <mask> github.com/digineo/go-ipset/v2 v2.2.1 </s> Pull request: all: fix some races Updates #3087. Squashed commit of the following: commit e888ce524f286f3c34e14e0086336b65a95fa020 Author: Ainar Garipov <[email protected]> Date: Mon May 17 16:34:10 2021 +0300 all: fix some races </s> remove github.com/AdguardTeam/dnsproxy v0.37.2 h1:3lgizD+lZI6uqxFiQykd1/hV7Ji4vSJBMejl1rbFAXU= github.com/AdguardTeam/dnsproxy v0.37.2/go.mod h1:xkJWEuTr550gPDmB9azsciKZzSXjf9wMn+Ji54PQ4gE= </s> add github.com/AdguardTeam/dnsproxy v0.37.4 h1:YIoJkIp828LKmmmgxXvZHUKfGLsqTQAK8g+4DXbDbyU= github.com/AdguardTeam/dnsproxy v0.37.4/go.mod h1:xkJWEuTr550gPDmB9azsciKZzSXjf9wMn+Ji54PQ4gE= </s> remove config.Language = language </s> add func() { config.Lock() defer config.Unlock() config.Language = language }() </s> remove resp := statusResponse{ DNSAddrs: dnsAddrs, DNSPort: config.DNS.Port, HTTPPort: config.BindPort, IsRunning: isRunning(), Version: version.Version(), Language: config.Language, } </s> add var resp statusResponse func() { config.RLock() defer config.RUnlock() resp = statusResponse{ DNSAddrs: dnsAddrs, DNSPort: config.DNS.Port, HTTPPort: config.BindPort, IsRunning: isRunning(), Version: version.Version(), Language: config.Language, } }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5acae6e204ab3f5d92449c1231dee754c1db9abb
go.mod
github.com/AdguardTeam/dnsproxy v0.37.4 h1:YIoJkIp828LKmmmgxXvZHUKfGLsqTQAK8g+4DXbDbyU= github.com/AdguardTeam/dnsproxy v0.37.4/go.mod h1:xkJWEuTr550gPDmB9azsciKZzSXjf9wMn+Ji54PQ4gE=
<mask> dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= <mask> git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= <mask> github.com/AdguardTeam/dhcp v0.0.0-20210517101438-550ef4cd8c6e h1:M6YnFP12o0/SjBEPt6b2r8ZkIy/wsV14TK8X9Tb6DEE= <mask> github.com/AdguardTeam/dhcp v0.0.0-20210517101438-550ef4cd8c6e/go.mod h1:TKl4jN3Voofo4UJIicyNhWGp/nlQqQkFxmwIFTvBkKI= <mask> github.com/AdguardTeam/dnsproxy v0.37.2 h1:3lgizD+lZI6uqxFiQykd1/hV7Ji4vSJBMejl1rbFAXU= <mask> github.com/AdguardTeam/dnsproxy v0.37.2/go.mod h1:xkJWEuTr550gPDmB9azsciKZzSXjf9wMn+Ji54PQ4gE= <mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/AdguardTeam/golibs v0.4.4/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/AdguardTeam/golibs v0.4.5 h1:RRA9ZsmbJEN4OllAx0BcfvSbRBxxpWluJijBYmtp13U= <mask> github.com/AdguardTeam/golibs v0.4.5/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= </s> Pull request: all: fix some races Updates #3087. Squashed commit of the following: commit e888ce524f286f3c34e14e0086336b65a95fa020 Author: Ainar Garipov <[email protected]> Date: Mon May 17 16:34:10 2021 +0300 all: fix some races </s> remove github.com/AdguardTeam/dnsproxy v0.37.2 </s> add github.com/AdguardTeam/dnsproxy v0.37.4 </s> remove config.Language = language </s> add func() { config.Lock() defer config.Unlock() config.Language = language }() </s> remove resp := statusResponse{ DNSAddrs: dnsAddrs, DNSPort: config.DNS.Port, HTTPPort: config.BindPort, IsRunning: isRunning(), Version: version.Version(), Language: config.Language, } </s> add var resp statusResponse func() { config.RLock() defer config.RUnlock() resp = statusResponse{ DNSAddrs: dnsAddrs, DNSPort: config.DNS.Port, HTTPPort: config.BindPort, IsRunning: isRunning(), Version: version.Version(), Language: config.Language, } }()
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5acae6e204ab3f5d92449c1231dee754c1db9abb
go.sum
var resp statusResponse func() { config.RLock() defer config.RUnlock() resp = statusResponse{ DNSAddrs: dnsAddrs, DNSPort: config.DNS.Port, HTTPPort: config.BindPort, IsRunning: isRunning(), Version: version.Version(), Language: config.Language, } }()
<mask> <mask> return <mask> } <mask> <mask> resp := statusResponse{ <mask> DNSAddrs: dnsAddrs, <mask> DNSPort: config.DNS.Port, <mask> HTTPPort: config.BindPort, <mask> IsRunning: isRunning(), <mask> Version: version.Version(), <mask> Language: config.Language, <mask> } <mask> <mask> var c *dnsforward.FilteringConfig <mask> if Context.dnsServer != nil { <mask> c = &dnsforward.FilteringConfig{} <mask> Context.dnsServer.WriteDiskConfig(c) </s> Pull request: all: fix some races Updates #3087. Squashed commit of the following: commit e888ce524f286f3c34e14e0086336b65a95fa020 Author: Ainar Garipov <[email protected]> Date: Mon May 17 16:34:10 2021 +0300 all: fix some races </s> remove config.Language = language </s> add func() { config.Lock() defer config.Unlock() config.Language = language }() </s> remove github.com/AdguardTeam/dnsproxy v0.37.2 h1:3lgizD+lZI6uqxFiQykd1/hV7Ji4vSJBMejl1rbFAXU= github.com/AdguardTeam/dnsproxy v0.37.2/go.mod h1:xkJWEuTr550gPDmB9azsciKZzSXjf9wMn+Ji54PQ4gE= </s> add github.com/AdguardTeam/dnsproxy v0.37.4 h1:YIoJkIp828LKmmmgxXvZHUKfGLsqTQAK8g+4DXbDbyU= github.com/AdguardTeam/dnsproxy v0.37.4/go.mod h1:xkJWEuTr550gPDmB9azsciKZzSXjf9wMn+Ji54PQ4gE= </s> remove github.com/AdguardTeam/dnsproxy v0.37.2 </s> add github.com/AdguardTeam/dnsproxy v0.37.4
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/5acae6e204ab3f5d92449c1231dee754c1db9abb
internal/home/control.go